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

View source: R/predict.msgps.R

predict.msgpsR Documentation

make predictions from a "msgps" object.

Description

This functions predicts fitted values via msgps function.

Usage

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

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

Value

The object returned depends on type.

Author(s)

Kei Hirose
mail@keihirose.com

Examples

#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

msgps documentation built on Oct. 21, 2022, 1:06 a.m.

Related to predict.msgps in msgps...