SITAR is a method of growth curve analysis, based on nlme, that summarises a set of growth curves with a mean growth curve as a regression spline, plus a set of up to three fixed and random effects (a, b and c) defining how individual growth curves differ from the mean curve.
sitar(x, y, id, data, df, knots, fixed = random, random = "a+b+c",
a.formula = ~1, b.formula = ~1, c.formula = ~1, bounds = 0.04, start,
xoffset = "mean", bstart = xoffset, returndata = FALSE,
verbose = FALSE, correlation = NULL, weights = NULL, subset = NULL,
method = "ML", na.action = na.fail, control = nlmeControl(returnObject =
TRUE))# S3 method for sitar
update(object, ..., evaluate = TRUE)
vector of ages.
vector of measurements.
factor of subject identifiers.
data frame containing variables x
, y
and
id
.
degrees of freedom for cubic regression spline (2 or more).
vector of values for knots (default df
quantiles of
x
distribution).
character string specifying a, b, c fixed effects (default
random
).
character string specifying a, b, c random effects (default
"a+b+c"
).
formula for fixed effect a (default ~ 1
).
formula for fixed effect b (default ~ 1
).
formula for fixed effect c (default ~ 1
).
span of x
for regression spline, or fractional
extension of range (default 0.04).
optional numeric vector of initial estimates for the fixed
effects, or list of initial estimates for the fixed and random effects (see
nlme
).
optional value of offset for x
(either "mean"
(default), "apv" or value).
optional starting value for fixed effect b
(either
"mean", "apv" or value (default xoffset
)).
logical which if TRUE causes the model matrix to be
returned, or if FALSE (default) the fitted model. Setting returndata TRUE is
useful in conjunction with subset
and subsample
for
simulation purposes.
optional logical value to print information on the evolution
of the iterative algorithm (see nlme
).
optional corStruct
object describing the
within-group correlation structure (see nlme
).
optional varFunc
object or one-sided formula
describing the within-group heteroscedasticity structure (see
nlme
).
optional expression indicating the subset of the rows of data
that should be used in the fit (see nlme
).
character string, either "REML" or "ML" (default) (see
nlme
).
function for when the data contain NAs (see
nlme
).
list of control values for the estimation algorithm (see
nlme
) (default nlmeControl(returnObject=TRUE)).
object of class sitar
.
further parameters for update
consisting of any of the
above sitar
parameters.
logical to control evaluation. If TRUE (default) the
expanded update
call is passed to sitar
for evaluation, while
if FALSE the expanded call itself is returned.
An object inheriting from class sitar
representing the
nonlinear mixed-effects model fit, with all the components returned by
nlme
(see nlmeObject
for a full description) plus the
following components:
the function returning the predicted value of y
.
the internal sitar
call that produced the object.
the value of xoffset
.
the lm
object providing starting values for the B-spline curve.
Generic functions such as print, plot, anova and summary have methods to show the results of the fit. The functions resid, coef, fitted, fixed.effects, random.effects, predict, getData, getGroups, getCovariate and getVarCov can be used to extract some of its components.
Note that versions of sitar prior to 1.0.4 did not return fitnlme. Both plot and predict may require it, in which case they update the SITAR object on the fly, with a message. Also version 1.0.5 altered the defaults for xoffset and bstart. Models fitted with versions prior to 1.0.5 need refitting.
xoffset
allows the origin of x
to be varied, while
bstart
specifies the starting value for b
, both of which can
affect the model fit and particularly b
. The values of bstart
,
knots
and bounds
are offset by xoffset
for fitting
purposes, and similarly for fixed effect b
.
The formulae a.formula
, b.formula
and c.formula
can
include functions and interactions, but make.names
is used to
ensure that the names of the corresponding model terms are valid. The
modified not the original names need to be specified in predict.sitar
.
update
updates the model by taking the object
call, adding any
new parameters and replacing changed ones. Where feasible the fixed and
random effects of the model being updated are suitably modified and passed
via the start
argument.
# NOT RUN {
data(heights)
## fit simple model
(m1 <- sitar(x=age, y=height, id=id, data=heights, df=5))
## relate random effects to age at menarche (with censored values +ve)
## both a (size) and b (tempo) are positively associated with age at menarche
amen <- abs(heights$men)
(m2 <- update(m1, a.form=~amen, b.form=~amen, c.form=~amen))
# }
Run the code above in your browser using DataLab