s1d.density {adegraphics}R Documentation

1-D plot of a numeric score by density curves

Description

This function represents a score with a density curve for each level of a factor.

Usage

s1d.density(score, fac = gl(1, NROW(score)), kernel = c("normal", "box", 
  "epanech", "biweight", "triweight"), bandwidth = NULL, gridsize = 450, 
  col = NULL, fill = TRUE, facets = NULL, plot = TRUE, storeData = TRUE,
  add = FALSE, pos = -1, ...)

Arguments

score

a numeric vector (or a data frame) used to produce the plot

fac

a factor (or a matrix of factors) to split score

kernel

the smoothing kernel used, see bkde

bandwidth

the kernel bandwidth smoothing parameter

gridsize

the number of equally spaced points at which to estimate the density

col

a logical, a color or a colors vector for labels, rugs, lines and polygons according to their factor level. Colors are recycled whether there are not one color by factor level.

fill

a logical to yield the polygons density curves filled

facets

a factor splitting score so that subsets of the data are represented on different sub-graphics

plot

a logical indicating if the graphics is displayed

storeData

a logical indicating if the data are stored in the returned object. If FALSE, only the names of the data arguments are stored

add

a logical. If TRUE, the graphic is superposed to the graphics already plotted in the current device

pos

an integer indicating the position of the environment where the data are stored, relative to the environment where the function is called. Useful only if storeData is FALSE

...

additional graphical parameters (see adegpar and trellis.par.get)

Details

kernel, bandwidth and gridsize are passed as parameters to bkde function of the KernSmooth package.

Graphical parameters for rugs are available in plines of adegpar and the ones for density curves filled in ppolygons. Some appropriated graphical parameters in p1d are also available.

Value

An object of class ADEg (subclass C1.density) or ADEgS (if add is TRUE and/or if facets or data frame for score or data frame for fac are used).
The result is displayed if plot is TRUE.

Author(s)

Alice Julien-Laferriere, Aurelie Siberchicot aurelie.siberchicot@univ-lyon1.fr and Stephane Dray

See Also

C1.density ADEg.C1

Examples

score <- c(rnorm(1000, mean = -0.5, sd = 0.5), rnorm(1000, mean = 1))
fac <- rep(c("A", "B"), each = 1000)
s1d.density(score, fac, col = c(2, 4), p1d.reverse = TRUE)

[Package adegraphics version 1.0-15 Index]