Learn R Programming

rv (version 0.949)

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 class 'rv':
lines(x, y, type="l", \dots)

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, Jouni and Gelman, Andrew. Manipulating and Summarizing Posterior Simulations Using Random Variable Objects. Technical report, Columbia University, New York.

Examples

Run this code
x <- 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(as.rv(x), E(y), type="b", main="Means, connected by a constant line",
     rvcol="blue", col="gray")
  plot(y, x, type="l", main="Only random lines", col="gray")

Run the code above in your browser using DataLab