I did write a basic GLM code in rstanarm
. When I execute the following code it is giving the mean of the predictor variables of all the iterations done:
summary(TestGLM)
print(TestGLM)
I wanted the value of the predictor variables at each and every iteration for my solution. Can anyone please help me solve this problem?
You can extract the draws for each of the coefficients as follows:
require(rstanarm)
TestGLM <- stan_glm(mpg ~ wt, data = mtcars)
draws <- as.data.frame(TestGLM)
print(colnames(draws))
str(draws)
# See http://mc-stan.org/rstanarm/reference/as.matrix.stanreg.html