📄 hdr.conf.rd
字号:
\name{hdrconf}
\alias{hdrconf}
\title{HDRs with confidence intervals}
\description{Calculates Highest Density Regions with confidence intervals.
}
\usage{
hdrconf(x, den, prob = 95, conf=95)
}
\arguments{
\item{x}{Numeric vector containing data.}
\item{den}{Density of data as list with components \code{x} and \code{y}.}
\item{prob}{Probability coverage for for HDRs.}
\item{conf}{Confidence for limits on HDR.}
}
\value{\code{hdrconf} returns list containing the following components:
\item{hdr}{Highest density regions}
\item{hdr.lo}{Highest density regions corresponding to lower confidence limit.}
\item{hdr.hi}{Highest density regions corresponding to upper confidence limit.}
\item{falpha}{Values of \eqn{f_\alpha}{f[alpha]} corresponding to HDRs.}
\item{falpha.ci}{Values of \eqn{f_\alpha}{f[alpha]} corresponding to lower and upper limits.}
}
\references{Hyndman, R.J. (1996) Computing and graphing highest density regions
\emph{American Statistician}, \bold{50}, 120-126.}
\author{Rob Hyndman}
\seealso{\code{\link{hdr}}, \code{\link{plot.hdrconf}}}
\examples{
x <- c(rnorm(100,0,1),rnorm(100,4,1))
den <- density(x,bw=bw.SJ(x))
trueden <- den
trueden$y <- 0.5*(exp(-0.5*(den$x*den$x)) + exp(-0.5*(den$x-4)^2))/sqrt(2*pi)
sortx <- sort(x)
par(mfcol=c(2,2))
for(conf in c(50,95))
{
m <- hdrconf(sortx,trueden,conf=conf)
plot(m,trueden,main=paste(conf,"\% HDR from true density"))
m <- hdrconf(sortx,den,conf=conf)
plot(m,den,main=paste(conf,"\% HDR from empirical density\n(n=200)"))
}
}
\keyword{smooth}
\keyword{distribution}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -