I have a data file with a given time series of price data and I would like to split the time series into a test set and training set. I would then like to build an ARIMA model on the training set and apply this model on test set. Below is some code: [CODE] data= read.table("A.txt",sep=",") attach(data) training = data[1:120, 6] test = data[121:245, 6] ts1 = ts(training) ts2 = ts(test) arima1 = arima(ts1) arima2 = arima(ts2) [/CODE] -- View this message in context: http://r.789695.n4.nabble.com/R-time-series-analysis-tp2527513p2527513.html Sent from the R help mailing list archive at Nabble.com.
How do I get the predicted values and the errors for each arima model? -- View this message in context: http://r.789695.n4.nabble.com/R-time-series-analysis-tp2527513p2527533.html Sent from the R help mailing list archive at Nabble.com.
1. try the predict function e.g. predict(arima1, n.ahead=10) 2. try the resid function e.g. resid(arima1) HTH Pete -- View this message in context: http://r.789695.n4.nabble.com/R-time-series-analysis-tp2527513p2527625.html Sent from the R help mailing list archive at Nabble.com.
I want to also choose the post optimal parameters in the order argument. How could I easily do this? -- View this message in context: http://r.789695.n4.nabble.com/R-time-series-analysis-tp2527513p2527660.html Sent from the R help mailing list archive at Nabble.com.
How do you evaluate the predictive models? For example if I have: arima1 = arima(training, order = c(1,1,1)) arima2 = arima(training, order = c(0,0,0)) x.fore = predict(arima1, n.ahead=5) x.fore1 = predict(arima2, n.ahead = 5) How do I know which arima model is better for prediction? -- View this message in context: http://r.789695.n4.nabble.com/R-time-series-analysis-tp2527513p2527672.html Sent from the R help mailing list archive at Nabble.com.
lord12 wrote:> > I have a data file with a given time series of price data and I would like > to split the time series into a test set and training set. I would then > like to build an ARIMA model on the training set and apply this model on > test set. >I had recently the same problem and, after checking documentation and mailing list archives, I discovered that it is not possible to apply the same model on a different data set. Of course you can create the model on a part of the dataset and then check the prediction with the remaining part, as a testing set. But, if you have new data you and you want to apply the same model on them...nothing! I checked the source code of ARIMA functions but it was too complex and I hadn't enough time to learn all that stuff. However I found a little workaround: 1. I calibrate the model on the "training part" 2. I create a new model with the same parameters, using "fixed" (check arima documentation) on the new data 3. go to step 2. every time you have new data It worked for me. -- View this message in context: http://r.789695.n4.nabble.com/R-time-series-analysis-tp2527513p2528200.html Sent from the R help mailing list archive at Nabble.com.
For each arima model, can you output an associated confidence interval for the predicted value at each time point? -- View this message in context: http://r.789695.n4.nabble.com/R-time-series-analysis-tp2527513p2530595.html Sent from the R help mailing list archive at Nabble.com.
On Sep 7, 2010, at 7:51 PM, lord12 wrote:> > For each arima model, can you output an associated confidence > interval for > the predicted value at each time point??arima0 arima0 will return "... a list with components "pred", the predictions, and "se", the estimated standard errors" as time series when se.fit = TRUE.> -- > View this message in context: http://r.789695.n4.nabble.com/R-time-series-analysis-tp2527513p2530595.html-- David Winsemius, MD West Hartford, CT
On Sep 7, 2010, at 9:33 PM, David Winsemius wrote:> > On Sep 7, 2010, at 7:51 PM, lord12 wrote: > >> >> For each arima model, can you output an associated confidence >> interval for >> the predicted value at each time point? > > ?arima0 > > arima0 will return "... a list with components "pred", the > predictions, and "se", the estimated standard errors" as time series > when se.fit = TRUE.See also: predict.Arima {stats}>> -- >> View this message in context: http://r.789695.n4.nabble.com/R-time-series-analysis-tp2527513p2530595.html > -- > > David Winsemius, MD > West Hartford, CT > > ______________________________________________ > R-help at r-project.org mailing list > 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.David Winsemius, MD West Hartford, CT