2
$\begingroup$

I have a set of 50 (P) time series' and each one is on a slightly different but should be influenced by the same effects of time. To get the time effects I have constructed the following model random intercept GLM with a Poisson Link Function (below). Since I think observations from day to day are likley to be correlated, I put a prior on the coefficient for each day (betastar[d] on beta[d]) centered at the previous day. I haven't really seen this done before so I wanted to see if anyone sees any serious issues with this fairly simple model structure.

Here is some jags/bugs code to explain:

model {

#prior on random intercepts
for (p in 1:P){
    alpha[p] ~ dnorm(0,0.001)
}

for (d in 2:D){
    betastar[d] ~ dnorm(beta[d-1],0.001)
    beta[d] ~ dnorm(betastar[d],0.001)
    }

beta[1] ~ dnorm(0,0.001)

#likelihood
for (i in 1:PDs){
    y[i] ~ dpois(exp(alpha[lookupP[i]] + beta[lookupD[i]]))
}}
$\endgroup$
1
$\begingroup$

It is hard for me to tell exactly what you are doing without example data, but here is an example from John Kruschke. His approach may be superior because you model the strength of the autoregression in an unusual way (not saying it is wrong just not what I have seen done, which isn't that much):

 model {
        trend[1] <- beta0 + beta1 * x[1] + amp * cos( ( x[1] - thresh ) / wl )
        for( i in 2 : Ndata ) {
          y[i] ~ dt( mu[i] , tau , nu )
          mu[i] <- trend[i] + ar1 * ( y[i-1] - trend[i-1] )
          trend[i] <- beta0 + beta1 * x[i] + amp * cos( ( x[i] - thresh ) / wl )
        }
        ar1 ~ dunif(-1.1,1.1) # or dunif(-0.01,0.01)
        beta0 ~ dnorm( 0 , 1.0E-12 )
        beta1 ~ dnorm( 0 , 1.0E-12 )
        tau ~ dgamma( 0.001 , 0.001 )
        amp ~ dunif(0,50)
        thresh ~ dunif(-183,183)
        nu <- nuMinusOne + 1
        nuMinusOne ~ dexp(1/29)
    }

http://doingbayesiandataanalysis.blogspot.com/2012/10/bayesian-estimation-of-trend-with-auto.html

$\endgroup$
  • $\begingroup$ thanks. I guess my question was whether there was a clear reason why the way I am doing it is incorrect or less than ideal compared to this more traditional AR approach. $\endgroup$ – scottyaz Nov 11 '13 at 5:04
  • $\begingroup$ @scottyaz In your approach isn't it like there is a different "AR parameter" (betastar) for each data point? While for the traditional approach there is one overall parameter? This seems like a major difference. $\endgroup$ – Flask Nov 11 '13 at 5:17
  • $\begingroup$ @scottyaz Also do you realize that JAGs uses precisions (1/variance) rather than variance for the scale parameter of the normal distribution? So the distributions you are sampling from have variance =.01 $\endgroup$ – Flask Nov 11 '13 at 5:33

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.