Learn R Programming

mht (version 3.1.2)

predict: Predict a mht or mht.order object

Description

Predict a mht or mht.order object for new data newx

Usage

"predict"(object,newx,level,...) "predict"(object,newx,level,...)

Arguments

object
Object of class "mht.order" as obtained from mht.order or "mht" as obtained from mht.
newx
Data matrix of size n*p.
level
Level of the prediction interval. Default is 0.95.
...
not used.

Value

Array of predicted values and prediction interval. The third dimension is relative to the type I error alpha -from the initial object-. For each alpha, a matrix with column names fit, lwr, and upr (from predict.lm)

Details

The prediction is available for each level alpha of the object. The prediction values and the prediction interval are derived from the predict.lm function. If newx is missing, the fitted values of the object are returned.

See Also

mht, mht.order, predict.lm

Examples

Run this code
## Not run: 
# x=matrix(rnorm(100*20),100,20)
# beta=c(rep(2,5),rep(0,15))
# y=x%*%beta+rnorm(100)
# 
# # mht
# mod=mht(x,y,alpha=c(0.1,0.05),maxordre=15)
# 
# # predict without new data: gives the fitted values
# pred=predict(mod)
# 
# # predict with new data
# pred=predict(mod,newx=matrix(rnorm(40*20),40,20))
# pred
# ## End(Not run)

Run the code above in your browser using DataLab