[R] Extracting the MAPE value from a fitted Time Series Model

Jeff Newmiller jdnewm|| @end|ng |rom dcn@d@v|@@c@@u@
Mon Jul 2 22:40:27 CEST 2018


Google offers [1], which probably seems like a vague response but your question omitted a reproducible example and is contaminated by posting in HTML (read the Posting Guide).

[1] https://www.rdocumentation.org/packages/MLmetrics/versions/1.1.1/topics/MAPE

On July 2, 2018 1:22:39 PM PDT, Paul Bernal <paulbernal07 using gmail.com> wrote:
>Dear friends,
>
>I want to extract the MAPE value from a fitted time series model. This
>is
>what I have:
>
>> str(TransitSpline)
>List of 12
> $ method               : chr "Cubic Smoothing Spline"
> $ level                : num [1:2] 80 95
>$ x                    : Time-Series [1:385] from 1 to 385: 77 75 85 74
>73
>96 82 90 91 81 ...
> $ series               : chr "data$Transits"
>$ mean                 : Time-Series [1:10, 1] from 386 to 395: 186 178
>170 163 155 ...
>  ..- attr(*, "dimnames")=List of 2
>  .. ..$ : NULL
>  .. ..$ : chr "Series 1"
>$ upper                : Time-Series [1:10, 1:2] from 386 to 395: 202
>199
>197 197 197 ...
>  ..- attr(*, "dimnames")=List of 2
>  .. ..$ : NULL
>  .. ..$ : chr [1:2] "Series 1" "Series 2"
>$ lower                : Time-Series [1:10, 1:2] from 386 to 395: 171
>158
>144 129 113 ...
>  ..- attr(*, "dimnames")=List of 2
>  .. ..$ : NULL
>  .. ..$ : chr [1:2] "Series 1" "Series 2"
> $ model                :List of 2
>  ..$ beta: num 6.15
>  ..$ call: language splinef(y = data$Transits)
>$ fitted               : Time-Series [1:385] from 1 to 385: 76.1 77.3
>78.5
>80.1 82.2 ...
>$ residuals            : Time-Series [1:385] from 1 to 385: NA -1.3
>9.49
>-8.64 -4.34 ...
> $ standardizedresiduals: Time-Series [1:385] from 1 to 385: NA -0.875
>6.517 -5.586 -2.736 ...
>$ onestepf             : Time-Series [1:385] from 1 to 385: NA 76.3
>75.5
>82.6 77.3 ...
> - attr(*, "class")= chr [1:2] "splineforecast" "forecast"
>
>
>> str(summary(TransitSpline))
>#Here I want to get the value for the MAPE measure
>Forecast method: Cubic Smoothing Spline
>
>Model Information:
>$`beta`
>[1] 6.149167
>
>$call
>splinef(y = data$Transits)
>
>
>Error measures:
>                      ME     RMSE      MAE        MPE     MAPE     MASE
>   ACF1
>Training set -0.07776434 12.10204 9.003675 -0.2408687 5.377131 0.930913
>-0.2766975
>
>Forecasts:
>    Point Forecast     Lo 80    Hi 80      Lo 95    Hi 95
>386       186.0153 170.52426 201.5064 162.323777 209.7069
>387       178.2220 157.87687 198.5671 147.106804 209.3372
>388       170.4287 143.80863 197.0487 129.716832 211.1405
>389       162.6353 128.61257 196.6581 110.602006 214.6687
>390       154.8420 112.52646 197.1576  90.125956 219.5581
>391       147.0487  95.66491 198.4324  68.463984 225.6334
>392       139.2553  78.10706 200.4036  45.737114 232.7736
>393       131.4620  59.92462 202.9994  22.055013 240.8690
>394       123.6687  41.14798 206.1894  -2.535833 249.8732
>395       115.8753  21.82457 209.9261 -27.962900 259.7136
>'data.frame':   10 obs. of  5 variables:
> $ Point Forecast: num  186 178 170 163 155 ...
> $ Lo 80         : num  171 158 144 129 113 ...
> $ Hi 80         : num  202 199 197 197 197 ...
> $ Lo 95         : num  162.3 147.1 129.7 110.6 90.1 ...
> $ Hi 95         : num  210 209 211 215 220 ...
>
>any idea on how to accomplish this?
>
>Best regards,
>
>Paul
>
>	[[alternative HTML version deleted]]
>
>______________________________________________
>R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
>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.

-- 
Sent from my phone. Please excuse my brevity.




More information about the R-help mailing list