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
?On 6/1/18, 4:20 AM, "R-help on behalf of Bill Poling"
<r-help-bounces at r-project.org on behalf of Bill.Poling at zelis.com>
wrote:
Good morning, I hope someone can help with these questions, or perhaps
suggest one of the other R-lists?
I have two questions:
1. Why am I getting this warning?
2. Why is the second example "Point Forecast" the same value, I
do not see that in previous attempts with similar but different data sets as in
example 1?
Example1:
dat3 <- structure(c(3539122.86, 3081383.87, 4158672.31, 4137518.78,
4123682.08, 4819375.2, 4342687.77, 5028674.58, 4472145.07, 4967277.73,
4516240.31, 4876194.63, 4816446.59,
4887399.37, 5478504.85, 4871385.27, 5487543.68,
5464193.69, 5252591.03, 7071416.89, 5524350.89, 6107166.69, 6530003.55,
6445929.08, 7356743.81, 6750025.03,
6934714.08, 6656194.35
,-13913, -29385.31, -39633.37, -23487.13, -18202.86,
-57335.49, -26061.45, -60880.07, -17589.45, -35970.08, -89133.94,
-84694.58, -31724.89, -29847.95, -65421.74, -34334.22,
-48511.98, -30298.97, -38729.46, -29292.89, -46098.4, -65909.49,
-85879.23, -71845.28, -69017.07, -93161.03, -70847.29,
-85106.04
,-357694.19, -444792.75, -361349.57, -386717.55,
-547422.05, -518259.22, -417613.76, -578631.46, -804516.81, -572875.52,
-510487.53,
-666294.87, -673233.37, -556564.45, -963346.75,
-639288.2, -910104.23, -773428.8, -1008078.84, -546685.3, -729932.94,
-987098.23,
-964001.63, -986995.93, -680066.58, -728854.58,
-730766.92, -753861.59)
,.Dim = c(28L, 3L)
,.Dimnames = list(NULL,
c("OONNetRev","OONAdjusted" ,"OONCancelled"))
,.Tsp = c(2016, 2018.25, 12), class = c("mts",
"ts", "matrix"))
head(dat3); nrow(dat3)
TNR_moving_average <- forecast(ma(dat3[1:28], order=3), h=8)
TNR_moving_average
# Warning message:
# In ets(object, lambda = lambda, biasadj = biasadj,
allow.multiplicative.trend = allow.multiplicative.trend, :
# Missing values encountered. Using longest contiguous portion of
time series
# > Point Forecast Lo 80 Hi 80 Lo 95
Hi 95
# 28 7007065.99688 6675015.72012 7339116.27365 6499238.92148
7514893.07229
# 29 7135745.42473 6721543.41996 7549947.42950 6502278.12345
7769212.72601
# 30 7264424.85258 6779532.18065 7749317.52450 6522845.50541
8006004.19974
# 31 7393104.28042 6844496.10189 7941712.45896 6554080.47486
8232128.08599
# 32 7521783.70827 6914203.11991 8129364.29663 6592569.38486
8450998.03168
# 33 7650463.13612 6987355.72657 8313570.54567 6636327.86794
8664598.40429
# 34 7779142.56396 7063123.29787 8495161.83005 6684085.59434
8874199.53358
# 35 7907821.99181 7140937.69145 8674706.29217 6734973.66528
9080670.31834
Example2:
dat3 <- structure(c(994320.58, 811664.54, 1045259.43, 951659.48,
669458.94, 986741.09, 1023344.82, 938971.65, 897670.06, 1040074.6, 1090310.01,
1289821.17, 1187806.23, 971485.76, 1161147.42,
870585.04, 1021301.52, 1215798.03, 1015004.43, 1365863.09, 995769.41,
1331725.36, 1271032.91, 1092103.82, 1297131.4,
1129195.28, 1372594.58, 1553717.57,
-39811.51, -47356.74, -49046.86, -41311.13, -79063.98,
-43916.59, -16746.33, -38347.9, -84797.44, -38961.44,
-72036.83, -62854.78, -35259.84, -44198.39, -34262.65,
-49245.82, -34977.28, -36797.35, -47534.43, -33515.13,
-25764.41, -29130.53, -57693.63, -51026.83, -49624.49,
-36508.13, -32667.21, -37900.5,
-247443.87, -372942.34, -344080.78, -355586.21,
-458998.84, -378086.44, -333994.18, -567024.45, -521499.8, -428915.13,
-512034.28, -440865.42, -347494.22, -422436.19,
-444588.65, -462891.57, -518395.47, -373818.5, -398899.53, -381573.69,
-531449.2, -476238.48, -434296.86, -655679.94,
-528999.52, -423725.95, -556977.31, -518633.95)
,.Dim = c(28L, 3L)
,.Dimnames = list(NULL,
c("EditNetRev","EditNetAdjusted"
,"EditNetCancelled"))
,.Tsp = c(2016, 2018.25, 12), class = c("mts",
"ts", "matrix"))
head(dat3); nrow(dat3)
TNR_moving_average <- forecast(ma(dat3[1:28], order=3), h=8)
TNR_moving_average
# Warning message:
# In ets(object, lambda = lambda, biasadj = biasadj,
allow.multiplicative.trend = allow.multiplicative.trend, :
# Missing values encountered. Using longest contiguous portion of
time series
# > TNR_moving_average
# Point Forecast Lo 80 Hi 80 Lo 95
Hi 95
# 28 1351827.24389 1246570.02118 1457084.46661 1190850.213255
1512804.27453
# 29 1351827.24389 1202841.21791 1500813.26987 1123972.779844
1579681.70794
# 30 1351827.24389 1169192.03201 1534462.45578 1072510.790913
1631143.69687
# 31 1351827.24389 1140745.29674 1562909.19105 1029005.263624
1674649.22416
# 32 1351827.24389 1115613.58783 1588040.89996 990569.631639
1713084.85615
# 33 1351827.24389 1092829.78856 1610824.69923 955724.817592
1747929.67020
# 34 1351827.24389 1071819.89899 1631834.58880 923592.964312
1780061.52348
# 35 1351827.24389 1052210.25675 1651444.23104 893602.604521
1810051.88327
Thank you for any advice or direction.
WHP
Confidentiality Notice This message is sent from Zelis. ...{{dropped:15}}
______________________________________________
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.
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 ______________________________________________ R-help at r-project.org<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. [[alternative HTML version deleted]]
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.