Learn R Programming

regRSM (version 0.2)

predict.regRSM: Predictions from a 'regRSM' object.

Description

This function makes predictions from a 'regRSM' object.

Usage

## S3 method for class 'regRSM':
predict(object, xnew,...)

Arguments

object
Fitted 'regRSM' model object
xnew
Matrix of new values for x at which predictions are to be made.
...
Additional arguments not used.

Value

  • predict.regRSM produces a vector of predictions.

Details

Prediction is made based on a final model which is chosen using validation set or Generalized Information Criterion (GIC).

Examples

Run this code
p = 100
n = 100
beta1 = numeric(p)
beta1[c(1,5,10)] = c(1,1,1)  
x = matrix(0,ncol=p,nrow=n)
xtest = matrix(0,ncol=p,nrow=n)
for(j in 1:p){ 
    x[,j] = rnorm(n,0,1)
    xtest[,j] = rnorm(n,0,1)    
}
y = x %*% beta1 + rnorm(n)
p1 = regRSM(y,x)
predict(p1,xtest)

Run the code above in your browser using DataLab