sm.rm {sm}R Documentation

Nonparametric analysis of repeated measurements data


This function estimates nonparametrically the mean profile from a matrix y which is assumed to contain repeated measurements (i.e. longitudinal data) from a set of individuals.


sm.rm(Time, y, minh = 0.1, maxh = 2, optimize = FALSE,
      rice.display = FALSE, ...)



matrix containing the values of the response variable, with rows associated to individuals and columns associated to observation times.


a vector containing the observation times of the response variable, assumed to be the same for all individuals of matrix y. If Time is not given, this is assumed to be 1:ncol(y).


the mimimum value of the interval where the optimal value of the smoothing parameter is seached according to the modified Rice criterion. See reference below for details.


the maximum value of the above interval.


Logical value, default is optimize=FALSE. If optimize=TRUE, then a full optimization is performed after searching the interval (minh,maxh) using the optimizer optim.


If this set to TRUE (default is FALSE), a plot is produced of the curve representing the modified Rice criterion for bandwidth selection. See reference below for details.


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:

  • add logical value, default is add=FALSE. If add=TRUE and display is not set to "none", then graphical output added to the existing plot, rather than starting a new one.

  • display character value controlling the amount of graphical output of the estimated regression curve. It has the same meaning as in sm.regression. Default value is display="lines".

  • ngrid the number of divisions of the above interval to be considered. Default: ngrid=20.

  • poly.index overall degree of locally-fitted polynomial, as used by sm.regression. Default: ngrid=1.


see Section 7.4 of the reference below.


a list containing the returned value produced by sm.regression when smoothing the mean response value at each given observation time, with an extra component $aux added to the list. This additional component is a list itself containing the mean value at each observation time, the residual variance of the residuals from the estimated regression curve, the autocorrelation function of the residuals, and the value h of the chosen smoothing parameter.

Side Effects

if the parameter display is not set to "none", a plot of the estimated regression curve is produced; other aspects are controlled by the optional parameters (...). If rice.display=TRUE, a plot of the modified Rice criterion is shown.


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.regression, sm.regression.autocor, optim


sm.rm(y=as.matrix(citrate), display.rice=TRUE)
with(dogs, {
   Time <- seq(1,13,by=2)
   gr1  <- as.matrix(dogs[dogs$Group==1,2:8])
   plot(c(1,13), c(3,6),xlab="time", ylab="potassium", type="n") 
   sm1  <- sm.rm(Time, gr1, display="se", add=TRUE)

[Package sm version 2.2-5.6 Index]