4
$\begingroup$

I have time-series count data $N_{i,j}$ (population sizes in site $i$ and year $j$) and I want to correlate year-to-year changes with the environmental conditions $x_{i,j}$. For this, I want to fit this model:

$$\begin{eqnarray} \mbox{log} ( \mu_{i,j+1} ) &=& \mbox{log} ( \mu_{i,j} ) + \alpha + \beta x_{i,j} + \gamma_j \\ \\ N_{i,j} &\sim& \mbox{Poiss} ( \mu_{i,j} ) \\ \gamma_{j} &\sim& \mbox{Norm} (0, \sigma ) \end{eqnarray} $$

So I'm interested in parameter $\beta$, the slope of the relationship. $\gamma_{j}$ is the random effect for year (as the residuals within single year were correlated).

This is an autoregressive model. How can I fit such a model? I tried to look at the PESTS project (PESTS R code here) but I am not able to find out if and how to fit my model using it.

(Note that I am trying to avoid Bayesian tools because of computation time - I have thousands of such models).

$\endgroup$
17
  • $\begingroup$ If your question is only how to do this in R, this question would be off-topic for CV (see our help center). A similar question, but w/ a reproducible example might be on-topic on SO; you could also try the r-help-listserv. If you have a question about the substantive statistical issues here, or can reform your Q in a software neutral way, please edit; if not, this Q may be closed. $\endgroup$ Commented Mar 20, 2014 at 13:14
  • $\begingroup$ This question appears to be off-topic because it is about how to use R. $\endgroup$ Commented Mar 20, 2014 at 13:16
  • 2
    $\begingroup$ @gung, OK, I've edited the question (but, what about another 5,688 R questions?). This question definitely needs a statistician, not a pure R programmer. Only statistician would know if for example PESTS models can be used to fit this. You need to understand those models very well. $\endgroup$
    – Tomas
    Commented Mar 20, 2014 at 13:26
  • $\begingroup$ Thanks, @Curious. You're right, it's a gray area. There are questions that include elements about R (or SAS, Stata, etc), but if they are only what is the code / function / library to run this, they are off-topic here. This has been a matter of much discussion on meta.CV & the consensus is evolving. There are plenty of questions tagged / tagable w/ [r] that remain on-topic here. $\endgroup$ Commented Mar 20, 2014 at 13:34
  • $\begingroup$ The BayesX software can fit glmms, based on reml methods. There is also an R interface R2BayesX. Also, you need a model for $\mu_{i, 0}$ to complete the structure. $\endgroup$ Commented Mar 26, 2014 at 20:39

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.