Learn R Programming

LassoSIR (version 1.0)

predict_Lasso_SIR: Prediction based on Lasso SIR

Description

This function calculates the value of \(X\beta\) for a new data set.

Usage

predict_Lasso_SIR( lassosirobj, newdata )

Value

predict_value = predict_value, beta = lassosirobj$beta, no.dim = lassosirobj$no.dim

predict_value

the value of \(X\beta\).

beta

the estiamted value of the \(\beta\).

no.dim

the dimension of the central space.

Arguments

lassosirobj

LassoSIR object when running the function LassoSIR.

newdata

A data frame consisting of the values of the predictors.

Author

Zhigen Zhao, Qian Lin, Jun S. Liu

Details

Based on the estiamted \(\beta\), this function provides the value \(X\beta\) for any new input.

References

Lin, Q., Zhao, Z. , and Liu, J. (2017) On consistency and sparsity for sliced inverse regression in high dimension. Annals of Statistics.

Lin, Q., Zhao, Z. , and Liu, J. (2016) Sparse Sliced Inverse Regression for High Dimensional Data.

Examples

Run this code

p <- 10
n <- 200


H <- 20
m <- n/H

beta <- array(0, c(p, 1) )
beta[1:3,1] <- rnorm(3, 0, 1)

X <- array(0, c(n, p ) )

rho <- 0.3
Sigma <- diag(p)
elements <- rho^(c((p-1):0,1:(p-1) ) )
for(i in 1:p)
    Sigma[i,] <- elements[(p+1-i):(2*p-i) ]


X <- matrix( rnorm(p*n), c(n, p) )
X <- X%*% chol(Sigma)

Y <-  ( X%*% beta )^3/2 + rnorm(n,0,1)
sir.lasso <- LassoSIR( X, Y, H, choosing.d="automatic",
          solution.path=FALSE, categorical=FALSE, nfolds=10,
          screening=FALSE)

res = predict_Lasso_SIR( sir.lasso, newdata=data.frame( matrix( rnorm(5*p), c(5, p) )  ) )

Run the code above in your browser using DataLab