Learn R Programming

msgps (version 1.3.5)

predict.msgps: make predictions from a "msgps" object.

Description

This functions predicts fitted values via msgps function.

Usage

# S3 method for msgps
predict(object, X, tuning,...)
# S3 method for msgps
coef(object, tuning,...)

Value

The object returned depends on type.

Arguments

object

Fitted "msgps" model object.

X

Matrix of vector of new input x.

tuning

Tuning parameter vector t where predictions are required. If tuning is missing, solutions selected by Cp, bias-corrected AIC (AICC), generalized cross validation (GCV) and BIC are displayed.

...

Other parameters

Author

Kei Hirose
mail@keihirose.com

Examples

Run this code
#data
X <- matrix(rnorm(100*8),100,8)
beta0 <- c(3,1.5,0,0,2,0,0,0)
epsilon <- rnorm(100,sd=3)
y <- X %*% beta0 + epsilon
y <- c(y)

#fit
fit <- msgps(X,y)
coef(fit) #extract coefficients at t selected by model selection criteria
coef(fit,c(0, 0.5, 2.5)) #extract coefficients at some values of t
predict(fit,X[1:10,]) #predict values at t selected by model selection criteria
predict(fit,X[1:10,],c(0, 0.5, 2.5)) #predict values at some values of t

Run the code above in your browser using DataLab