RAOS example from 15.2, reciprocal_dispersion from negative binomial fits

In Regression and Other Stories, chapter 15 section 2, as well as on this page:

https://avehtari.github.io/ROS-Examples/PoissonExample/poisson_regression.html

There’s an example where three different phi values are used (0.1, 1, 10) to generate fake data to fit with

fit_nb[[k]] <- stan_glm(y ~ x, family=neg_binomial_2(link="log"), data=fake, refresh=0)

After fitting the three fake datasets, the three different reciprocal_dispersion values are basically the same at: 10.7, 10.8, and 10.8. I’m a bit surprised, because I thought the phi values would be recovered by the fits, but obviously not. Is there something in the fitting that is supposed to be able to recover the phi values? I’d like to follow the process of recovering the known inputs to the data generating process, but I don’t know how to do that with the available code. Thanks.

1 Like

Ah, figures I’d figure it out just after I post. The problem appears to be a typo in the book and the Examples web page.

fit_nb[[k]] <- stan_glm(y ~ x, family=neg_binomial_2(link="log"), data=fake, refresh=0)
data=fake

should be

data=fake_nb[[k]]

2 Likes

Thanks for reporting! Tagging @avehtari as he might like to know about a potential typo in the book.

1 Like

Thanks for tagging Aki. I posted it as an issue on github as well, so I’m sure someone will see it and address it.

2 Likes

Thanks! I’ll fix it soonish.