Description Usage Arguments Details Value References Author(s) See Also Examples
Fit accelerated failure time models using interval censored data via elastic net penalized maximum likeihood. Solutions are computed using coordinate descent for a path of values of the regularization parameter lambda. Supports gaussian, logistic and extreme value distributions.
1 2 3 4 5 6 | iregnet(x, y, family = c("gaussian", "logistic", "loggaussian",
"loglogistic", "extreme_value", "exponential", "weibull"), alpha = 1,
lambda = NULL, num_lambda = 100, intercept = TRUE,
standardize = TRUE, scale_init = NA, estimate_scale = TRUE,
maxiter = 1000, threshold = 0.001, unreg_sol = TRUE,
eps_lambda = NA, debug = 0)
|
x |
Input matrix of covariates with dimension n_obs * n_vars, with nvars ≥ 2. Sparse matrices are not supported. |
y |
Response variable. It can take two forms:
|
family |
The distribution to fit. It can be one of "gaussian", "logistic",
"loggaussian", "loglogistic", "extreme_value", "exponential". Partial matching
is allowed.
|
alpha |
Elastic net mixing parameter, with 0 ≤ α ≤ 1. The
elastic net penalty is defined as in 0.5 * (1-α) \|β\|_2^2 | + α \|β\|_1 alpha=1 is the lasso penalty, and alpha=0 is ridge penalty.
|
lambda |
Vector containing the path of decreasing regularization
parameter lambda values. |
num_lambda |
The number of lambda values calculated by the function.
Ignored if |
intercept |
|
standardize |
|
scale_init |
Initial value of the scale parameter to use. If not supplied,
a suitable value is calculated depending on the distribution.
|
estimate_scale |
|
maxiter |
Maximum number of iterations over data per lambda value.
|
threshold |
The convergence threshold for coordinate descent. The inner
loop continues until the absolute update in each parameter is greater than
|
unreg_sol |
|
eps_lambda |
The ratio of the minimum value of |
debug |
|
At each regularization parater value lambda
, cyclic coordinate
descent is used to update the parameters until convergence. The intercept and
the scale parameter are never regularized.
The obtained solution is used to initialize the parameters at the next
lambda
value.
Returns a S3 object iregnet with the following elements:
beta | Matrix of size (n_vars+1) * num_lambda containing
intercept, coefficients of X for each lambda in the fit model.
|
call | Copy of the call that produced this object. |
lambda | Vector of size num_lambda of (calculated or
supplied) regularization parameter lambda values. |
loglik | Vector of size num_lambda of log-likelihoods of
the fit at each lambda value, excluding the contribution of the
penalty terms. |
num_lambda | Number of lambda values. |
n_iters | Vector of size num_lambda of number of iterations
taken at each lambda . |
scale | Vector of size num_lambda of estimated
scale at each lambda value, if estimate_scale == TRUE . Same as
scale_init otherwise. |
scale_init | Initial value (calculated or supplied) of scale . |
estimate_scale | TRUE if the scale was estimated. |
error_status | The error status. 0 denotes no errors.
-1 denotes that convergence was not reached in maxiter . |
Friedman, J., Hastie, T. and Tibshirani, R. (2008) Regularization Paths for Generalized Linear Models via Coordinate Descent, http://www.stanford.edu/~hastie/Papers/glmnet.pdf
Simon, N., Friedman, J., Hastie, T., Tibshirani, R. (2011) Regularization Paths for Cox's Proportional Hazards Model via Coordinate Descent, Journal of Statistical Software, Vol. 39(5) 1-13 http://www.jstatsoft.org/v39/i05/
Anuj Khare, Toby Dylan Hocking, Jelle Goeman.
Maintainer: Anuj Khare khareanuj18@gmail.com
predict.iregnet
, cv.iregnet
, plot.iregnet
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | # y can be a 2 column matrix.
set.seed(10)
X <- matrix(rnorm(50), 10, 5)
y <- matrix(rnorm(20), 10, 2)
y <- t(apply(y, 1, sort)) # intervals must be non-decreasing
fit1 <- iregnet(X, y)
# Surv objects from survival are also supported.
data("ovarian", package="survival")
library(survival)
X <- cbind(ovarian$ecog.ps, ovarian$rx)
y <- Surv(ovarian$futime, ovarian$fustat)
fit2 <- iregnet(X, y)
# Log-Gaussian is same as Gaussian with log-transformed data
X <- cbind(ovarian$ecog.ps, ovarian$rx)
y <- Surv(ovarian$futime, ovarian$fustat)
y_log <- Surv(log(ovarian$futime), ovarian$fustat)
fit3 <- iregnet(X, y_log, "gaussian", threshold=1e-2)
fit4 <- iregnet(X, y, "loggaussian", threshold=1e-2)
# Scale parameter can be fixed by setting the estimate_scale flag.
set.seed(10)
X <- matrix(rnorm(50), 10, 5)
y <- matrix(rnorm(20), 10, 2)
y <- t(apply(y, 1, sort)) # intervals must be non-decreasing
fit5 <- iregnet(X, y, scale_init=1, estimate_scale=FALSE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.