predict.bagging: Predict method for bagging objects

Description Usage Arguments Examples

View source: R/predict.bagging.R

Description

Predicted values based on bagging object.

Usage

1
2
## S3 method for class 'bagging'
predict(object, newdata = NULL, ...)

Arguments

object

A bagging object estimated using the ic.glmnet function.

newdata

An optional data to look for the explanatory variables used to predict. If omitted, the fitted values are used.

...

Arguments to be passed to other methods.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
## == This example uses the Brazilian inflation data from
#Garcia, Medeiros and Vasconcelos (2017) == ##
data("BRinf")

## == Data preparation == ##
## == The model is yt = a + Xt-1'b + ut == ##
aux = embed(BRinf,2)
y=aux[,1]
x=aux[,-c(1:ncol(BRinf))]

## == break data (in-sample and out-of-sample)
yin=y[1:120]
yout=y[-c(1:120)]
xin=x[1:120,]
xout=x[-c(1:120),]

model=bagging(xin,yin,pre.testing = "group-joint")
pred=predict(model,xout)

plot(yout,type="l")
lines(pred,col=2)

tboonman/eba_lasso_bma documentation built on Nov. 5, 2019, 10:01 a.m.