Yep, thank you Huzefa, that’s got it.

WHP


From: Huzefa Khalil [mailto:huzefa.kha...@umich.edu]
Sent: Tuesday, May 15, 2018 2:42 PM
To: Bill Poling <bill.pol...@zelis.com>
Cc: r-help (r-help@r-project.org) <r-help@r-project.org>
Subject: Re: [R] Forecasting tutorial "Basic Forecasting"

Instead of

Tsp = c(2016, 2018, 12)

try

Tsp = c(2016, 2018.25, 12)

Hence, you can specify the object as

structure(c(5973156.76, 5159011.2, 6695766.64, 6365359, 6495218.53,
7226302.39, 6835272.7, 7383501.57, 6962748.19, 7623278.72, 7274994.33,
7919421.8, 7360740.81, 7436693.35, 8545765.55, 7337269.76, 8180585.44,
8376635.05, 7758261.24, 10374641.22, 8000314.11, 9114958.9, 9805149.15,
9336939.45, 10273849.1, 9159308.71, 10184703.33, 10251153.52,
-52340.21, -90911.29, -90135.33, -147196.03, -112831.26, -99443.31,
-72584.09, -161869.48, -117805.41, -81102.39, -175379.25, -190596.12,
-110838.08, -127953.99, -129414.01, -131570.11, -28814.27, -63066.4,
-134587.17, -27610.96, -169293.37, -144034.7, -193376.36, -135743.08,
-151767.63, -156816.35, -113074.01, -160705.61, -700973.75, -891171.15,
-805670.71, -821222.02, -1078184.45, -980080.81, -786506.89,
-1244278.5, -1392779.81, -1186436.41, -1108016.28, -1201663.88,
-1163848.16, -1028830.6, -1507572.01, -1210422.01, -1529691.9,
-1207461.55, -1615971.18, -978028.1, -1354515.28, -1624270.48,
-1596204.33, -1836731.26, -1310376.81, -1337718.49, -1492220.98,
-1421801.16), .Dim = c(28L, 3L), .Dimnames = list(NULL, c("TotalNetRev",
"TotalRevAdjusted", "TotalRevCancelled")), .Tsp = c(2016, 2018.25,
12), class = c("mts", "ts", "matrix"))

You were correct that the error was because of 28 time-points. This is
the fix for it.

Huzefa

On Tue, May 15, 2018 at 2:08 PM, Bill Poling 
<bill.pol...@zelis.com<mailto:bill.pol...@zelis.com>> wrote:
> Hi. I am trying to follow this forecasting tutorial at: 
> https://www.r-bloggers.com/basic-forecasting/<https://www.r-bloggers.com/basic-forecasting/>
>
> Using my own data, I cannot get past the first step, lots of laughs.
>
> dat3 <- structure(c(5973156.76, 5159011.20, 6695766.64, 6365359.00, 
> 6495218.53, 7226302.39, 6835272.70, 7383501.57, 6962748.19, 7623278.72, 
> 7274994.33
> ,7919421.80, 7360740.81, 7436693.35, 8545765.55, 7337269.76, 8180585.44, 
> 8376635.05, 7758261.24, 10374641.22, 8000314.11, 9114958.90
> ,9805149.15, 9336939.45, 10273849.10, 9159308.71, 10184703.33, 10251153.52
> ,-52340.21, -90911.29, -90135.33, -147196.03, -112831.26, -99443.31, 
> -72584.09, -161869.48, -117805.41, -81102.39, -175379.25, -190596.12
> ,-110838.08, -127953.99, -129414.01, -131570.11, -28814.27, -63066.40, 
> -134587.17, -27610.96, -169293.37, -144034.70, -193376.36, -135743.08
> ,-151767.63, -156816.35, -113074.01, -160705.61
> ,-700973.75, -891171.15, -805670.71, -821222.02, -1078184.45, -980080.81, 
> -786506.89, -1244278.50, -1392779.81, -1186436.41, -1108016.28
> ,-1201663.88, -1163848.16, -1028830.60, -1507572.01, -1210422.01, 
> -1529691.90, -1207461.55, -1615971.18, -978028.10, -1354515.28, -1624270.48
> , -1596204.33, -1836731.26, -1310376.81, -1337718.49, -1492220.98, 
> -1421801.16)
> ,.Dim = c(28L, 3L)
> ,.Dimnames = list(NULL, c("TotalNetRev","TotalRevAdjusted" 
> ,"TotalRevCancelled"))
> ,.Tsp = c(2016, 2018, 12)
> , class = c("mts", "ts", "matrix"))
>
> Error in attributes(.Data) <- c(attributes(.Data), attrib) :
> invalid time series parameters specified
>
> I think the error may be due to 28 months of data, complete 2016 & 2017 but 
> only 4 months in 2018 and my Tsp is a value of 12? If so how would I adjust?
>
> I have googled a few references for the error, but the solution is not clear 
> to me.
> https://stackoverflow.com/questions/32369737/error-invalid-time-series-parameters-specified-in-backtesting-r-script<https://stackoverflow.com/questions/32369737/error-invalid-time-series-parameters-specified-in-backtesting-r-script>
> http://r.789695.n4.nabble.com/How-to-setup-the-tsp-attribute-of-a-dataset-td908269.html<http://r.789695.n4.nabble.com/How-to-setup-the-tsp-attribute-of-a-dataset-td908269.html>
>
> Thanks for any advice.
>
> WHP
>
>
> Confidentiality Notice This message is sent from Zelis. ...{{dropped:15}}
>
> ______________________________________________
> R-help@r-project.org<mailto:R-help@r-project.org> mailing list -- To 
> UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help<https://stat.ethz.ch/mailman/listinfo/r-help>
> PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html<http://www.R-project.org/posting-guide.html>
> and provide commented, minimal, self-contained, reproducible code.

Confidentiality Notice This message is sent from Zelis. This transmission may 
contain information which is privileged and confidential and is intended for 
the personal and confidential use of the named recipient only. Such information 
may be protected by applicable State and Federal laws from this disclosure or 
unauthorized use. If the reader of this message is not the intended recipient, 
or the employee or agent responsible for delivering the message to the intended 
recipient, you are hereby notified that any disclosure, review, discussion, 
copying, or taking any action in reliance on the contents of this transmission 
is strictly prohibited. If you have received this transmission in error, please 
contact the sender immediately. Zelis, 2018.

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to