when we use fit<-stan(),after use summary(fit) we can see the se_mean。Now I have some questions about the se_mean and se of statistic.What is the difference between the standard error in statistical significance and the se_mean here? How do I calculate the standard error after using the Stan function to estimate the model parameters
I also want to know what se_mean
is . I found a page for details . Note that I cannot understand it :’-D.
I guess that the se_mean
is the standard deviation of the posterior means. However, according to the page, it seems to me that the calculation is done using efficient samples in some sense.
In the following, I made a code to extract posterior means for three chains and calculates the standard deviation of posterior means but it did not coincides with the se_mean
.
stanmodelcode <- "
data {
int<lower=0> N;
real y[N];
}
parameters {
real mu;
}
model {
target += normal_lpdf(mu | 0, 10);
target += normal_lpdf(y | mu, 1);
}
"
y <- rnorm(20)
dat <- list(N = 20, y = y);
fit <- stan(model_code = stanmodelcode, model_name = "example",
data = dat, iter = 2012, chains = 3, verbose = F,
sample_file = file.path(tempdir(), 'norm.csv'))
print(fit,digits_summary = 5)
mu <- extract(fit)$mu
mean(mu)
sd(mu)
a <- get_posterior_mean(fit)
x <- c(a[1,1],a[1,2],a[1,3])
sd(x)
sqrt(var(x)/length(x))
sqrt(var(c(a[1,1],a[1,2],a[1,3],a[1,4]))/4)
I always thought it’s standard error of the mean (SEM). If yes, you can google about it – it’s just another type of statistics for reporting