Richard Asturia
2013-May-08 05:19 UTC
[R] How to calculate Hightest Posterior Density (HPD) of coeficients in a simple regression (lm) in R?
Hi! I am trying to calculate HPD for the coeficients of regression models fitted with lm or lmrob in R, pretty much in the same way that can be accomplished by the association of mcmcsamp and HPDinterval functions for multilevel models fitted with lmer. Can anyone point me in the right direction on which packages/how to implement this? Thanks for your time! R. [[alternative HTML version deleted]]
Ben Bolker
2013-May-08 13:11 UTC
[R] How to calculate Hightest Posterior Density (HPD) of coeficients in a simple regression (lm) in R?
Richard Asturia <richard.asturia <at> gmail.com> writes:> > Hi! > > I am trying to calculate HPD for the coeficients of regression models > fitted with lm or lmrob in R, pretty much in the same way that can be > accomplished by the association of mcmcsamp and HPDinterval functions for > multilevel models fitted with lmer. Can anyone point me in the right > direction on which packages/how to implement this? > > Thanks for your time! > > R. >Hmmm. At least for lm(), if the assumptions of the model are met then the sampling distribution of the parameters should be multivariate normal, so with a flat prior the posterior distributions should be symmetric and equivalent to the sampling distributions of the parameters -- so I think that the highest 95% posterior density interval should be equivalent to classical frequentist confidence intervals [see confint()]. You might be interested in the bayeslm() function from the arm package.