I’m brand new to stan and working on fitting my first model. I’m attempting to use partial pooling and fit individual slopes and intercepts for a variety of groups. The model seems to be converging fine and the output makes sense. I’m getting a few informational messages as soon as i start sampling the model which I’m not sure how to handle, or if I should worry about them.
I’m also getting lp__ with an rhat of 1.33, which is a little surprising since it’s only an rhat that is not near 1 for this one parameter, so not sure if i need to worry about this either.
messages:
Informational Message: The current Metropolis proposal is about to be rejected because of the following issue:
Exception: student_t_lpdf: Scale parameter is inf, but must be finite! (in 'unknown file name' at line 55)
If this warning occurs sporadically, such as for highly constrained variable types like covariance matrices, then the sampler is fine,
but if this warning occurs often then your model may be either severely ill-conditioned or misspecified.
This is my model
data {
int<lower=1> N; //number of data points
int<lower=1> ID; //number of unique groups
int id[N];
real x[N];
real z[N];
real y[N];
}
parameters {
real beta[ID];
real beta_2[ID];
real beta_2_sq[ID];
real beta_3[ID];
real<lower=0> eps;
real<lower=0> nuMinusOne ;
real beta_mu;
real beta_2_mu ;
real beta_2_sq_mu ;
real<lower=0, upper=1> beta_3_mu ;
real<lower=0> beta_sigma;
real<lower=0> beta_2_sigma ;
real<lower=0> beta_2_sq_sigma ;
real<lower=0> beta_3_sigma ;
}
transformed parameters {
real<lower=0> nu;
nu = nuMinusOne+1;
}
model {
beta_mu ~ normal(0, 10);
beta_2_mu ~ normal( 0 , 10 ) ;
beta_2_sq_mu ~ normal(-.5, 10 ) ;
beta_3_mu ~ normal(.5 , 1) ;
beta_sigma ~ uniform(1.0E-2, 1.0E+2);
beta_2_sigma ~ uniform( 1.0E-2 , 1.0E+2) ;
beta_2_sq_sigma ~ uniform( 1.0E-2 , 1.0E+2) ;
beta_3_sigma ~ uniform( 1.0E-2 , 2) ;
eps ~ uniform( 1.0E-2 , 1.0E+3 ) ;
nuMinusOne ~ exponential(1/29.0) ;
beta ~ normal(beta_mu, beta_sigma);
beta_2 ~ normal( beta_2_mu , beta_2_sigma ) ; // vectorized
beta_2_sq ~ normal( beta_2_sq_mu , beta_2_sq_sigma ) ; // vectorized
beta_3 ~ normal( beta_3_mu , beta_3_sigma ) ; // vectorized
for (i in 1:N){
y[i] ~ student_t(nu,
beta[id[i]] + beta_2[id[i]] * x[i] + beta_2_sq[id[i]] * x[i]*x[i] + z[i]*beta_3[id[i]],
eps);
}
}