# Dynamic panel model for count data

Hi,

I’m quite new to Stan. I used to use JAGS all the time though. I have a question about how to do dynamic models on count data in a panel setting. I’m trying to run fixed effect dynamic models on panel event count data and see the instantaneous and long-run effects of the covariates after taking into the AR coefficient. However, I don’t know how to write the model in Stan, as it’s different from a linear case when you have a lagged dependent variable as counts due to non-linear feedback. See below for discussion in the frequentist realm. http://fmwww.bc.edu/repec/msug2010/mex10sug_trivedi.pdf

I’ve seen a post in the forum about dynamic panel models (Dynamic panel data models with Stan?), but it doesn’t discuss the situation when the dependent variable is of other types of distribution, such as Poisson, binomial etc. In the linear case, after estimating the model, we can get AR(1) coefficient for calculating the long-run effect of any betas of interest. But in a poisson case, the AR coefficient can no longer be used in that way. Does anyone have experience with this kind of models? I would be super grateful if someone can help me with doing dynamic panel model for count data in Stan.

Many thanks in advance!

1 Like

I could never understand all the fuss about nonlinear feedback etc, I would just treat it as a state space model with linear dynamics and nonlinear measurement. Happy to offer this as a suggestion, but equally happy to hear why this perspective is flawed!

Hi Charles. Thanks for replying. A state space model sounds like a way out. I’ve only used it in Stata before with dependent variable of gaussian distribution for a single time series. I don’t know how to do it in Stan in a panel setting with event count as dependent variable. If you know how to do it, could you please offer some example codes so that I can learn how to do it in Stan?

Another question would be: with nonlinear measurement how can we get the long-term effect? Let’s say a simple linear ADL is Y_it= alpha Y_it-1+ beta1 X_t + beta2X_t-1 + epsilon. We can get the long run effect which is (beta1+beta2)/(1-alpha). With the nonlinear measurement of count data, I don’t think we can get a substantively meaningful long run impact or a IRF with the AR coefficent. How can we deal with this in a state space model?

Thanks again for offering help!