Last data update: 2014.03.03

R: Overlapping Density Plots
overlapDensityR Documentation

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)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(DAAG)
Loading required package: lattice
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/DAAG/overlapDensity.Rd_%03d_medium.png", width=480, height=480)
> ### Name: overlapDensity
> ### Title: Overlapping Density Plots
> ### Aliases: overlapDensity overlap.density
> ### Keywords: models
> 
> ### ** Examples
> 
> attach(two65)
> overlapDensity(ambient,heated)
[1] 228.7025 269.0000
> t.test(ambient,heated)

	Welch Two Sample t-test

data:  ambient and heated
t = -1.9895, df = 18.916, p-value = 0.0613
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
 -19.3108505   0.4926687
sample estimates:
mean of x mean of y 
 244.0909  253.5000 

> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>