I have a time series, e.g. the daily number of visitors on my blog. I have a set of events of some class, like the days when I made a new posting. I want to measure the effect of a new posting on the visitors. However, the effect of a new posting is not limited to the same day the posting was made. It could be days later.

So to generalize it: There is a (either discrete time or continous time) series of data points. There is a set of events given by their time instants. All events are believed to have a similar effect on the series, beginning from the event time and lasting for some time t_L.

Is there a statictical method to approach this problem? Am I missing some assumptions?


This probably belongs on CrossValidated. It seems like a reasonable question but not quite as easy as you might like to answer (without shortcuts).

A statistician's model of this would probably start with a Poisson-distributed response (reasonable for count data). It is most straightforward to assume that posting has an effect on the log-density of the Poisson response for each days. So let's say we count the number of postings on the same day, one day before, two days before, $i$ days before, as $k_i$. Then we could say something like

$$ \begin{split} y_i & \sim \textrm{Poisson}(\eta) \\ \eta & = \exp\left(\beta_0 + \beta_1 \sum_{i=0}^{t_L} k_i \beta_2^i\right) \end{split} $$

That is, the effect of postings on the log-density declines geometrically with time since posting (set $\beta_2=1$ if you want the effects to remain constant over time until $t_L$ at which time they disappear, but this seems less realistic ...)

You could then estimate the parameters by maximum likelihood estimation (write computer code to compute the probability $L$ of the observed outcomes for a given set of parameters $\{\beta_j\}$, then find $\textrm{argmax}_{\{\beta_j\}} L$.

Some of the biggest things left out here:

  • possibility of overdispersion, i.e. there is more variability in the daily counts than expected from the Poisson distribution, even after accounting for the posting pattern. Using a negative binomial rather than a Poisson response is fairly straightforward.
  • temporal autocorrelation. This is a big one; we are implicitly assuming that the $y_i$ are conditionally independent. To allow for autocorrelation we would either have to add a (probably Gaussian) latent variable, or figure out what the marginal variance-covariance matrix would look like in the presence of autocorrelation ...

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.