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

1
2
  ## S3 method for class '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.

Author(s)

Jouni Kerman jouni@kerman.com

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
 
  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")

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.