2PL tutorial case study: missing prior on regression coefficient parameter

In the ‘2PL Tutorial’ case study, the following model is presented as reg_centered.stan:

data {
  int<lower=1> I;               // # questions
  int<lower=1> J;               // # persons
  int<lower=1> N;               // # observations
  int<lower=1, upper=I> ii[N];  // question for n
  int<lower=1, upper=J> jj[N];  // person for n
  int<lower=0, upper=1> y[N];   // correctness for n
  real x[J];                    // covariate for person j
parameters {
  vector<lower=0>[I] alpha;     // discrimination for item i
  vector[I] beta;               // difficulty for item i
  vector[J] theta;              // ability for person j
  real gamma;                   // regression coefficient of x
model {
  vector[N] eta;
  alpha ~ lognormal(0.5,1);
  beta ~ normal(0,10);
  for (j in 1:J)
    theta[j] ~ normal(gamma * x[j],1);
  for (n in 1:N)
    eta[n] <- alpha[ii[n]] * (theta[jj[n]] - beta[ii[n]]);
  y ~ bernoulli_logit(eta);

This represents the 2PL model with latent regression, for a single covariate. The regression coefficient is denoted by the parameter gamma.

After reading through the model, I am still unsure why there is no prior given for gamma.

Can anyone explain to me what is going on here?



The prior for the gamma parameter seems to be missing indeed. If you look at the code for the 2PL with latent regression in the edstan package, you can see there is a Student-t prior on the lambda_adj parameter, which is the same as gamma in the model you posted:

lambda_adj ~ student_t(3, 0, 1);

Although I can’t really answer your question why the prior is missing in the case study, I would prefer the model with the prior on the latent regression coefficients as implemented in edstan.

Thank you for the link to edstan, the generalized version looks very interesting.

Even if this were an accidental omission I would still be keen to understand what is going on.

This model compiles and produces (what look like) comparable results to those obtained using the corresponding edstan model which leads me to think that Stan is defaulting to something when calculating the model likelihood.

If no prior is specified in a Stan model, an improper uniform prior is assumed. This is also stated in the Stan User’s Guide.

1 Like

Thank you, again - I should probably read that!