% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/lambda-path.R
\name{lambda_path}
\alias{lambda_path}
\title{Calculate a sequence of penalty parameters}
\usage{
lambda_path(
  x,
  y,
  alpha = 1,
  standardize = FALSE,
  standardize_response = FALSE,
  intercept = TRUE,
  lambda_min_ratio = "expand",
  nlambda = 100
)
}
\arguments{
\item{x}{Input matrix, of dimension nobs x nvars; each row is an observation vector.
\code{nvars} should be greater than one. In other words \code{x} should have 2 or more columns.
\code{x} can be in the sparse matrix format (inherit from class "\code{sparseMatrix}" as in package \code{Matrix}).}

\item{y}{A matrix of quantitative responses.}

\item{alpha}{The elasticnet mixing parameter, with \eqn{0 \leq \alpha \leq 1}. The penalty is defined as
\deqn{(1 - \alpha)/2\|B\|_2^2 + \alpha\|B\|_2}
\code{alpha = 1} is the group lasso penalty, and \code{alpha = 0} is the ridge penalty.}

\item{standardize}{Logical flag for \code{x} variable standardization, prior to fitting the model sequence.
The coefficients are always returned on the original scale. Default is \code{standardize = FALSE}.}

\item{standardize_response}{This allows the user to standardize the response variables.
Default is \code{standardize_response = FALSE}.}

\item{intercept}{Should intercepts be fitted (default = TRUE) or set to zero (FALSE).}

\item{lambda_min_ratio}{The smallest value for \code{lambda}, as a fraction of \code{lambda_max}
(the data derived value for which all coefficients are zero). \code{lambda_min_ratio = "expand"} (default) sets the ratio as
\eqn{10^{-\lfloor \log_{10}(\lambda_{max})\rfloor-2}} whereas \code{lambda_min_ratio = "glmnet"} sets the ratio to the value used in the \code{glmnet} package.
If \code{nobs < nvars}, the default is \code{0.01}, otherwise \code{1e-04}.}

\item{nlambda}{The number of lambda values. Default is 100.}
}
\value{
A sequence of penalty parameters
}
\description{
Generates a decreasing sequence of regularization parameters for penalized
multivariate regression by estimating the maximum lambda from the data and
constructing a log-spaced path to a minimum value, with options for standardization
and handling of zero-variance predictors and responses.
}
\examples{
set.seed(2024)
n <- 100
p <- 50
k <- 2
x <- matrix(rnorm(n * p), ncol = p)
y <- matrix(rnorm(n * k), ncol = k)
glmnet::glmnet(x, y, family = "mgaussian", standardize = FALSE,
               standardize.response = FALSE, intercept = TRUE)$lambda
lambda_path(x, y, lambda_min_ratio = "glmnet")
}
\author{
Shanika L Wickramasuriya
}
