picasso {picasso} | R Documentation |
PathwIse CAlibrated Sparse Shooting algOrithm (PICASSO)
Description
The function "picasso" implements the user interface.
Usage
picasso(X, Y, lambda = NULL, nlambda = 100, lambda.min.ratio =
0.05, family = "gaussian", method = "l1",
type.gaussian = "naive", gamma = 3, df = NULL,
standardize = TRUE, intercept = TRUE, prec = 1e-07,
max.ite = 1000, verbose = FALSE)
Arguments
X |
|
Y |
|
lambda |
A sequence of decresing positive values to control the regularization. Typical usage is to leave the input |
nlambda |
The number of values used in |
lambda.min.ratio |
The smallest value for |
Caution: logistic and poisson regression can be ill-conditioned if lambda is too small for nonconvex penalty. We suggest the user to avoid using any lambda.min.raito smaller than 0.05 for logistic/poisson regression under nonconvex penalty.
family |
Options for model. Sparse linear regression and sparse multivariate regression is applied if |
method |
Options for regularization. Lasso is applied if |
type.gaussian |
Options for updating residuals in sparse linear regression. The naive update rule is applied if |
gamma |
The concavity parameter for MCP and SCAD. The default value is |
df |
Maximum degree of freedom for the covariance update. The default value is |
standardize |
Design matrix X will be standardized to have mean zero and unit standard deviation if |
intercept |
Does the model has intercept term or not. Default value is |
prec |
Stopping precision. The default value is 1e-7. |
max.ite |
Max number of iterations for the algorithm. The default value is 1000. |
verbose |
Tracing information is disabled if |
Details
For sparse linear regression,
\min_{\beta} {\frac{1}{2n}}|| Y - X \beta - \beta_0||_2^2 + \lambda R(\beta),
where R(\beta)
can be \ell_1
norm, MCP, SCAD regularizers.
For sparse logistic regression,
\min_{\beta} {\frac{1}{n}}\sum_{i=1}^n (\log(1+e^{x_i^T \beta+ \beta_0}) - y_i x_i^T \beta) + \lambda R(\beta),
where R(\beta)
can be \ell_1
norm, MCP, and SCAD regularizers.
For sparse poisson regression,
\min_{\beta} {\frac{1}{n}}\sum_{i=1}^n (e^{x_i^T \beta + \beta_0} - y_i (x_i^T \beta+\beta_0) + \lambda R(\beta),
where R(\beta)
can be \ell_1
norm, MCP or SCAD regularizers.
Value
An object with S3 classes "gaussian"
, "binomial"
, and "poisson"
corresponding to sparse linear regression, sparse logistic regression, and sparse poisson regression respectively is returned:
beta |
A matrix of regression estimates whose columns correspond to regularization parameters for sparse linear regression and sparse logistic regression. A list of matrices of regression estimation corresponding to regularization parameters for sparse column inverse operator. |
intercept |
The value of intercepts corresponding to regularization parameters for sparse linear regression, and sparse logistic regression. |
Y |
The value of |
X |
The value of |
lambda |
The sequence of regularization parameters |
nlambda |
The number of values used in |
family |
The |
method |
The |
path |
A list of |
sparsity |
The sparsity levels of the graph path for sparse inverse column operator. |
standardize |
The |
df |
The degree of freecom (number of nonzero coefficients) along the solution path for sparse linear regression, nd sparse logistic regression. |
ite |
A list of vectors where the i-th entries of ite[[1]] and ite[[2]] correspond to the outer iteration and inner iteration of i-th regularization parameter respectively. |
verbose |
The |
Author(s)
Jason Ge, Xingguo Li, Mengdi Wang, Tong Zhang, Han Liu and Tuo Zhao
Maintainer: Jason Ge <jiange@princeton.edu>
References
1. J. Friedman, T. Hastie and H. Hofling and R. Tibshirani. Pathwise coordinate optimization. The Annals of Applied Statistics, 2007.
2. C.H. Zhang. Nearly unbiased variable selection under minimax concave penalty. Annals of Statistics, 2010.
3. J. Fan and R. Li. Variable selection via nonconcave penalized likelihood and its oracle
properties. Journal of the American Statistical Association, 2001.
4. R. Tibshirani, J. Bien, J. Friedman, T. Hastie, N. Simon, J. Taylor and R. Tibshirani. Strong rules for discarding predictors in lasso-type problems. Journal of the Royal Statistical Society: Series B, 2012.
5. T. Zhao, H. Liu, and T. Zhang. A General Theory of Pathwise Coordinate Optimization. Techinical Report, Princeton Univeristy.
See Also
Examples
################################################################
## Sparse linear regression
## Generate the design matrix and regression coefficient vector
n = 100 # sample number
d = 80 # sample dimension
c = 0.5 # correlation parameter
s = 20 # support size of coefficient
set.seed(2016)
X = scale(matrix(rnorm(n*d),n,d)+c*rnorm(n))/sqrt(n-1)*sqrt(n)
beta = c(runif(s), rep(0, d-s))
## Generate response using Gaussian noise, and fit sparse linear models
noise = rnorm(n)
Y = X%*%beta + noise
## l1 regularization solved with naive update
fitted.l1.naive = picasso(X, Y, nlambda=100, type.gaussian="naive")
## l1 regularization solved with covariance update
fitted.l1.covariance = picasso(X, Y, nlambda=100, type.gaussian="covariance")
## mcp regularization
fitted.mcp = picasso(X, Y, nlambda=100, method="mcp")
## scad regularization
fitted.scad = picasso(X, Y, nlambda=100, method="scad")
## lambdas used
print(fitted.l1.naive$lambda)
## number of nonzero coefficients for each lambda
print(fitted.l1.naive$df)
## coefficients and intercept for the i-th lambda
i = 30
print(fitted.l1.naive$lambda[i])
print(fitted.l1.naive$beta[,i])
print(fitted.l1.naive$intercept[i])
## Visualize the solution path
plot(fitted.l1.naive)
plot(fitted.l1.covariance)
plot(fitted.mcp)
plot(fitted.scad)
################################################################
## Sparse logistic regression
## Generate the design matrix and regression coefficient vector
n <- 100 # sample number
d <- 80 # sample dimension
c <- 0.5 # parameter controlling the correlation between columns of X
s <- 20 # support size of coefficient
set.seed(2016)
X <- scale(matrix(rnorm(n*d),n,d)+c*rnorm(n))/sqrt(n-1)*sqrt(n)
beta <- c(runif(s), rep(0, d-s))
## Generate response and fit sparse logistic models
p = 1/(1+exp(-X%*%beta))
Y = rbinom(n, rep(1,n), p)
## l1 regularization
fitted.l1 = picasso(X, Y, nlambda=100, family="binomial", method="l1")
## mcp regularization
fitted.mcp = picasso(X, Y, nlambda=100, family="binomial", method="mcp")
## scad regularization
fitted.scad = picasso(X, Y, nlambda=100, family="binomial", method="scad")
## lambdas used
print(fitted.l1$lambda)
## number of nonzero coefficients for each lambda
print(fitted.l1$df)
## coefficients and intercept for the i-th lambda
i = 30
print(fitted.l1$lambda[i])
print(fitted.l1$beta[,i])
print(fitted.l1$intercept[i])
## Visualize the solution path
plot(fitted.l1)
## Estimate of Bernoulli parameters
param.l1 = fitted.l1$p
################################################################
## Sparse poisson regression
## Generate the design matrix and regression coefficient vector
n <- 100 # sample number
d <- 80 # sample dimension
c <- 0.5 # parameter controlling the correlation between columns of X
s <- 20 # support size of coefficient
set.seed(2016)
X <- scale(matrix(rnorm(n*d),n,d)+c*rnorm(n))/sqrt(n-1)*sqrt(n)
beta <- c(runif(s), rep(0, d-s))/sqrt(s)
## Generate response and fit sparse poisson models
p = X%*%beta+rnorm(n)
Y = rpois(n, exp(p))
## l1 regularization
fitted.l1 = picasso(X, Y, nlambda=100, family="poisson", method="l1")
## mcp regularization
fitted.mcp = picasso(X, Y, nlambda=100, family="poisson", method="mcp")
## scad regularization
fitted.scad = picasso(X, Y, nlambda=100, family="poisson", method="scad")
## lambdas used
print(fitted.l1$lambda)
## number of nonzero coefficients for each lambda
print(fitted.l1$df)
## coefficients and intercept for the i-th lambda
i = 30
print(fitted.l1$lambda[i])
print(fitted.l1$beta[,i])
print(fitted.l1$intercept[i])
## Visualize the solution path
plot(fitted.l1)