1
votes

R, Bayestats and Jags newbie here. I'm working on modeling some count data, right censored. Poisson seems to be my best guess. I wanna do a hierarchical model, as it leaves me with more possibilities to fine tune the parameterss. Can I simply write something like this:

A[i,j] <- dpois(a[i,j])

a[i,j]) <- b[i,]*x[i,j] +c[i] for all j,

where x[i,j] are my variables, or should I separate the censored time interval from the previous ones or something?

b[,] and c have a prior.

Thank you!

1
It seems to me that x is a matrix of covariates and A are your observations. I think you should not have a j index in your observations. Can you explain in more details the structure of your variables ? - Sébastien Rochette
A is a matrix, rows are the different places and The columns are the different time intervals in which I count the rainy days. X is also a matrix, or more precisely I have a set of Xk matrices. For every place and time interval I have covariates such as mean temperature (stored in X1), count of windy days (in X2), mean humidity (in X3). Does this make sense? Thanks for your help! P.S. soz, I'm on my phone and have never used latex before, so I've stuck with no fancy indexes for now - John F.

1 Answers

0
votes

This is not clear to me what is supposed to be hierarchical.
You can have the time effect separated from the covariate effect, in which case the covariate effect is not related to the station.
Moreover, the linear part of your GLM should be positive because poisson distribution requires positive values. Look here: http://www.petrkeil.com/?p=1709
A proposition for you could be:

b1 ~ prior
b2 ~ prior
c ~ prior
for (t in 1:n_time) {
  b_time[t] ~ prior
  for (i in 1:n_stations) {
    A[i,t] <- dpois(a[i,t])
    log(a[i,t]) <- b1*b_time[t]*X1[i,t] + b2*b_time[t]*X2[i,t]+ c[i]
}}