Estimating the mean = regression on constant term
set.seed(42)
n_0 <- 20
y_0 <- rnorm(n_0, 2.0, 5.0)
cat(paste0('mean:', mean(y_0), '\nstandard error:', sd(y_0)/sqrt(n_0),"\n\n"))
## mean:2.95960009711351
## standard error:1.46756319082706
fake_0 <- data.frame(y_0)
fit_0 <- stan_glm(y_0 ~ 1, data=fake_0,
prior_intercept=NULL, prior=NULL, prior_aux=NULL, refresh =0 )
print(fit_0, detail = FALSE)
## Median MAD_SD
## (Intercept) 3.0 1.5
##
## Auxiliary parameter(s):
## Median MAD_SD
## sigma 6.8 1.1
Flat priors reproduce classical least squares estimate (more on this when we get to section 9.5)
What about default priors?
## Median MAD_SD
## (Intercept) 3.0 1.4
##
## Auxiliary parameter(s):
## Median MAD_SD
## sigma 6.7 1.1