xyadj function

Adjust x and y variables for SITAR random effects

Adjust x and y variables for SITAR random effects

xyadj Adjusts x and y and optionally v values for subject-specific random effects from a SITAR model.

xyadj(object, x, y = 0, v = 0, id, abc = NULL, tomean = TRUE)

Arguments

  • object: a SITAR model.
  • x: a vector of x coordinates. If missing, x and y and id are obtained from object.
  • y: a vector of y coordinates (default 0).
  • v: a vector of velocity coordinates (default 0).
  • id: a factor denoting the subject levels corresponding to x and y and v.
  • abc: a data frame containing random effects for a, b, c and d (default ranef(object)[id, ]).
  • tomean: a logical defining the direction of adjustment. TRUE (default) indicates that individual curves are translated and rotated to match the mean curve, while FALSE indicates the reverse, the mean curve being translated and rotated to match individual curves.

Returns

The list of adjusted values: - x: numeric vector.

  • y: numeric vector the same length as x, or NULL.

  • v: numeric vector the same length as x, or NULL.

Details

When tomean = TRUE the x and y and v values are adjusted to

(xxoffsetb<fixed>b<random>)exp(c<random>)+xoffset+b<fixed> (x - xoffset - b<fixed> - b<random>) * exp(c<random>) + xoffset + b<fixed> ya<random>d<random>x y - a<random> - d<random> * x (vd<random>)/exp(c<random>) (v - d<random>) / exp(c<random>)

When tomean = FALSE they are adjusted to

(xxoffsetb<fixed>)/exp(c<random>)+xoffset+b<fixed>+b<random> (x - xoffset - b<fixed>) / exp(c<random>) + xoffset + b<fixed> + b<random> y+a<random>+d<random>x y + a<random> + d<random> * x vexp(c<random>)+d<random> v * exp(c<random>) + d<random>

In each case missing values of the fixed or random effects are set to zero.

Examples

data(heights) ## fit sitar model for height m1 <- sitar(x = age, y = height, id = id, data = heights, df = 5) ## plot unadjusted data as growth curves plot(m1, opt='u') ## overplot with adjusted data as points with(heights, points(xyadj(m1), col='red', pch = 19))

Author(s)

Tim Cole tim.cole@ucl.ac.uk