stan-dev / stan-dev/docs

discuss pinning parameters in workflow in User's Guide

Open
#942 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
TeX
Stars
43
Forks
133
Avg merge
11h 32m
Merged PRs (30d)
4

Description

This is a request from "Somebody" on @andrewgelman's blog:

https://statmodeling.stat.columbia.edu/2026/05/04/expanding-the-stan-users-guide/#comment-2414300.

I'll summarize the first request here.

We should discuss the process of pinning parameters when doing development. This can make the models much faster to fit and also give us some hints at relevant hyper priors. For example, suppose we have a hierarchical model

data {
  int<lower=0> N;
}
parameters {
  vector[N] alpha;
  real<lower=0> sigma;
}
model {
  alpha ~ normal(0, sigma);
  sigma ~ ???
}

This is going to try to fit alpha and sigma and create a pure funnel posterior which has varying geometry and is not log concave.

We can replace this with a model with a fixed value, say sigma = 1.7. But this requires a new Stan model:

data {
  int<lower=0> N;
}
parameters {
  vector[N] alpha;
}
model {
  alpha ~ normal(0, 1.7);
}

If we fit this second model, we will get a posterior distribution over alpha. I have added a generated quantities block that shows how we can recover the actual scale of the parameter variation per draw, and hence get a posterior over it which can help inform our hyper prior on sigma.

generated quantities {
  real<lower=0> sigma_alpha = sd(alpha);
}

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the relevant section of the Stan User's Guide and review the linked blog request and the example hierarchical model. Add a discussion of pinning parameters during development, including the fixed-scale model and generated-quantities approach shown here. Done means the workflow and its use for informing hyperpriors are clearly explained in the guide.

Written by the indexing model from the issue text.

Assessment

Tech stack
tex
Domain
documentation
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.