[R] How to calculate Hightest Posterior Density (HPD) of coeficients in a simple regression (lm) in R?

Ben Bolker bbolker at gmail.com
Wed May 8 15:11:07 CEST 2013


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.



More information about the R-help mailing list