Learn R Programming

sm (version 2.0-2)

sm.ancova: Nonparametric analysis of covariance

Description

This function allows a set of nonparametric regression curves to be compared, both graphically and formally in a hypothesis test. A reference model, used to define the null hypothesis, may be either equality or parallelism.

Usage

sm.ancova(x, y, group, h, model="none", band=TRUE, test=TRUE,
          h.alpha=2 * diff(range(x))/length(x),
          weights = as.integer(rep(1, length(x))), ...)

Arguments

x
a vector of covariate values.
y
a vector of response values.
group
a vector of group indicators.
h
the smoothing parameter to be used in the construction of each of the regression curves.
model
a character variable which defines the reference model. The values "none", "equal" and "parallel" are possible.
band
a logical flag controlling the production of a reference band for the reference model. A band will be produced only in the case of two groups.
test
a logical flag controlling the production of a formal test, using the reference model as the null hypothesis.
h.alpha
the value of the smoothing parameter used when estimating the vertical separations of the curves under the parallelism model.
weights
case weights.
...
other optional parameters are passed to the sm.options function, through a mechanism which limits their effect only to this call of the function; those relevant for this function are the following:
display
any character setting other than "none" will cause a plot of the curves, distinguished by line type, to be produced.
ngrid
the size of the grid used to plot the curves.
eval.points
a vector of points at which reference bands will be evaluated.
xlab
the label attached to the x-axis.
ylab
the label attached to the y-axis.

Value

  • a list containing an estimate of the error standard deviation and, where appropriate, a p-value and reference model. If the parallelism model has been selected then a vector of estimates of the vertical separations of the underlying regression curves is also returned.

Side Effects

a plot on the current graphical device is produced, unless display="none"

Details

see Sections 6.4 and 6.5 of the book by Bowman & Azzalini, and the papers by Young & Bowman listed below. This function is a developed version of code originally written by Stuart Young.

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.

Young, S.G. and Bowman, A.W. (1995). Nonparametric analysis of covariance. Biometrics 51, 920--931.

Bowman, A.W. and Young, S.G. (1996). Graphical comparison of nonparametric curves. Applied Statistics 45, 83--98.

See Also

sm.regression, sm.density.compare, sm.options

Examples

Run this code
x <- runif(50, 0, 1)
y <- 4*sin(6*x) + rnorm(50)
g <- rbinom(50, 1, 0.5)
sm.ancova(x, y, g, h = 0.15, model = "equal")

Run the code above in your browser using DataLab