sm.rm {sm} | R Documentation |
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, ngrid=20, optimize=F, display="lines", add=F, poly.index=1, display.rice=F, ...)
y |
matrix containing the values of the response variable, with rows associated to individuals and columns associated to observation times. |
Time |
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) .
|
minh |
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. |
maxh |
the maximum value of the above interval. |
ngrid |
the number of divisions of the above interval to be considered. |
optimize |
Logical value, default is optimize=F . If optimize=T , then a full
optimization is performed after searching the interval (minh,maxh)
using the optimizer nlminb .
|
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" .
|
add |
logical value, default is add=F . If add=T and display is not set
to "none" , then graphical output added to the existing plot, rather than
starting a new one.
|
poly.index |
overall degree of locally-fitted polynomial, as used by sm.regression
|
display.rice |
If this set to T (default is F ), a plot is produced of the curve
representing the modified Rice criterion for bandwidth selection.
See reference below for details.
|
... |
Optional parameters passed to sm.regression .
|
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.
if the parameter display is not set to "none"
, a plot of the estimated
regression curve is produced;
other aspects are controlled by parameter add and optional parameters (...{}
).
If display.rice=T
, 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.
sm.regression
, sm.regression.autocor
provide.data(citrate, describe=FALSE); provide.data(dogs, describe=FALSE) # assume that citrate and dogs are matrices a <- sm.rm(y=citrate, display.rice=T) # Time <- c(1,3,5,7,9,11,13) 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=T)