Learn R Programming

sitar (version 1.0.1)

sitar: Fit SITAR growth curve model

Description

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.

Usage

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, bstart = "mean", xoffset = "mean",
 returndata = FALSE, verbose = FALSE, correlation = NULL, 
 weights = NULL, subset = NULL, method = "ML", na.action = na.fail, 
 control = nlmeControl(returnObject = TRUE), newform = TRUE)
## S3 method for class 'sitar':
update(object, ..., evaluate = TRUE)

Arguments

x
vector of ages.
y
vector of measurements.
id
factor of subject identifiers.
data
data frame containing variables x, y and id.
df
degrees of freedom for cubic regression spline.
knots
vector of values for knots (default df quantiles of x distribution).
fixed
character string defining which of a, b and c are fixed effects (default random).
random
character string defining which of a, b and c are random effects (default "a+b+c").
a.formula
formula for fixed effect a (default ~ 1).
b.formula
formula for fixed effect b (default ~ 1).
c.formula
formula for fixed effect c (default ~ 1).
bounds
span of x for regression spline, or fractional extension of range (default 0.04).
start
optional numeric vector of initial estimates for the fixed effects, or list of initial estimates for the fixed and random effects (see nlme).
bstart
optional starting value for fixed effect b (either "mean" (default), "apv" or value).
xoffset
optional value of offset for x (either "mean" (default), "apv" or value).
returndata
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 simul
verbose
optional logical value to print information on the evolution of the iterative algorithm (see nlme).
correlation
optional corStruct object describing the within-group correlation structure (see nlme).
weights
optional varFunc object or one-sided formula describing the within-group heteroscedasticity structure (see nlme).
subset
optional expression indicating the subset of the rows of data that should be used in the fit (see nlme).
method
character string, either "REML" or "ML" (default) (see nlme).
na.action
function for when the data contain NAs (see nlme).
control
list of control values for the estimation algorithm (see nlme).
newform
logical to distinguish between old and new forms of sitar object - default TRUE indicates new form.
object
object of class sitar.
...
further parameters for update consisting of any of the above sitar parameters.
evaluate
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.

Value

  • An object of class sitar representing the nonlinear mixed-effects model fit. Generic functions such as print, plot and summary have methods to show the results of the fit. The functions resid, coef, fitted, fixed.effects, and random.effects can be used to extract some of its components.

Details

The value of xoffset is ignored unless newform is FALSE. bstart (or xoffset if !newform) allow the origin of b to be varied, which affects its random effect variance. update updates the model by taking the object call, adding any new parameters and replacing changed ones. Where possible the fixed and random effects of the model being updated are passed via the start argument.

Examples

Run this code
data(heights)
## fit simple model
m1 <- sitar(x=age, y=height, id=id, data=heights, df=5)

##	alternatively try sqrt transform for height and increase df
m2 <- update(m1, x=age, y=sqrt(height), df=6)

Run the code above in your browser using DataLab