View source: R/predict.sitar.R
predict.sitar | R Documentation |
Predict method for sitar
objects, based on predict.lme
.
## S3 method for class 'sitar'
predict(
object,
newdata = getData(object),
level = 1L,
...,
deriv = 0L,
abc = NULL,
xfun = identity,
yfun = identity
)
object |
an object inheriting from class |
newdata |
an optional data frame to be used for obtaining the
predictions, defaulting to the data used to fit |
level |
an optional integer vector giving the level(s) of grouping to be used
in obtaining the predictions, level 0 corresponding to the population
predictions. Defaults to level 1, and |
... |
other optional arguments: |
deriv |
an optional integer specifying predictions corresponding to
either the fitted curve or its derivative. |
abc |
an optional named vector containing values of a subset of
|
xfun |
an optional function to apply to |
yfun |
an optional function to apply to |
When deriv = 1
the returned velocity is in units of yfun(y)
per xfun(x)
. So if x
and/or y
are transformed, velocity
in units of y
per x
can be obtained by specifying xfun
and/or yfun
to back-transform them appropriately.
A vector of the predictions, or a list of vectors if asList =
TRUE
and level == 1
, or a data frame if length(level) > 1
.
Tim Cole tim.cole@ucl.ac.uk
ifun
for a way to generate the functions xfun
and yfun
automatically from the sitar
model call.
data(heights)
## fit model
m1 <- sitar(x=age, y=height, id=id, data=heights, df=5)
## predictions at level 0
predict(m1, newdata=data.frame(age=9:16), level=0)
## predictions at level 1 for subject 5
predict(m1, newdata=data.frame(age=9:16, id=5), level=1)
## velocity predictions for subjects with early and late puberty
vel1 <- predict(m1, deriv=1, abc=c(b=-1))
mplot(age, vel1, id, heights, col=id)
vel1 <- predict(m1, deriv=1, abc=c(b=1))
mplot(age, vel1, id, heights, col=id, add=TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.