2
$\begingroup$

I have a time series that count the number of "type 1" events in a city, for each day. The serie contains a lot of zeros because type 1 events are rare (about 80% of counts are zeros). I'm using a Poisson Model but I don't know how to handle temporal dependencies. For example, I know that there are some other events (let say "type 2") which will increase the probability of an event of type 1 in the current day and/or in the next days. The Poisson parameter is not constant over time.

Do you know a good R package to handle this and a good way to model this situation ?

Thanks

$\endgroup$
2
$\begingroup$

You can still do this in a generalized linear model framework (using glm or glmnet in R). A crude way of accounting for time would simply be to include it as a covariate with a model like

$$ \log(\lambda_i) = \alpha t_i + \beta^T x_i . $$

This of course has problems because it assumes a linear relationship between $t_i$ and $\log(\lambda_i)$, and if you feel that certain days have more of an impact than others you might include indicator variables for those days and give them their own coefficients.

Another approach might be to use a generalized additive model (the gam package) instead, but the basic concept is the same.

| cite | improve this answer | |
$\endgroup$
  • $\begingroup$ I tried the Poisson Regression using the variable $t_i$ like you said, it helps a little. Then, predicting $x_t$, I added $x_{t-1}, ..., x_{t-7}$ to the model. It helped but the coefficient are not coherent since this is far from monotonous and I expect that $coeff(x_{t-1}) > ... > coeff(x_{t-7})$. Either I'm wrong with this expectation or I need a better model, I don't know. $\endgroup$ – Rodolphe LAMPE Dec 21 '15 at 16:39

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.