Comparison of univariate density estimates

Usage

sm.density.compare(x, group, h=NA, display="lines", model="none", 
   test=T, band=T, ngrid=50, nboot=100, monitor=T, xlab, ylab, 
   xlim, lty, ...)

Arguments

x a vector of data.
group a vector of group labels.
h the smoothing parameter to be used in the construction of each density estimate. Notice that the same smoothing parameter is used for each group. If this value is omitted, the mean of the normal optimal values for the different groups is used.
display the default value "lines" will create a plot of the density estimates. The alternative value "none" will suppress the plot.
model the default value is "none" which restricts comparison to plotting only. The alternative value "equal" can produce a bootstrap hypothesis test of equality and the display of an appropriate reference band.
test a logical flag controlling the production of a bootstrap test of equality.
band a logical flag controlling the production of a reference band for equality. A band will be produced only in the case of two groups.
ngrid the size of the grid used to plot the curves.
nboot the number of bootstrap simulations.
monitor a logical flag controlling the printing of the iteration numbers during the bootstrap test.
xlab the label attached to the x-axis.
ylab the label attached to the y-axis.
xlim a vector of length 2 defining the range over which the densities are plotted.
lty a vector defining the line types to be used in plotting the density estimates for the different groups.
... additional graphical parameters.

Description

This function allows a set of univariate density estimates to be compared, both graphically and formally in a bootstrap hypothesis test of equality.

Details

see Section 6.2 of the reference below.

Value

When model is set to "none", nothing is returned. When "model" is set to "equal", a list containing the smoothing parameter and the p-value of the test is returned. When band takes the value T, and there are only two groups to compare, the list contains in addition the upper and lower end-points of the reference band for equality.

Side Effects

none.

References

Bowman, A.W. and Azzalini, A. (1997). Applied Smoothing Techniques for Data Analysis: the Kernel Approach with S-Plus Illustrations. Oxford University Press, Oxford.

See Also

sm.density, sm.ancova

Examples

y <- rnorm(100)
g <- rep(1:2, rep(50,2))
sm.density.compare(y, g, model="equal")


[Package Contents]