You are right that there are no NAs in the practice data. But there are NAs in the moving average data. To see this, break your work into two separate steps, like this: tnr.ma <- ma(dat3[1:28], order=3) TNR_moving_average <- forecast(tnr.ma, h=8) I think you will find that the warning comes from the second step. Print tnr.ma and you will see some NAs. -Don -- Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave., L-627 Livermore, CA 94550 925-423-1062 Lab cell 925-724-7509 ? From: Bill Poling <Bill.Poling at zelis.com> Date: Friday, June 1, 2018 at 8:58 AM To: "MacQueen, Don" <macqueen1 at llnl.gov>, array R-help <r-help at r-project.org> Subject: RE: [R] Time-series moving average question Hello Don, thank you for your response. I appreciate your help. ? I am using the forecast package, originally I found it following a forecasting example on bloggers.com ? https://www.r-bloggers.com/time-series-analysis-using-r-forecast-package/ ? And subsequently located the complete pdf https://cran.r-project.org/web/packages/forecast/forecast.pdf ? Since I created this practice data using the structure() function I am unsure why there would be NA?s as there are none apparently in the structure? ? No worries though, I am going to reach out to the package author. ? Cheers. ? WHP ? From: MacQueen, Don [mailto:macqueen1 at llnl.gov] Sent: Friday, June 01, 2018 11:24 AM To: Bill Poling <Bill.Poling at zelis.com>; r-help (r-help at r-project.org) <r-help at r-project.org> Subject: Re: [R] Time-series moving average question ? My guess would be that if you inspect the output from ma(dat3[1:28], order=3) you will find some NAs in it. And then forecast() doesn't like NAs. But I can't check, because I can't find the ma() and forecast() functions. I assume they come from some package you installed; it would be helpful to say which package. -Don -- Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave., L-627 Livermore, CA 94550 925-423-1062 Lab cell 925-724-7509 ______________________________________________ mailto:R-help at 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. 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.
Hi Don, wow, you are so right. I picked that piece up from the bloggers tutorial and since I am R naive yet, I thought it was all one step moving_average = forecast(ma(tdat[1:31], order=2), h=5) Truly, I usually print and check at every step I can, as painful as it is sometimes. Great lesson for this novice usR. So the first and last values are NA in each case? Do you know why? Should I replace the NA with a value, say the average of the others? Also, I have 5 series of data I am working with using this script and of course each gave me that warning, but only the one series had the same 8 Point Forecast values, is that coincidental you think? Terrific of you to help, I really appreciate it. WHP From: MacQueen, Don [mailto:macqueen1 at llnl.gov] Sent: Friday, June 01, 2018 12:54 PM To: Bill Poling <Bill.Poling at zelis.com>; r-help (r-help at r-project.org) <r-help at r-project.org> Subject: Re: [R] Time-series moving average question You are right that there are no NAs in the practice data. But there are NAs in the moving average data. To see this, break your work into two separate steps, like this: tnr.ma<http://tnr.ma> <- ma(dat3[1:28], order=3) TNR_moving_average <- forecast(tnr.ma<http://tnr.ma>, h=8) I think you will find that the warning comes from the second step. Print tnr.ma<http://tnr.ma> and you will see some NAs. -Don -- Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave., L-627 Livermore, CA 94550 925-423-1062 Lab cell 925-724-7509 From: Bill Poling <Bill.Poling at zelis.com<mailto:Bill.Poling at zelis.com>> Date: Friday, June 1, 2018 at 8:58 AM To: "MacQueen, Don" <macqueen1 at llnl.gov<mailto:macqueen1 at llnl.gov>>, array R-help <r-help at r-project.org<mailto:r-help at r-project.org>> Subject: RE: [R] Time-series moving average question Hello Don, thank you for your response. I appreciate your help. I am using the forecast package, originally I found it following a forecasting example on bloggers.com<http://bloggers.com> https://www.r-bloggers.com/time-series-analysis-using-r-forecast-package/<https://www.r-bloggers.com/time-series-analysis-using-r-forecast-package/> And subsequently located the complete pdf https://cran.r-project.org/web/packages/forecast/forecast.pdf<https://cran.r-project.org/web/packages/forecast/forecast.pdf> Since I created this practice data using the structure() function I am unsure why there would be NA?s as there are none apparently in the structure? No worries though, I am going to reach out to the package author. Cheers. WHP From: MacQueen, Don [mailto:macqueen1 at llnl.gov] Sent: Friday, June 01, 2018 11:24 AM To: Bill Poling <Bill.Poling at zelis.com<mailto:Bill.Poling at zelis.com>>; r-help (r-help at r-project.org<mailto:r-help at r-project.org>) <r-help at r-project.org<mailto:r-help at r-project.org>> Subject: Re: [R] Time-series moving average question My guess would be that if you inspect the output from ma(dat3[1:28], order=3) you will find some NAs in it. And then forecast() doesn't like NAs. But I can't check, because I can't find the ma() and forecast() functions. I assume they come from some package you installed; it would be helpful to say which package. -Don -- Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave., L-627 Livermore, CA 94550 925-423-1062 Lab cell 925-724-7509 ______________________________________________ mailto:R-help at 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. 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]]
For your first question, you?re doing moving averages of 3 points (I assume that?s what order=3 does). For any given time point of your input data, that would be one before, one at, and one after the given time point. Do all of your input times have both one before and one after? Don?t know about your same 8 point forecast values question, not without running it myself, but I would say that if the data really is different, yet the forecasts are the same, it would have to be coincidental. But a priori this seems unlikely, so I?d inspect your script very carefully for mistakes. -Don -- Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave., L-627 Livermore, CA 94550 925-423-1062 Lab cell 925-724-7509 From: Bill Poling <Bill.Poling at zelis.com> Date: Friday, June 1, 2018 at 10:43 AM To: "MacQueen, Don" <macqueen1 at llnl.gov>, array R-help <r-help at r-project.org> Subject: RE: [R] Time-series moving average question Hi Don, wow, you are so right. I picked that piece up from the bloggers tutorial and since I am R naive yet, I thought it was all one step moving_average = forecast(ma(tdat[1:31], order=2), h=5) Truly, I usually print and check at every step I can, as painful as it is sometimes. Great lesson for this novice usR. So the first and last values are NA in each case? Do you know why? Should I replace the NA with a value, say the average of the others? Also, I have 5 series of data I am working with using this script and of course each gave me that warning, but only the one series had the same 8 Point Forecast values, is that coincidental you think? Terrific of you to help, I really appreciate it. WHP From: MacQueen, Don [mailto:macqueen1 at llnl.gov] Sent: Friday, June 01, 2018 12:54 PM To: Bill Poling <Bill.Poling at zelis.com>; r-help (r-help at r-project.org) <r-help at r-project.org> Subject: Re: [R] Time-series moving average question You are right that there are no NAs in the practice data. But there are NAs in the moving average data. To see this, break your work into two separate steps, like this: tnr.ma<http://tnr.ma> <- ma(dat3[1:28], order=3) TNR_moving_average <- forecast(tnr.ma<http://tnr.ma>, h=8) I think you will find that the warning comes from the second step. Print tnr.ma<http://tnr.ma> and you will see some NAs. -Don -- Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave., L-627 Livermore, CA 94550 925-423-1062 Lab cell 925-724-7509 From: Bill Poling <Bill.Poling at zelis.com<mailto:Bill.Poling at zelis.com>> Date: Friday, June 1, 2018 at 8:58 AM To: "MacQueen, Don" <macqueen1 at llnl.gov<mailto:macqueen1 at llnl.gov>>, array R-help <r-help at r-project.org<mailto:r-help at r-project.org>> Subject: RE: [R] Time-series moving average question Hello Don, thank you for your response. I appreciate your help. I am using the forecast package, originally I found it following a forecasting example on bloggers.com<http://bloggers.com> https://www.r-bloggers.com/time-series-analysis-using-r-forecast-package/ And subsequently located the complete pdf https://cran.r-project.org/web/packages/forecast/forecast.pdf Since I created this practice data using the structure() function I am unsure why there would be NA?s as there are none apparently in the structure? No worries though, I am going to reach out to the package author. Cheers. WHP From: MacQueen, Don [mailto:macqueen1 at llnl.gov] Sent: Friday, June 01, 2018 11:24 AM To: Bill Poling <Bill.Poling at zelis.com<mailto:Bill.Poling at zelis.com>>; r-help (r-help at r-project.org<mailto:r-help at r-project.org>) <r-help at r-project.org<mailto:r-help at r-project.org>> Subject: Re: [R] Time-series moving average question My guess would be that if you inspect the output from ma(dat3[1:28], order=3) you will find some NAs in it. And then forecast() doesn't like NAs. But I can't check, because I can't find the ma() and forecast() functions. I assume they come from some package you installed; it would be helpful to say which package. -Don -- Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave., L-627 Livermore, CA 94550 925-423-1062 Lab cell 925-724-7509 ______________________________________________ mailto:R-help at 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. 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. 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]]