Hi!
I used the data “birthwt” in MASS package to constructed a model with stan_lm function in rstanarm package. I can get coefficients and Bayesian uncertainty intervals using coef() and posterior_interval() functions. In the models constructed with lm(), we can get P values from the summary() function. However, I can’t find any function to get P values for the variables in the model with stan_lm.
That is intentional. With a Bayesian analysis, you cannot get the probability of seeing a more extreme estimate in a different dataset from the same population conditional on the parameter taking a given value. But that is not of interest anyway. What probability are you interested in computing?
Hi bgoodri !
I want to investigate the association between the variable “bwt” and “smoke”," age" and " race". When I used lm() to constructed linear regression model, I can get the P Value, Odds Ratio and 95% confidential interval for “smoke”," age" and " race". So I can estimate their associations with “bwt” .
The code is :
post ← lm( -bwt ~ smoke + age + race + ptl + ht + ftv,birthwt)
summary(post)
Call:
lm(formula = -bwt ~ smoke + age + race + ptl + ht + ftv, data = birthwt)
Residuals:
Min 1Q Median 3Q Max
-1.55499 -0.51185 0.00166 0.47458 2.36292
I think the closest thing would be posterior_interval(post), but that is not a p-value or confidence interval. In fact, it is more useful since it is an interval that contains the the true parameter (under the model) with the probability that you specify. But it is not wise to construct a 95% or 99% credible interval because the endpoints are not estimated with very much precision with the default number of iterations.