Learn R Programming

multiridge (version 1.11)

multiridge-package: Fast cross-validation for multi-penalty ridge regression

Description

The package implements multi-penalty linear, logistic and cox ridge regression, including estimation of the penalty parameters by efficient (repeated) cross-validation or marginal likelihood maximization. It allows for multiple high-dimensional data types that require penalization, as well as unpenalized variables. Moreover, it allows a paired penalty for paired data types, and preferential data types can be specified.

Arguments

Details

The DESCRIPTION file: multiridge multiridge betasout: Coefficient estimates from (converged) IWLS fit createXXblocks: Creates list of (unscaled) sample covariance matrices CVscore: Cross-validated score for given penalty parameters dataXXmirmeth: Example data doubleCV: Double cross-validation for estimating performance fastCV2: Fast cross-validation per data block; no dependency IWLSCoxridge: Iterative weighted least squares algorithm for Cox ridge regression IWLSridge: Iterative weighted least squares algorithm for linear and logistic ridge regression mlikCV: Cross-validation for estimating performance of marginal likelihood estimation optLambdasWrap: Find optimal ridge penalties by cross-validation optLambdas_mgcvWrap: Find optimal ridge penalties in terms of marginal likelihood predictIWLS: Predictions from ridge fits setupParallel: Setting up parallel computing SigmaFromBlocks: Create penalized sample cross-product matrix

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

A full demo and data are available from: https://drive.google.com/open?id=1NUfeOtN8-KZ8A2HZzveG506nBwgW64e4

Examples

Run this code
# NOT RUN {
data(dataXXmirmeth)
resp <- dataXXmirmeth[[1]]
XXmirmeth <- dataXXmirmeth[[2]]

# Find initial lambdas: fast CV per data block separately.
cvperblock2 <- fastCV2(XXblocks=XXmirmeth,Y=resp,kfold=10,fixedfolds = TRUE)
lambdas <- cvperblock2$lambdas

# Create (repeated) CV-splits of the data.
leftout <- CVfolds(Y=resp,kfold=10,nrepeat=3,fixedfolds = TRUE)

# Compute cross-validated score for initial lambdas
CVscore(penalties=lambdas, XXblocks=XXmirmeth,Y=resp,folds=leftout,
score="loglik")

# Optimizes cross-validate criterion (default: log-lik)
# Increase the number of iterations for optimal results
jointlambdas <- optLambdasWrap(penaltiesinit=lambdas, XXblocks=XXmirmeth,Y=resp,
folds=leftout,score="loglik",save=T, maxItropt1=5, maxItropt2=5)


# Alternatively: optimize by using marginal likelihood criterion
# }
# NOT RUN {
jointlambdas2 <- optLambdas_mgcvWrap(penaltiesinit=lambdas, XXblocks=XXmirmeth,
Y=resp)
# }
# NOT RUN {
# Optimal lambdas
optlambdas <- jointlambdas$optpen

# Prepare fitting for the optimal lambdas.
XXT <- SigmaFromBlocks(XXmirmeth,penalties=optlambdas)

# Fit. fit$etas contains the n linear predictors
fit <- IWLSridge(XXT,Y=resp)
# }

Run the code above in your browser using DataLab