[R] how to compute highest density interval?

Greg Snow Greg.Snow at intermountainmail.org
Mon Nov 26 22:31:01 CET 2007


The hpd function in the TeachingDemos package does this computation (for
unimodal densities).

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at intermountainmail.org
(801) 408-8111
 
 

> -----Original Message-----
> From: r-help-bounces at r-project.org 
> [mailto:r-help-bounces at r-project.org] On Behalf Of gallon li
> Sent: Saturday, November 24, 2007 5:44 AM
> To: r-help
> Subject: [R] how to compute highest density interval?
> 
> Suppose i want to compute a 95% highest density for a beta 
> distribution
> beta(a,b)
> 
> the two end points x1 and x2 shoudl satisfy the following two 
> equations:
> 
> pbeta(x1,a,b)-pbeta(x2,a,b)=95%
> 
> dbeta(x1,a,b)=dbeta(x2,a,b)
> 
> Is there any fast way to compute x1 and x2 in R?
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 



More information about the R-help mailing list