multiview.cox.fit: Fit a Cox regression model with elastic net regularization...

View source: R/coxpath.R

multiview.cox.fitR Documentation

Fit a Cox regression model with elastic net regularization for a single value of lambda

Description

Fit a Cox regression model via penalized maximum likelihood for a single value of lambda. Can deal with (start, stop] data and strata, as well as sparse design matrices.

Usage

multiview.cox.fit(
  x_list,
  x,
  y,
  rho,
  weights,
  lambda,
  alpha = 1,
  offset = rep(0, nobs),
  thresh = 1e-10,
  maxit = 1e+05,
  penalty.factor = rep(1, nvars),
  exclude = c(),
  lower.limits = -Inf,
  upper.limits = Inf,
  warm = NULL,
  from.cox.path = FALSE,
  save.fit = FALSE,
  trace.it = 0
)

Arguments

x_list

a list of x matrices with same number of rows nobs

x

the cbinded matrices in x_list

y

the quantitative response with length equal to nobs, the (same) number of rows in each x matrix

rho

the weight on the agreement penalty, default 0. rho=0 is a form of early fusion, and rho=1 is a form of late fusion. We recommend trying a few values of rho including 0, 0.1, 0.25, 0.5, and 1 first; sometimes rho larger than 1 can also be helpful.

weights

observation weights. Can be total counts if responses are proportion matrices. Default is 1 for each observation

lambda

A single value for the lambda hyperparameter.

alpha

The elasticnet mixing parameter, with 0\le\alpha\le 1. The penalty is defined as

(1-\alpha)/2||\beta||_2^2+\alpha||\beta||_1.

alpha=1 is the lasso penalty, and alpha=0 the ridge penalty.

offset

A vector of length nobs that is included in the linear predictor (a nobs x nc matrix for the "multinomial" family). Useful for the "poisson" family (e.g. log of exposure time), or for refining a model by starting at a current fit. Default is NULL. If supplied, then values must also be supplied to the predict function.

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 thresh times the null deviance. Defaults value is 1E-7.

maxit

Maximum number of passes over the data for all lambda values; default is 10^5.

penalty.factor

Separate penalty factors can be applied to each coefficient. This is a number that multiplies lambda to allow differential shrinkage. Can be 0 for some variables, which implies no shrinkage, and that variable is always included in the model. Default is 1 for all variables (and implicitly infinity for variables listed in exclude). Note: the penalty factors are internally rescaled to sum to nvars, and the lambda sequence will reflect this change.

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 exclude function that generates the list of indices. This function is most generally defined as ⁠function(x_list, y, ...)⁠, and is called inside multiview to generate the indices for excluded variables. The ... argument is required, the others are optional. This is useful for filtering wide data, and works correctly with cv.multiview. See the vignette 'Introduction' for examples.

lower.limits

Vector of lower limits for each coefficient; default -Inf. Each of these must be non-positive. Can be presented as a single value (which will then be replicated), else a vector of length nvars

upper.limits

Vector of upper limits for each coefficient; default Inf. See lower.limits

warm

Either a glmnetfit object or a list (with names beta and a0 containing coefficients and intercept respectively) which can be used as a warm start. Default is NULL, indicating no warm start. For internal use only.

from.cox.path

Was multiview.cox.fit() called from multiview.path()? Default is FALSE.This has implications for computation of the penalty factors.

save.fit

Return the warm start object? Default is FALSE.

trace.it

If trace.it=1, then a progress bar is displayed; useful for big models that take a long time to fit.

Details

WARNING: Users should not call multiview.cox.fit directly. Higher-level functions in this package call multiview.cox.fit as a subroutine. If a warm start object is provided, some of the other arguments in the function may be overriden.

multiview.cox.fit solves the elastic net problem for a single, user-specified value of lambda. multiview.cox.fit works for Cox regression models, including (start, stop] data and strata. It solves the problem using iteratively reweighted least squares (IRLS). For each IRLS iteration, multiview.cox.fit makes a quadratic (Newton) approximation of the log-likelihood, then calls elnet.fit to minimize the resulting approximation.

In terms of standardization: multiview.cox.fit does not standardize x and weights. penalty.factor is standardized so that they sum up to nvars.

Value

An object with class "coxnet", "glmnetfit" and "glmnet". The list returned contains more keys than that of a "glmnet" object.

a0

Intercept value, NULL for "cox" family.

beta

A nvars x 1 matrix of coefficients, stored in sparse matrix format.

df

The number of nonzero coefficients.

dim

Dimension of coefficient matrix.

lambda

Lambda value used.

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.

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.

warm_fit

If save.fit=TRUE, output of C++ routine, used for warm starts. For internal use only.

family

Family used for the model, always "cox".

converged

A logical variable: was the algorithm judged to have converged?

boundary

A logical variable: is the fitted value on the boundary of the attainable values?

obj_function

Objective function value at the solution.


multiview documentation built on April 3, 2023, 5:20 p.m.