Pedro Souto
2009-Sep-09 11:11 UTC
[R] Forecast - How to create variables with summary() results parameters
Hi, I would like to create variables in R containing parameters of summary(*Forecast Results*). Using the following code: library(forecast) data <- AirPassengers xets <- ets(data, model="ZZZ", damped=NULL) xfor <- forecast(xets,h=12, level=c(80,95)) summary(xfor) the output is: Forecast method: ETS(M,A,M) Model Information: ETS(M,A,M) Call: ets(y = data, model = "ZZZ", damped = NULL) Smoothing parameters: alpha = 0.5901 beta = 0.0058 gamma = 1e-04 Initial states: l = 126.9791 b = 1.6483 s = 0.8865 0.7928 0.9226 1.0582 1.2186 1.2371 1.1069 0.9818 0.985 1.0149 0.8946 0.901 sigma: 0.0367 AIC AICc BIC 1391.174 1395.457 1438.691 In-sample error measures: ME RMSE MAE MPE MAPE MASE 1.1644124 10.9944227 8.0668541 0.2032631 2.9361762 0.3119416 Forecasts: Point Forecast Lo 80 Hi 80 Lo 95 Hi 95 Jan 1961 444.9979 424.0692 465.9267 412.9901 477.0057 Feb 1961 444.1187 419.8324 468.4049 406.9760 481.2613 Mar 1961 506.4125 475.2920 537.5330 458.8178 554.0072 Apr 1961 493.9890 460.5937 527.3844 442.9153 545.0628 How can I associate to a variable for example the "In sample error measures" parameters? Thanks, Pedro [[alternative HTML version deleted]]
Henrique Dallazuanna
2009-Sep-09 11:59 UTC
[R] Forecast - How to create variables with summary() results parameters
Try this: accuracy(xfor) The model information can be obtained by: xfor$model On Wed, Sep 9, 2009 at 8:11 AM, Pedro Souto <pmmsouto@gmail.com> wrote:> Hi, > I would like to create variables in R containing parameters of > summary(*Forecast > Results*). > Using the following code: > > library(forecast) > data <- AirPassengers > xets <- ets(data, model="ZZZ", damped=NULL) > xfor <- forecast(xets,h=12, level=c(80,95)) > summary(xfor) > > the output is: > > Forecast method: ETS(M,A,M) > > Model Information: > ETS(M,A,M) > > Call: > ets(y = data, model = "ZZZ", damped = NULL) > > Smoothing parameters: > alpha = 0.5901 > beta = 0.0058 > gamma = 1e-04 > > Initial states: > l = 126.9791 > b = 1.6483 > s = 0.8865 0.7928 0.9226 1.0582 1.2186 1.2371 > 1.1069 0.9818 0.985 1.0149 0.8946 0.901 > > sigma: 0.0367 > > AIC AICc BIC > 1391.174 1395.457 1438.691 > > In-sample error measures: > ME RMSE MAE MPE MAPE MASE > 1.1644124 10.9944227 8.0668541 0.2032631 2.9361762 0.3119416 > > Forecasts: > Point Forecast Lo 80 Hi 80 Lo 95 Hi 95 > Jan 1961 444.9979 424.0692 465.9267 412.9901 477.0057 > Feb 1961 444.1187 419.8324 468.4049 406.9760 481.2613 > Mar 1961 506.4125 475.2920 537.5330 458.8178 554.0072 > Apr 1961 493.9890 460.5937 527.3844 442.9153 545.0628 > > How can I associate to a variable for example the "In sample error > measures" > parameters? > > Thanks, > Pedro > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@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. >-- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O [[alternative HTML version deleted]]