predictIWLS: Predictions from ridge fits

View source: R/MultiLambdaCVfun.R

predictIWLSR Documentation

Predictions from ridge fits

Description

Produces predictions from ridge fits for new data.

Usage

predictIWLS(IWLSfit, X1new = NULL, Sigmanew)

Arguments

IWLSfit

List, containing fits from either IWLSridge (linear, logistic ridge) or IWLSCoxridge

X1new

Matrix. Dimension nnew x p_0, representing unpenalized covariates for new data.

Sigmanew

Matrix. Dimensions nnew x n. Sample cross-product from penalized variables, usually computed by first applying createXXblocks and then SigmaFromBlocks.

Details

Predictions rely purely on the linear predictors, and do not require producing the parameter vector.

Value

Numerical vector of linear predictor for the test samples.

See Also

IWLSridge (IWLSCoxridge) for fitting linear and logistic ridge (Cox ridge). betasout for obtaining parameter estimates. Scoring to evaluate the predictions. A full demo and data are available from:
https://drive.google.com/open?id=1NUfeOtN8-KZ8A2HZzveG506nBwgW64e4

Examples

#Example below shows how to create the input argument Sigmanew (for simulated data)
#Simulate
Xbl1 <- matrix(rnorm(1000),nrow=10)
Xbl2 <- matrix(rnorm(2000),nrow=10)
Xbl1new <- matrix(rnorm(200),nrow=2)
Xbl2new <- matrix(rnorm(400),nrow=2)

#check whether dimensions are correct
nrow(Xbl1)==nrow(Xbl1new)
nrow(Xbl2)==nrow(Xbl2new)
ncol(Xbl1)==nrow(Xbl2)
ncol(Xbl1new)==ncol(Xbl2new)

#create cross-product
XXbl <- createXXblocks(list(Xbl1,Xbl2),list(Xbl1new,Xbl2new))

#suppose penalties for two data types equal 5,10, respectively
Sigmanew <- SigmaFromBlocks(XXbl,c(5,10))

#check dimensions (should be nnew x n)
dim(Sigmanew)

multiridge documentation built on June 13, 2022, 5:07 p.m.