ordinis: Fitting Lasso-penalized Using the Coordinate Descent...

Description Usage Arguments Examples

Description

ordinis provides estimation of linear models with the lasso penalty

Usage

1
2
3
4
5
6
7
8
ordinis(x, y, weights = rep(1, NROW(y)), offset = NULL,
  family = NULL, penalty = c("lasso", "alasso", "mcp", "scad"),
  lambda = numeric(0), alpha = 1, gamma = ifelse(penalty == "scad",
  3.7, 1.4), penalty.factor = NULL, upper.limits = rep(Inf, NCOL(x)),
  lower.limits = rep(-Inf, NCOL(x)), nlambda = 100L,
  lambda.min.ratio = NULL, intercept = TRUE, standardize = TRUE,
  dfmax = nvars, maxit = NULL, tol = NULL, maxit.irls = 25L,
  tol.irls = 0.001)

Arguments

x

The design matrix

y

The response vector

weights

a vector of weights of length equal to length of y. weights are NOT standardized or scaled; the user must do this if desired

offset

A vector of length nobs that is included in the linear predictor

family

family of underlying model. Only "gaussian" for continuous responses is available now

penalty

a string indicating which penalty to use. "lasso", "MCP", and "SCAD" are available

lambda

A user provided sequence of λ. If set to NULL, the program will calculate its own sequence according to nlambda and lambda_min_ratio, which starts from λ_0 (with this λ all coefficients will be zero) and ends at lambda0 * lambda_min_ratio, containing nlambda values equally spaced in the log scale. It is recommended to set this parameter to be NULL (the default).

alpha

mixing parameter between 0 and 1 for elastic net. alpha=1 is for the lasso, alpha=0 is for ridge

gamma

parameter for MCP/SCAD. Defaults to the recommended values from the papers corresponding to each penalty

penalty.factor

a vector with length equal to the number of columns in x to be multiplied by lambda. by default it is a vector of 1s. penalty.factor is NOT scaled

upper.limits

a vector of length ncol(x) of upper limits for each coefficient. Can be a single value, which will then be applied for each coefficient. Must be non-negative.

lower.limits

a vector of length ncol(x) of lower limits for each coefficient. Can be a single value, which will then be applied for each coefficient. Cannot be greater than 0.

nlambda

Number of values in the λ sequence. Only used when the program calculates its own λ (by setting lambda = NULL).

lambda.min.ratio

Smallest value in the λ sequence as a fraction of λ_0. See the explanation of the lambda argument. This parameter is only used when the program calculates its own λ (by setting lambda = NULL). The default value is the same as glmnet: 0.001 if nrow(x) >= ncol(x) and 0.05 otherwise.

intercept

Whether to fit an intercept in the model. Default is TRUE.

standardize

Whether to standardize the design matrix before fitting the model. Default is TRUE. Fitted coefficients are always returned on the original scale.

dfmax

Maximum number of variables allowed in the model

maxit

Maximum number of coordinate descent iterations.

tol

convergence tolerance parameter.

maxit.irls

Maximum number of coordinate descent iterations.

tol.irls

convergence tolerance parameter.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
set.seed(123)
n = 100
p = 1000
b = c(runif(10, min = 0.1, max = 1), rep(0, p - 10))
x = matrix(rnorm(n * p, sd = 1.5), n, p)
y = drop(x %*% b) + rnorm(n)


## fit lasso model with 100 tuning parameter values
res <- ordinis(x, y)

y2 <- 1 * (y > 0)
y3 <- exp(y)

resb <- ordinis(x, y2, family = "binomial")

jaredhuling/ordinis documentation built on May 23, 2019, 4:03 a.m.