IWLSridge {multiridge} | R Documentation |
Iterative weighted least squares algorithm for linear and logistic ridge regression.
Description
Iterative weighted least squares algorithm for linear and logistic ridge regression. Updates the weights and linear predictors until convergence.
Usage
IWLSridge(XXT, Y, X1 = NULL, intercept = TRUE, frac1 = NULL, eps = 1e-07,
maxItr = 25, trace = FALSE, model = NULL, E0 = NULL)
Arguments
XXT |
Matrix. Dimensions |
Y |
Response vector: numeric, binary, or two-class factor |
X1 |
Matrix. Dimension |
intercept |
Boolean. Should an intercept be included? |
frac1 |
Scalar. Prior fraction of cases. Only relevant for |
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? |
model |
Character. Any of |
E0 |
Numerical vector or |
Details
An (unpenalized) intercept is included by default. 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
See Also
IWLSCoxridge
for Cox ridge. betasout
for obtaining parameter estimates.
predictIWLS
for predictions on new samples. A full demo and data are available from:
https://drive.google.com/open?id=1NUfeOtN8-KZ8A2HZzveG506nBwgW64e4
Examples
data(dataXXmirmeth)
resp <- dataXXmirmeth[[1]]
XXmirmeth <- dataXXmirmeth[[2]]
lambdas <- c(100,1000)
# Prepare fitting for the specified penalties.
XXT <- SigmaFromBlocks(XXmirmeth,penalties=lambdas)
# Fit. fit$etas contains the n linear predictors
fit <- IWLSridge(XXT,Y=resp)