PredictMA: A prediction function after model averaging

Description Usage Arguments Value Examples

View source: R/PredictMA.R

Description

Predicting with new data

Usage

1
PredictMA(Data, MA, ynew = FALSE)

Arguments

Data

New data contain explanatory variables in whole model

MA

Result of function 'ModelAve()'

ynew

Whether a new y is in Data or is given as a vector. If 'ynew=TRUE', Data should contain the explanatory vector, and if 'ynew' is a vector with same size as Data, if 'ynew=FALSE', there is no new y.

Value

Prediction of data

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## Not run: 
n <- 15
p <-3
X <- matrix(rnorm(n*p), n, p)
beta <- c(1, 2, 3)
y <- X %*% beta+rnorm(n)
y<-data.frame(y)
Data <- cbind(y, data.frame(X))
subset <- matrix(c(1,0,0,0,1,0),ncol=p,byrow = TRUE)
get_MA_nest<-ModelAve(y~., Data[1:10,], method = "MMA", nested = TRUE)
PredictMA(Data[11:15,],get_MA_nest,ynew = TRUE)

## End(Not run)

matheming/StatComp21081 documentation built on Dec. 23, 2021, 11:10 p.m.