docs icon indicating copy to clipboard operation
docs copied to clipboard

add affine transform (offset, multiplier) to User's Guide chapter on reparameterization

Open mitzimorris opened this issue 3 years ago • 0 comments

Summary:

The Stan user's guide section on reparameterization should include an example of the use of the offset-multiplier construct. https://mc-stan.org/docs/stan-users-guide/reparameterization.html#hierarchical-models-and-the-non-centered-parameterization

Description:

The affine transform is described in the Stan Reference manual, but no examples are given in the User's Guide.

Additional Information:

Here is an example of the centered parameterization (which induces the funnel):

parameters {
  real mu; // population mean of success log-odds
  real<lower=0> sigma; // population sd of success log-odds
  vector[N] alpha; // success log-odds
}
model {
  mu ~ normal(-1, 1); // hyperprior
  sigma ~ normal(0, 1); // hyperprior
  alpha ~ normal(mu, sigma); // prior (hierarchical)
  y ~ binomial_logit(K, alpha); // likelihood
}

With the affine transform specified, the model is now using the non-centered parameterization:

parameters {
  real mu; // population mean of success log-odds
  real<lower=0> sigma; // population sd of success log-odds
  vector<offset=mu, multiplier=sigma>[N] alpha_std; // success log-odds (standardized)
}
model {
  mu ~ normal(-1, 1); // hyperprior
  sigma ~ normal(0, 1); // hyperprior
  alpha_std ~ normal(mu, sigma); // prior (hierarchical)
  y ~ binomial_logit(K, alpha_std); // likelihood
}

Compare to doing it the hard way - show the math?

parameters {
  real mu; // population mean of success log-odds
  real<lower=0> sigma; // population sd of success log-odds
  vector[N] alpha_std; // success log-odds (standardized)
}
model {
  mu ~ normal(-1, 1); // hyperprior
  sigma ~ normal(0, 1); // hyperprior
  alpha_std ~ normal(0, 1); // prior (hierarchical)
  y ~ binomial_logit(K, mu + sigma * alpha_std); // likelihood
}

Current Version:

v2.28.0

mitzimorris avatar Jan 23 '22 23:01 mitzimorris