Hello! I received the following error message when using the holt() in the R package forecast. I am running R version 4.0.2. Most other students were able to fix this issue by reinstalling R and R studio with a reliable version or using the other computer. I tried running the code using R version 4.0.5 without success, and I do not have another computer.
input = read.table("6-2.txt",header=TRUE)
attach(input)
CalSales = ts(CalSales, frequency = 12)
library(forecast)
Cal_model = holt(CalSales, h=4)
summary(Cal_model[["model"]])
Error in ets(x, "AAN", alpha = alpha, beta = beta, phi = phi, damped = damped, :
No model able to be fitted
Calls: <Anonymous> ... withVisible -> eval -> eval -> holt -> forecast -> ets
Execution halted
Any help would be greatly appreciated. Thank you in advance!
Table 6.2 gives the monthly calculator demand data for the past two years:
'CalSales'
197
211
203
247
239
269
308
262
258
256
261
288
296
276
305
308
356
393
363
386
443
308
358
384
It should make no difference if you are using an older version of R.
The following code works:
library(forecast)
CalSales <- ts(c(197,211,203,247,239,269,308,262,258,256,261,288,296,276,
305,308,356,393,363,386,443,308,358,384),
frequency=12)
Cal_model <- holt(CalSales, h=4)
summary(Cal_model[["model"]])
#> Holt's method
#>
#> Call:
#> holt(y = CalSales, h = 4)
#>
#> Smoothing parameters:
#> alpha = 1e-04
#> beta = 1e-04
#>
#> Initial states:
#> l = 199.7736
#> b = 7.9699
#>
#> sigma: 33.2374
#>
#> AIC AICc BIC
#> 250.0740 253.4073 255.9643
#>
#> Training set error measures:
#> ME RMSE MAE MPE MAPE MASE
#> Training set -0.4254659 30.34144 23.29228 -1.067513 7.490028 0.2374744
#> ACF1
#> Training set 0.1562895
Created on 2022-05-02 by the reprex package (v2.0.1)
My guess is that the problem is to do with how you've read in your data. If it has come in as character instead of numerical, this error may appear.
system
Closed
May 23, 2022, 4:25am
3
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed. If you have a query related to it or one of the replies, start a new topic and refer back with a link.