- Operating System: Windows
- rstanarm Version: 2.19.2

I have a relatively simple problem - an assumed mean and variance for a normally distributed variable, followed by a few data observations (just outcomes, no predictors). I’d like to use the data to update my estimates of the mean and standard deviation of that mean using rstanarm.

library(rstanarm)

d <- data.frame(x = c(425, 425, 450, 425, 350, 450, 300, 425, 425, 300, 425, 425, 300, 425, 375, 425, 375, 425, 425, 275, 330, 425, 375, 425, 425))

prior_mu <- 350

prior_sd <- 60m <- stan_glm(x ~ 1,

data = d,

prior_intercept = normal(prior_mu, prior_sd))

m

This yields a MAD intercept of 393 and MAD sigma of 53.

If I’ve understood correctly, my posterior mean and standard deviation would be 393 and 53 respectively.

- Have I correctly implemented the bayesian updating, and interpreted the outputs?
- How can I extract the MAD of sigma - coef() returns only the intercept and I don’t see a sigma value stored anywhere in object m?
- Can the same process be used if I only have a single new data point? When I try I get a an error:

Error: Constant variable(s) found: x

Thanks for your help.