1

I am having difficulties in writing the following equation into a Stan model.

$$ y_i = \mu(x_i) + \epsilon_i \\ \epsilon_i \sim N(\theta,\sigma^2) \\ \mu(x_i) = a + b x_i \\ p(a) = p(b) \propto 1 \\ \sigma^2 \sim Inv-Gamma(0.001, 0.001) $$

Everything else is pretty much simple and clear, but how I should interpret the line of $p(a) = p(b) \propto 1$? I assume this has to be in transformed parameters block, but I can't seem to find any online resources that would show good examples.

Thanks in advance.

John
  • 11
  • 1

1 Answers1

2

$$ p(a) \propto 1 $$

Says that the distribution of $a$ is proportional to constant, it’s an improper distribution (not integrates to one). In Stan this corresponds to not specifying any prior, so unbounded uniform distribution is assumed. Using such priors are generally not recommended and can lead to tricky results.

Tim
  • 108,699
  • 20
  • 212
  • 390
  • Thanks, this makes some sense to me. I'm still a bit lost how one would write this whole thing as a Stan model tho, so if you have any pointers about that I would be glad for the help. – John Dec 01 '21 at 09:17
  • @John Stan has really great [user guide](https://mc-stan.org/docs/2_28/stan-users-guide/index.html) and [documentation](https://mc-stan.org/users/documentation/), it's the best place to start. – Tim Dec 01 '21 at 09:20