Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

overlapDensity

Overlapping Density Plots


Description

Densities for two distinct samples are estimated and plotted.

Usage

overlapDensity(x0, x1, ratio = c(0.05, 20), ratio.number = FALSE,
          plotvalues = c("Density", "Numbers"), gpnames = c("Control", "Treatment"),
          cutoffs = c(lower = TRUE, upper = TRUE), bw = FALSE,
          xlab = "Score", ylab = NULL,
          col = 1:2, lty = 1:2, lwd = c(1, 1))

overlap.density(x0, x1, ratio = c(0.05, 20), ratio.number = FALSE,
          plotvalues = c("Density", "Numbers"), gpnames = c("Control", "Treatment"),
          cutoffs = c(lower = TRUE, upper = TRUE), bw = FALSE,
          xlab = "Score", ylab = NULL,
          col = 1:2, lty = 1:2, lwd = c(1, 1))

Arguments

x0

control group measurements

x1

treatment group measurements

ratio

if not NULL, the range within which the relative number per unit interval (ratio.number=TRUE) or relative probability density (ratio.number=FALSE) of observations from the two groups are required to lie will be used to determine lower and upper bounds on the values of x0 and x1. [The relative numbers at any point are estimated from (density1*n1)/(density0*x0)]

ratio.number

If TRUE (default), then ratio is taken as the ratio of number of points per unit interval

plotvalues

If set to Number then the y-axis scale is chosen so that total area undere the curve is equal to the sample size; otherwise (plotvalues="Density") total area under each cueve is 1. Any other setting does not give a plot.

gpnames

Names of the two samples

cutoffs

logical vector, indicating whether density estimates should be truncated below (lower=TRUE) or above (upper=TRUE)

bw

logical, indicates whether to overwrite with a gray scale plot

xlab

Label for x-axis

ylab

Label for y-axis

col

standard color parameter

lty

standard line type preference

lwd

standard line width preference

Author(s)

J.H. Maindonald

See Also

t.test

Examples

attach(two65)
overlapDensity(ambient,heated)
t.test(ambient,heated)

DAAG

Data Analysis and Graphics Data and Functions

v1.24
GPL-3
Authors
John H. Maindonald and W. John Braun
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.