 1.  This is an imaginary data on monthly outcomes of 2 years and I want to forecast the outcome for next 12 months of next year.


data Data1;
input Yr Jan Feb Mar Apr May June July Aug Sept Oct Nov Dec;
datalines;
2008 12 13 12 14 13 12 11 15 10 12 12 12
2009 12 13 12 14 13 12 11 15 10 12 12 12
;
run;

I converted the above data into the below format to use it in R as it was giving error: asking to use only univariate time series.

data Data1;
input RR;
datalines;
12
14
17
15
13
15
15
14
15
14
16
15
15
18
16
16
15
14
15
16
16
14
13
12
;
run;


 1.  I successfully took this data thru xport into R using the below codes:

libname xportout xport 'H:\Care Transition Evaluation\CT-Codes\SAS\gross up\Data\Forc1.xpt';

data xportout.Forc1;
   set Data1;
run;



setwd("H:/Care Transition Evaluation/CT-Codes/SAS/gross up/Data")
getwd()
Forc<-read.xport("Forc1.xpt")
attach(Forc)
names(Forc)
Forc


 1.  Used the auto.arima codes:
fit <- auto.arima(Forc)
fcast <-forecast(fit)
plot(fcast)
summary(fcast)

But the following error comes on using the first line of code:
fit <- auto.arima(Forc)
-----------------------------------------------------------------------
Error in model.frame.default(formula = x ~ 1, drop.unused.levels = TRUE) :
  invalid type (list) for variable 'x'
-----------------------------------------------------------------------


 1.  Further:
I tried to use the Holt Winters Algorithm using the below codes:

Final <- HoltWinters(Forc,gamma=FALSE)
plot(forecast(Final))
Final

pred <- predict(Final, n.ahead = 8)
plot(Final, predicted.values = pred)

pred

These codes work completely fine but it adjusts for the trend and does not takes into account the seasonal component which is more important in the analysis.



Please help.

Thanks,
Ruchi







The information contained in this communication is highl...{{dropped:18}}

