[R] Time Series forecasting models for irregular time series for zoo objects

2017-04-20 Thread Sonam Tripathi
Hi I am new with R.Currently I am using time series forecasting to do daily 
forecasting for predicting request per day.The dataset which i am using has 
unevenly spaced date a snapshot of dataset is given below I have to find 
the best model which can help me in predicting the future request which can 
make forecast for next 15 days.I have used zoo package for dealing with 
irregular time series data but now I am unable to implement "ets" and "ar" 
and "arima" model with this as it expects the series to be regular and 
evenly spaced and it gives me warning " Missing values encountered. Using 
longest contiguous portion of time series"  but still I proceed for 
forecast then it is showing me date in the format like "1.711600e+04" and 
point of forecast is same for nearly all the dates. 

date req_per_day 
13-07-2016 1 
15-07-2016 1 
11-08-2016 1 
01-09-2016 1 
13-09-2016 1 
14-09-2016 1 
22-09-2016 2 
23-09-2016 1 
26-09-2016 2 
27-09-2016 4 
29-09-2016 2 

My question is how to implement ets and other model on zoo objects which 
show me correct date format.Based on other suggestions i have also tried 
converting zoo to ts but it is again showing "NA" for the dates which are 
not present in the dataset and give same result which I specified above.

How to do time series forecasting with uneven or irregular dates using zoo 
objects in R.
__
R-help@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.


[R] Time series forecasting

2009-04-05 Thread pgary
Dear all:

I'm a newbie and an amateur seeking help with forecasting the next in a 
non-stationary time series, with constraints of 1 (low) and 27 (high) 
applicable to all. 

What I need help with is the solution concept. The series has 439 observations 
as of last week. I'd like to analyze obs 1 - 30 (which are historical and 
therefore invariate), to solve for 31.

The history:
Obs 12
21
31
416
59
66
77
811
911
 101
1112
1214
1313
142
154
165
1714
186
194
207
215
228
237
2415
2511
263
274
286
298
304 
31?? (a known)

For backtesting of forecasting accuracy, I can use either a sliding window ( 1 
- 30 to solve for 31, 2 - 31 to solve for 32, 3 - 32 to solve for 33, etc.) OR 
a cumulative window (1 - 30 to solve for 31, 1 - 31 to solve for 32, 1 - 32 to 
solve for 33, etc.), whichever works better. I can also supply different 
windows if deemed  appropriate, e.g., 50 or 75 or 100 obs, whatever, in either 
configuration.

The 30 obs window is selected for this list query only so as not to take up too 
much message space.

Query: How would you solve for ob 31 in the above series, with the constraints 
stated? (If you need a longer history, say, 50 obs or more, I can supply it 
off-list.) I've tried all the relevant Excel functions with no success, and 
suspect that the solution lies in some combination of them. Here I defer to the 
collective wisdom of you all. 

Once the correct concept is established, I can proceed to set it up in R for 
this and other similar series.

Many TIA and regards,
Perry E. Gary
Tokyo
[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] Time series forecasting

2009-04-05 Thread Stephan Kolassa

Hi Perry,

my impression after a very cursory glance: this looks like noise. 
Perhaps you should think a little more about your series - what kind of 
seasonality there could be (is this weekly data? or monthly?), whether 
the peaks and troughs could be due to some kind of external driver, 
whether you really have count data, that kind of thing.


Until then, there is little else to do than to use a very simple method, 
e.g. forecast the last observation (random walk) or the mean of the 
observations (white noise), or the median. All of these benchmarks can 
be surprisingly hard to beat.


If you have seasonality but no external influence, you could look at 
smoothing methods, they are nice to interpret and usually perform very 
well. I'd recommend Hyndman et al., Forecasting with Exponential 
Smoothing: The State Space Approach and the accompanying forecast R 
package, mainly with the ets() function.


You could also look at arima(). I fitted an ARIMA model to your data, 
and as expected, it returned a simple mean (not that I would recommend 
blindly fitting ARIMA to just any data):


Call:
arima(x = foo[, 2])

Coefficients:
  intercept
 7.2333
s.e. 0.8009

sigma^2 estimated as 19.25:  log likelihood = -86.93,  aic = 177.85

And for count data, you could use some variants of ARIMA, e.g., INAR.

HTH,
Stephan


pg...@gol.com schrieb:

Dear all:

I'm a newbie and an amateur seeking help with forecasting the next in a non-stationary time series, with constraints of 1 (low) and 27 (high) applicable to all. 


What I need help with is the solution concept. The series has 439 observations 
as of last week. I'd like to analyze obs 1 - 30 (which are historical and 
therefore invariate), to solve for 31.

The history:
Obs 12
21
31
416
59
66
77
811
911
 101
1112
1214
1313
142
154
165
1714
186
194
207
215
228
237
2415
2511
263
274
286
298
304 
31?? (a known)


For backtesting of forecasting accuracy, I can use either a sliding window ( 1 
- 30 to solve for 31, 2 - 31 to solve for 32, 3 - 32 to solve for 33, etc.) OR 
a cumulative window (1 - 30 to solve for 31, 1 - 31 to solve for 32, 1 - 32 to 
solve for 33, etc.), whichever works better. I can also supply different 
windows if deemed  appropriate, e.g., 50 or 75 or 100 obs, whatever, in either 
configuration.

The 30 obs window is selected for this list query only so as not to take up too 
much message space.

Query: How would you solve for ob 31 in the above series, with the constraints stated? (If you need a longer history, say, 50 obs or more, I can supply it off-list.) I've tried all the relevant Excel functions with no success, and suspect that the solution lies in some combination of them. Here I defer to the collective wisdom of you all. 


Once the correct concept is established, I can proceed to set it up in R for 
this and other similar series.

Many TIA and regards,
Perry E. Gary
Tokyo
[[alternative HTML version deleted]]

__
R-help@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.



__
R-help@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.