# IWLSCoxridge: Iterative weighted least squares algorithm for Cox ridge... In multiridge: Fast Cross-Validation for Multi-Penalty Ridge Regression

## Description

Iterative weighted least squares algorithm for Cox ridge regression. Updates the weights and linear predictors until convergence.

## Usage

 ```1 2``` ```IWLSCoxridge(XXT, Y, X1 = NULL, intercept = FALSE, eps = 1e-07, maxItr = 25, trace = FALSE, E0 = NULL) ```

## Arguments

 `XXT` Matrix. Dimensions `nxn`. Sample cross-product from penalized variables, usually computed by `SigmaFromBlocks`. `Y` Response vector: class `survival`. `X1` Matrix. Dimension `n x p_0, p_0 < n`, representing unpenalized covariates. `intercept` Boolean. Should an intercept be included? `eps` Scalar. Numerical bound for IWLS convergence. `maxItr` Integer. Maximum number of iterations used in IWLS. `trace` Boolean. Should the output of the IWLS algorithm be traced? `E0` Numerical vector or `NULL`. Optional initial values for linear predictor. Same length as `Y`. Usually `NULL`, which initializes linear predictor with 0.

## Details

Usually, Cox ridge regression does not use an intercept, as this is part of the baseline hazard. The latter is estimated using the Breslow estimator. To keep the function computationally efficient it returns the linear predictors (which suffice for predictions), instead of parameter estimates. These may be obtained by applying the `betasout` function to the output of this function.

## Value

List, containing:

 `etas` Numerical vector: Final linear predictors `Ypred` Predicted survival `convergence` Boolean: has IWLS converged? `nIt` Number of iterations `Hres` Auxiliary list object. Passed on to other functions `linearized` Linearized predictions `unpen` Boolean: are there any unpenalized covariates involved? Passed on to other functions `intercept` Boolean: Is an intercept included? `eta0` Numerical vector: Initial linear predictors `X1` Matrix: design matrix unpenalized variables

## References

Mark A. van de Wiel, Mirrelijn van Nee, Armin Rauschenberger (2021). Fast cross-validation for high-dimensional ridge regression. J Comp Graph Stat

`IWLSridge` for linear and logistic ridge. `betasout` for obtaining parameter estimates. `predictIWLS` for predictions on new samples. A full demo and data are available from:
 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13``` ```data(dataXXmirmeth) resp <- dataXXmirmeth[[1]] XXmirmeth <- dataXXmirmeth[[2]] lambdas <- c(100,1000) # Create fake survival data respsurv <- Surv(rexp(length(resp)),resp) # Prepare fitting for the specified penalties. XXT <- SigmaFromBlocks(XXmirmeth,penalties=lambdas) # Fit. fit\$etas contains the n linear predictors fit <- IWLSCoxridge(XXT,Y=respsurv) ```