An embedded and charset-unspecified text was scrubbed... Name: no disponible URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20100525/a6dad64e/attachment.pl>
Predict VAR
3 messages · Luis Felipe Parra, David Winsemius
On May 25, 2010, at 4:14 PM, Luis Felipe Parra wrote:
Hello, I am using the predict function for VAR in r obtaining the following object for the predictions with the following command
Hard to tell what that means since you have not specified what package was used or the class of the object on which predict was applied.
PronFac <- predict(VARFactores,n.ahead=1)
PronFactores$fcst
The problem is that you have here shown a different object than what you created with predict.
$PC1
fcst lower upper CI
PC1.fcst 2.284497 -0.8033048 5.3723 3.087802
$PC2
fcst lower upper CI
PC2.fcst -0.938333 -4.346927 2.470261 3.408594
$PC3
fcst lower upper CI
PC3.fcst -1.035569 -4.282719 2.211582 3.247151
$PC4
fcst lower upper CI
PC4.fcst -0.7063035 -4.027811 2.615204 3.321507
$PC5
fcst lower upper CI
PC5.fcst 0.3664593 -1.689041 2.421959 2.055500
I would like to take the fcst object from each of the list elements
and
assign it to a vector, do you know how can I do this in an efficient
way
without having to go trough all the list with a for?
Loops are just as efficient as the apply methods.
At the moment I am
doing it the following way for(i in
1:NumFac){PronFactores[i,]<-PronFac$fcst[[i]][1] } but I would like
to know
if there is a commmand to acces to vectors of forecasts without the
confidence intervals. Does anybody know how to do this?
Hard to tell for sure since you're only showing us output and not a reproducible version. The str function is more informative than printing to the console.
Thank you Felipe Parra
David Winsemius, MD West Hartford, CT
On May 25, 2010, at 4:49 PM, David Winsemius wrote:
On May 25, 2010, at 4:14 PM, Luis Felipe Parra wrote:
Hello, I am using the predict function for VAR in r obtaining the following object for the predictions with the following command
Hard to tell what that means since you have not specified what package was used or the class of the object on which predict was applied.
PronFac <- predict(VARFactores,n.ahead=1)
PronFactores$fcst
The problem is that you have here shown a different object than what you created with predict.
$PC1
fcst lower upper CI
PC1.fcst 2.284497 -0.8033048 5.3723 3.087802
$PC2
fcst lower upper CI
PC2.fcst -0.938333 -4.346927 2.470261 3.408594
$PC3
fcst lower upper CI
PC3.fcst -1.035569 -4.282719 2.211582 3.247151
$PC4
fcst lower upper CI
PC4.fcst -0.7063035 -4.027811 2.615204 3.321507
$PC5
fcst lower upper CI
PC5.fcst 0.3664593 -1.689041 2.421959 2.055500
I would like to take the fcst object from each of the list elements
and
assign it to a vector, do you know how can I do this in an
efficient way
without having to go trough all the list with a for?
Loops are just as efficient as the apply methods.
At the moment I am
doing it the following way for(i in
1:NumFac){PronFactores[i,]<-$fcst[[i]][1] } but I would like to know
if there is a commmand to acces to vectors of forecasts without the
confidence intervals. Does anybody know how to do this?
Hard to tell for sure since you're only showing us output and not a reproducible version. The str function is more informative than printing to the console.
After looking at objects created in the help page for the predict function in the vars package, I suspect you want: sapply(PronFac$fcst, "[", 1) #not more efficient but more expressive perhaps.
Thank you Felipe Parra
David Winsemius, MD West Hartford, CT
______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
David Winsemius, MD West Hartford, CT