multiview.cox.path | R Documentation |
Fit a Cox regression model via penalized maximum likelihood for a path of lambda values. Can deal with (start, stop] data and strata, as well as sparse design matrices.
multiview.cox.path(
x_list,
x,
y,
rho = 0,
weights = NULL,
lambda = NULL,
offset = NULL,
alpha = 1,
nlambda = 100,
lambda.min.ratio = ifelse(nobs < nvars, 0.01, 1e-04),
standardize = TRUE,
intercept = TRUE,
thresh = 1e-07,
exclude = integer(0),
penalty.factor = rep(1, nvars),
lower.limits = -Inf,
upper.limits = Inf,
maxit = 1e+05,
trace.it = 0,
nvars,
nobs,
xm,
xs,
control,
vp,
vnames,
is.offset
)
x_list |
a list of |
x |
the |
y |
the quantitative response with length equal to |
rho |
the weight on the agreement penalty, default 0. |
weights |
observation weights. Can be total counts if responses are proportion matrices. Default is 1 for each observation |
lambda |
A user supplied |
offset |
A vector of length |
alpha |
The elasticnet mixing parameter, with
|
nlambda |
The number of |
lambda.min.ratio |
Smallest value for |
standardize |
Logical flag for x variable standardization,
prior to fitting the model sequence. The coefficients are always
returned on the original scale. Default is
|
intercept |
Should intercept(s) be fitted (default |
thresh |
Convergence threshold for coordinate descent. Each
inner coordinate-descent loop continues until the maximum change
in the objective after any coefficient update is less than
|
exclude |
Indices of variables to be excluded from the
model. Default is none. Equivalent to an infinite penalty factor
for the variables excluded (next item). Users can supply instead
an |
penalty.factor |
Separate penalty factors can be applied to
each coefficient. This is a number that multiplies |
lower.limits |
Vector of lower limits for each coefficient;
default |
upper.limits |
Vector of upper limits for each coefficient;
default |
maxit |
Maximum number of passes over the data for all lambda values; default is 10^5. |
trace.it |
If |
nvars |
the number of variables (total) |
nobs |
the number of observations |
xm |
the column means vector (could be zeros if |
xs |
the column std dev vector (could be 1s if |
control |
the multiview control object |
vp |
the variable penalities (processed) |
vnames |
the variable names |
is.offset |
a flag indicating if offset is supplied or not |
Sometimes the sequence is truncated before nlambda
values of lambda
have been used. This happens when cox.path
detects that the
decrease in deviance is marginal (i.e. we are near a saturated fit).
An object of class "coxnet" and "glmnet".
a0 |
Intercept value, |
beta |
A |
df |
The number of nonzero coefficients for each value of lambda. |
dim |
Dimension of coefficient matrix. |
lambda |
The actual sequence of lambda values used. When alpha=0, the largest lambda reported does not quite give the zero coefficients reported (lambda=inf would in principle). Instead, the largest lambda for alpha=0.001 is used, and the sequence of lambda values is derived from this. |
dev.ratio |
The fraction of (null) deviance explained. The deviance calculations incorporate weights if present in the model. The deviance is defined to be 2*(loglike_sat - loglike), where loglike_sat is the log-likelihood for the saturated model (a model with a free parameter per observation). Hence dev.ratio=1-dev/nulldev. |
nulldev |
Null deviance (per observation). This is defined to be 2*(loglike_sat -loglike(Null)). The null model refers to the 0 model. |
npasses |
Total passes over the data summed over all lambda values. |
jerr |
Error flag, for warnings and errors (largely for internal debugging). |
offset |
A logical variable indicating whether an offset was included in the model. |
call |
The call that produced this object. |
nobs |
Number of observations. |
set.seed(2)
nobs <- 100; nvars <- 15
xvec <- rnorm(nobs * nvars)
xvec[sample.int(nobs * nvars, size = 0.4 * nobs * nvars)] <- 0
x <- matrix(xvec, nrow = nobs)
beta <- rnorm(nvars / 3)
fx <- x[, seq(nvars / 3)] %*% beta / 3
ty <- rexp(nobs, exp(fx))
tcens <- rbinom(n = nobs, prob = 0.3, size = 1)
jsurv <- survival::Surv(ty, tcens)
fit1 <- glmnet:::cox.path(x, jsurv)
# works with sparse x matrix
x_sparse <- Matrix::Matrix(x, sparse = TRUE)
fit2 <- glmnet:::cox.path(x_sparse, jsurv)
# example with (start, stop] data
set.seed(2)
start_time <- runif(100, min = 0, max = 5)
stop_time <- start_time + runif(100, min = 0.1, max = 3)
status <- rbinom(n = nobs, prob = 0.3, size = 1)
jsurv_ss <- survival::Surv(start_time, stop_time, status)
fit3 <- glmnet:::cox.path(x, jsurv_ss)
# example with strata
jsurv_ss2 <- glmnet::stratifySurv(jsurv_ss, rep(1:2, each = 50))
fit4 <- glmnet:::cox.path(x, jsurv_ss2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.