Hi All,
I’m trying to run a gamma regression with time and time^2 as predictors. when only time but not time^2 are included, sampling is great. But once time^2 is included, it all falls apart. Any ideas?
data{
int Time2[126];
vector[126] LPS_concentration;
int Time[126];
int LPS[126];
int Subject[126];
}
parameters{
real<lower=0> a;
vector[18] a_Subject;
vector[2] b_Time;
real<lower=0> scale;
}
model{
vector[126] mu;
scale ~ exponential( 1 );
b_Time ~ normal( 0 , 0.1 );
a_Subject ~ normal( 0 , 0.25 );
a ~ gamma( 0.5/0.25 , 1/0.25 );
for ( i in 1:126 ) {
mu[i] = a + a_Subject[Subject[i]] + b_Time[LPS[i]] * Time[i] + b_Time2[LPS[i]]*Time2;
mu[i] = exp(mu[i]);
}
LPS_concentration ~ gamma( mu/scale , 1/scale );
}