9
$\begingroup$

I am not that familiar with the analysis of time series data. However, I have what I think is a simple prediction task to address.

I have about five years of data from a common generating process. Each year represents a monotonically increasing function with a non-linear component. I have counts for each week over a 40 week cycle for each year. The process starts, the function begins at zero, increases rather quickly over the first half of the function, slowing over the second half before leveling during the last five weeks. The process is consistent across years with small differences in rate of change and volume across the segments from year to year.

$$ y_{1}=\{0, N_{t1}, N_{t2}, ... N_{t39}, N_{t40}\} $$

$$ \vdots $$

$$ y_{5}=\{0, N_{t1}, N_{t2}, ... N_{t39}, N_{t40}\} $$

Where $N_{tx}$ equal the count at time x.

The goal is to take $N$ at $tx$ (or better $t0$ to $tx$, or the slope to that point) and predict the $N$ at $t40$. For example, if $N_{t10}$ is 5000 what is the expected value of $N_{t40}$ for that year. So, the question is, how would you model such data? It's easy enough to summarize and visualize. But I'd like a model to facilitate predictions and incorporate a measure of error.

$\endgroup$
  • 2
    $\begingroup$ Are you sure you want to limit yourself so severely? If this problem has any practical application, then by the time you know the count at time x you also know all previous counts. Why not use them to help with the prediction? $\endgroup$ – whuber Oct 31 '10 at 16:21
  • $\begingroup$ Indeed. You're correct. Thanks for pointing that out. $\endgroup$ – Brett Oct 31 '10 at 16:30
6
$\begingroup$

Probably the simplest approach is, as Andy W suggested, to use a seasonal univariate time series model. If you use R, try either auto.arima() or ets() from the forecast package.

Either should work ok, but a general time series method does not use all the information provided. In particular, it seems that you know the shape of the curve in each year, so it might be better to use that information by modelling each year's data accordingly. What follows is a suggestion that tries to incorporate this information.

It sounds like some kind of sigmoidal curve will do the trick. e.g., a shifted logistic: \begin{equation} f_{t,j} = \frac{r_te^{a_t(j-b_t)}}{1+e^{a_t(j-b_t)}} \end{equation} for year $t$ and week $j$ where $a_t$, $b_t$ and $r_t$ are parameters to be estimated. $r_t$ is the asymptotic maximum, $a_t$ controls the rate of increase and $b_t$ is the mid-point when $f_{t,j}=r_t/2$. (Another parameter will be needed to allow the asymmetry you describe whereby the rate of increase up to time $b_t$ is faster than that after $b_t$. The simplest way to do this is to allow $a_t$ to take different values before and after time $b_t$.)

The parameters can be estimated using least squares for each year. The parameters each form time series: ${a_1,\dots,a_n}$, ${b_1,\dots,b_n}$ and ${r_1,\dots,r_n}$. These can be forecast using standard time series methods, although with $n=5$ you probably can't do much apart from using the mean of each series for producing forecasts. Then, for year 6, an estimate of the value at week $j$ is simply $\hat{f}(6,j)$ where the forecasts of $a_6$, $b_6$ and $r_6$ are used.

Once data start to be observed for year 6 you will want to update this estimate. As each new observation is obtained, estimate the sigmoidal curve to the data from year 6 (you will need at least three observations to start with as there are three parameters). Then take a weighted average of the forecasts obtained using the data up to year 5 and the forecast obtained using only the data from year 6, where the weights are equal to $(40-t)/36$ and $(t-4)/36$ respectively. That is very ad hoc, and I'm sure it can be made more objective by placing it in the context of a larger stochastic model. Nevertheless, it will probably work ok for your purposes.

$\endgroup$
4
$\begingroup$

What your asking is essentially what Box Jenkins ARIMA modeling does (your yearly cycles would be referred to as seasonal components). Besides looking up materials on your own, I would suggest

Applied Time Series Analysis for the Social Sciences 1980 by R McCleary ; R A Hay ; E E Meidinger ; D McDowall

Although I can think of reasonable reasons for why you want to forecast further into the future (and hence assess the error when doing so) it is often very difficult in practice. If you have very strong seasonal components it will be more feasible. Otherwise your estimates will likely reach an equilibrium in relatively few future time periods.

If you plan on using R to fit your models you should probably check out Rob Hyndman's website (Hopefully he will give you better advice than me!)

$\endgroup$
-2
$\begingroup$

you have 5 years of data and 40 observations per year. Why don't you post them on the web and allow us to actually answer this at ground zero rather than philosophizing at 500 miles high. I look forward to the numbers. WE have seen data like this for example the number of customers who trade in their time sharing week ON a weekly basis. The series each year starts at zero and accumulates to a limiting value.

$\endgroup$
  • 1
    $\begingroup$ -1 This sounds more like a self advertisement than a helpful reply. $\endgroup$ – whuber Mar 29 '11 at 22:08
  • $\begingroup$ @whuber: Not intentional. Just a reflection on a similar "sticky problem" that I ran into . $\endgroup$ – IrishStat Mar 29 '11 at 22:50
  • $\begingroup$ That would make an interesting comment, then. Comments are good ways to inject some of this valuable experience that we are so glad you share with us. Replies should be reserved for actual responses to the question: they will be voted on, archived, made searchable, etc., and therefore need to be more directly relevant, of permanent value, and be able to withstand criticism better. (Of course this is an idealization, but it's what we strive for. :-) $\endgroup$ – whuber Mar 29 '11 at 22:55
  • $\begingroup$ @whuber: You teach ! I learn ! I will reserve comments for the "comment area". To reiterate there was absolutely no intention of promoting anything or any particular piece of software/consultancy just a well-intentioned willingness to share experiences to other people of the village. I am quite sure that the OP thought my comments helpful. What say you Brett ? $\endgroup$ – IrishStat Mar 29 '11 at 23:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.