1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
|
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/confband.R
\name{confband}
\alias{confband}
\alias{forestplot}
\alias{plot_region}
\title{Add Confidence limits bar to plot}
\usage{
confband(
x,
lower,
upper,
center = NULL,
line = TRUE,
delta = 0.07,
centermark = 0.03,
pch,
blank = TRUE,
vert = TRUE,
polygon = FALSE,
step = FALSE,
...
)
}
\arguments{
\item{x}{Position (x-coordinate if vert=TRUE, y-coordinate otherwise)}
\item{lower}{Lower limit (if NULL no limits is added, and only the
center is drawn (if not NULL))}
\item{upper}{Upper limit}
\item{center}{Center point}
\item{line}{If FALSE do not add line between upper and lower bound}
\item{delta}{Length of limit bars}
\item{centermark}{Length of center bar}
\item{pch}{Center symbol (if missing a line is drawn)}
\item{blank}{If TRUE a white ball is plotted before the center is
added to the plot}
\item{vert}{If TRUE a vertical bar is plotted. Otherwise a horizontal
bar is used}
\item{polygon}{If TRUE polygons are added between 'lower' and 'upper'.}
\item{step}{Type of polygon (step-function or piecewise linear)}
\item{...}{Additional low level arguments (e.g. col, lwd, lty,...)}
}
\description{
Add Confidence limits bar to plot
}
\examples{
plot(0,0,type="n",xlab="",ylab="")
confband(0.5,-0.5,0.5,0,col="darkblue")
confband(0.8,-0.5,0.5,0,col="darkred",vert=FALSE,pch=1,cex=1.5)
set.seed(1)
K <- 20
est <- rnorm(K)
se <- runif(K,0.2,0.4)
x <- cbind(est,est-2*se,est+2*se,runif(K,0.5,2))
x[c(3:4,10:12),] <- NA
rownames(x) <- unlist(lapply(letters[seq(K)],function(x) paste(rep(x,4),collapse="")))
rownames(x)[which(is.na(est))] <- ""
signif <- sign(x[,2])==sign(x[,3])
forestplot(x,text.right=FALSE)
forestplot(x[,-4],sep=c(2,15),col=signif+1,box1=TRUE,delta=0.2,pch=16,cex=1.5)
forestplot(x,vert=TRUE,text=FALSE)
forestplot(x,vert=TRUE,text=FALSE,pch=NA)
##forestplot(x,vert=TRUE,text.vert=FALSE)
##forestplot(val,vert=TRUE,add=TRUE)
z <- seq(10)
zu <- c(z[-1],10)
plot(z,type="n")
confband(z,zu,rep(0,length(z)),col=Col("darkblue"),polygon=TRUE,step=TRUE)
confband(z,zu,zu-2,col=Col("darkred"),polygon=TRUE,step=TRUE)
z <- seq(0,1,length.out=100)
plot(z,z,type="n")
confband(z,z,z^2,polygon="TRUE",col=Col("darkblue"))
set.seed(1)
k <- 10
x <- seq(k)
est <- rnorm(k)
sd <- runif(k)
val <- cbind(x,est,est-sd,est+sd)
par(mfrow=c(1,2))
plot(0,type="n",xlim=c(0,k+1),ylim=range(val[,-1]),axes=FALSE,xlab="",ylab="")
axis(2)
confband(val[,1],val[,3],val[,4],val[,2],pch=16,cex=2)
plot(0,type="n",ylim=c(0,k+1),xlim=range(val[,-1]),axes=FALSE,xlab="",ylab="")
axis(1)
confband(val[,1],val[,3],val[,4],val[,2],pch=16,cex=2,vert=FALSE)
x <- seq(0, 3, length.out=20)
y <- cos(x)
yl <- y - 1
yu <- y + 1
plot_region(x, y, yl, yu)
plot_region(x, y, yl, yu, type='s', col="darkblue", add=TRUE)
}
\seealso{
\code{confband}
}
\author{
Klaus K. Holst
}
\keyword{iplot}
|