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

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. Regression surfaces can also be compared in a test but a graphical display is not produced.

Usage

sm.ancova(x, y, group, h, model = "none", h.alpha = NA, weights=NA,
                 covar = diag(1/weights), ...)

Arguments

x

a vector or two-column matrix 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. If this is missing the method of smoothing parameter selection specified by sm.options will be applied.

model

a character variable which defines the reference model. The values "none", "equal" and "parallel" are possible.

h.alpha

the value of the smoothing parameter used when estimating the vertical separations of the curves under the parallelism model. If this is missing, it is set to 2 * r / n, where r denotes the range of the data and n the sample size.

weights

case weights; see the documentation of sm.regression for a full description.

covar

the (estimated) covariance matrix of y. The defaulty value assumes the data to be independent. Where appropriate, the covariance structure of y can be estimated by the user, externally to sm.ancova, and passed through this argument. This is used in the hypothesis tests but not in the construction of the reference band for comparing two groups (and so graphics are disabled in this case).

...

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, ngrid, eval.points, xlab, ylab; see the documentation of sm.options for their description.

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.

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. If a reference band has been requested, the upper and lower boundaries and their common evaluation points are also returned.

Side Effects

a plot on the current graphical device is produced, unless display="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.

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

Examples

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")

sm

Smoothing Methods for Nonparametric Regression and Density Estimation

v2.2-5.6
GPL (>= 2)
Authors
Adrian Bowman and Adelchi Azzalini. Ported to R by B. D. Ripley <ripley@stats.ox.ac.uk> up to version 2.0, version 2.1 by Adrian Bowman and Adelchi Azzalini, version 2.2 by Adrian Bowman.
Initial release
2018-09-27

We don't support your browser anymore

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