Description Usage Arguments Examples
View source: R/predict.ic.glmnet.R
Predicted values based on ic.glmnet object.
1 2  | 
object | 
 A ic.glmnet 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.  | 
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20  | ## == 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 the data into in-sample and out-of-sample
y.in=y[1:100]; y.out=y[-c(1:100)]
x.in=x[1:100,]; x.out=x[-c(1:100),]
## == LASSO == ##
lasso=ic.glmnet(x.in,y.in,crit = "bic")
pred=predict(lasso,newdata=x.out)
plot(y.out, type="l")
lines(pred, col=2)
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.