rv (version 2.3.4)

lines.rv: Add Connected (Random) Line Segments to a Plot

Description

Adds a sample of line segments randomly drawn from the joint distribution of (x,y).

Usage

# S3 method for rv
lines(x, y, type = "l", ...)

Arguments

x, y

coordinate vectors of points to join

type

character indicating the type of plotting, currently 'l' and 'p' are the only possibilities

further arguments passed to points

Details

The size of the sample (number of segments drawn) is determined by rvpar(line.sample).

lines.rv is implemented as part of points.rv.

See points.rv for details of the parameters.

References

Kerman, J. and Gelman, A. (2007). Manipulating and Summarizing Posterior Simulations Using Random Variable Objects. Statistics and Computing 17:3, 235-244.

See also vignette("rv").

Examples

Run this code
# NOT RUN {
 
  x <- as.rv(1:10)
  y <- rvnorm(mean=x)
  par(mfrow=c(2,2))
  plot(x, y, type="b", main="Intervals and random lines", rvcol="blue", col="gray")
  plot(x, y, type="l", main="Only random lines", col="gray")
  plot(x, E(y), type="b", main="Means, connected by a constant line", col="gray")
  plot(x, rvmedian(y), type="b", pch=19, main="Median & middle 95 pc CI band", col="darkgray")
  lines(rvquantile(y, 0.025), col="gray")
  lines(rvquantile(y, 1-0.025), col="gray")
  
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab