View source: R/predict_Lasso_SIR.R
predict_Lasso_SIR | R Documentation |
This function calculates the value of X\beta
for a new data set.
predict_Lasso_SIR( lassosirobj, newdata )
lassosirobj |
LassoSIR object when running the function LassoSIR. |
newdata |
A data frame consisting of the values of the predictors. |
Based on the estiamted \beta
, this function provides the value X\beta
for any new input.
predict_value = predict_value, beta = lassosirobj$beta, no.dim = lassosirobj$no.dim
predict_value |
the value of |
beta |
the estiamted value of the |
no.dim |
the dimension of the central space. |
Zhigen Zhao, Qian Lin, Jun S. Liu
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.
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) ) ) )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.