[R] "NA" in predict(...., prediction.interval=TRUE)

CCordeiro cmhcordei at gmail.com
Tue Nov 11 16:26:18 CET 2008


Dear Rlist,

In my work I frequently use functions: HoltWinters() and predict().
Last week I have installed R 2.8.0 and a problem occurs:

# the data
serie<-ts(c(3128,3444,3428,3803,3044,3427,3246,3505,3052,3613,3555,3675,3267,3601,3501,3855),
frequency = 4, start = c(1987, 1),end=c(1990,4))
serie
     Qtr1 Qtr2 Qtr3 Qtr4
1987 3128 3444 3428 3803
1988 3044 3427 3246 3505
1989 3052 3613 3555 3675
1990 3267 3601 3501 3855

# the "best" fitting using SSE
HoltWinters(serie)
SSE
[1] 240906
HoltWinters(serie,seasonal="mult")
SSE
[1] 225655.1

# the adjustment
b<-HoltWinters(serie,seasonal="mult")
Holt-Winters exponential smoothing without trend and with multiplicative
seasonal component.
Call:
 HoltWinters(x = serie, seasonal = "mult") 

Smoothing parameters:
 alpha:  0.5890718 
 beta :  0 
 gamma:  0.6025223 

Coefficients:
           [,1]
a  3564.1438607
s1    0.9101603
s2    1.0233106
s3    0.9911003
s4    1.0788724

# the prediction
 predict(b,n.ahead=8,prediction.interval=T,level=0.95)
             fit      upr      lwr
1991 Q1 3243.942 3478.588 3009.297
1991 Q2 3647.226 3931.234 3363.218
1991 Q3 3532.424 3875.554 3189.294
1991 Q4 3845.256       NA       NA
1992 Q1 3243.942 3689.217 2798.668
1992 Q2 3647.226 4112.756 3181.696
1992 Q3 3532.424 4055.708 3009.141
1992 Q4 3845.256       NA       NA

###Problem: NA in prediction intervals

I have read about the changes in R 2.8.0 and unfortunately I did not have
success. 

Any help you could provide would be greatly appreciated.
Thank you!
Best regards,
Clara

> sessionInfo()
R version 2.8.0 (2008-10-20) 
i386-pc-mingw32 

locale:
LC_COLLATE=Portuguese_Portugal.1252;LC_CTYPE=Portuguese_Portugal.1252;LC_MONETARY=Portuguese_Portugal.1252;LC_NUMERIC=C;LC_TIME=Portuguese_Portugal.1252

-- 
View this message in context: http://www.nabble.com/%22NA%22-in-predict%28....%2C-prediction.interval%3DTRUE%29-tp20441823p20441823.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list