sm.ancova {sm}R Documentation

Nonparametric analysis of covariance


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.


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



a vector or two-column matrix of covariate values.


a vector of response values.


a vector of group indicators.


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.


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


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.


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


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.


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.


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"


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.options


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

[Package sm version 2.2-5.6 Index]