vwstrip.normal: Varying width strip for a normal or log-normal distribution

Description Usage Arguments Author(s) See Also Examples

View source: R/denstrip.R

Description

Draws a varying width strip for a normal or log-normal distribution with the given mean and standard deviation, based on computing the density at a large set of equally-spaced quantiles.

Usage

1
2

Arguments

mean

Mean of the normal distribution.

sd

Standard deviation of the normal distribution.

log

If TRUE then the strip for a log-normal distribution, with mean and SD on the log scale mean and sd, respectively, is plotted. This may be useful for illustrating hazard ratios or odds ratios.

nx

Number of points to evaluate the density at.

...

Further arguments passed to vwstrip, for example, at to position the strip on the y-axis, or lattice=TRUE to use as a lattice panel function.
panel.vwstrip.normal(x,...) is equivalent to vwstrip.normal(x, lattice=TRUE,...).

Author(s)

Christopher Jackson <chris.jackson@mrc-bsu.cam.ac.uk>

See Also

vwstrip

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
x <- seq(-4, 4, length=10000)
dens <- dnorm(x)
plot(x, xlim=c(-5, 5), ylim=c(-1, 2), xlab="x", ylab="",
     type="n", axes=FALSE)
axis(1)
vwstrip(x, dens, at=0, width=0.4, limits=qnorm(c(0.005, 0.995)))
vwstrip.normal(0, 1, at=1, width=0.4, limits=qnorm(c(0.005, 0.995)))

### log-normal distribution
sdlog <- 0.5
x <- rlnorm(10000, 0, sdlog)
plot(x, xlim=c(0, 5), ylim=c(-1, 3), xlab="x", ylab="",
     type="n", axes=FALSE)
axis(1)
abline(v=1, lty=2, col="lightgray")
vwstrip(x, at=0, width=0.4, ticks=exp(-sdlog^2),
        limits=qlnorm(c(0.005,0.975),0,sdlog)) # tick at theoretical maximum density 
vwstrip(x, at=1, width=0.4, bw=0.1, ticks=exp(-sdlog^2),
        limits=qlnorm(c(0.005,0.975),0,sdlog))
vwstrip.normal(0, sdlog, log=TRUE, at=2.5, width=0.4, nx=1000,
               ticks=exp(-sdlog^2), limits=qlnorm(c(0.005,0.975),0,sdlog))

denstrip documentation built on May 2, 2019, 9:58 a.m.