LMSfit: Estimate LMS curves from tabulated growth reference centiles

View source: R/LMSfit.R

LMSfitR Documentation

Estimate LMS curves from tabulated growth reference centiles

Description

A function to summarise an existing set of growth reference centiles as the L, M and S curves of the LMS method.

Usage

LMSfit(
  x,
  y,
  sex,
  data = parent.frame(),
  centiles = c(3, 10, 25, 50, 75, 90, 97),
  df = c(6, 10, 8),
  L1 = FALSE,
  plot = TRUE,
  ...
)

Arguments

x

vector of tabulated ages.

y

matrix of corresponding measurement centiles, e.g. of height or weight, with nrows = length(x) and ncols = length(centiles).

sex

two-level factor where level 1 corresponds to male and level 2 to female.

data

optional data frame containing x, y and sex.

centiles

vector of centiles corresponding to the columns of y, default c(3, 10, 25, 50, 75, 90, 97).

df

length-3 vector with the cubic smoothing spline equivalent degrees of freedom (edf) for the L, M and S curves, default c(6, 10, 8).

L1

logical constraining the L curve to 1, i.e. a Normal distribution, default FALSE.

plot

logical to plot the estimated L, M and S curves, default TRUE.

...

optional graphical parameters for the plots.

Details

At each age the optimal Box-Cox power Lopt is estimated to render the centiles closest to Normal, and the corresponding median Mopt and coefficient of variation Sopt are derived. The three sets of values are then smoothed across age to give L, M and S.

Value

A list with the results:

list("LMS")

data frame of sex, x, L, M, S, Lopt, Mopt, Sopt.

list("ey")

matrix of predicted values of y.

list("ez")

matrix of predicted values of z.

list("fit")

matrix of summary statistics for ey, giving for each column cmean the mean centile, zmean the mean z-score, zSD the SD of the z-score, and zmin and zmax the minimum and maximum z-scores.

Author(s)

Tim Cole tim.cole@ucl.ac.uk

See Also

LMS2z, z2cent. The LMS method can be fitted to data using the package gamlss with the BCCG family, where nu (originally lambda), mu and sigma correspond to L, M and S respectively.

Examples


## first construct table of boys weight centiles by age for WHO standard
data(who06)
zs <- -4:4*2/3 # z-scores for centiles
ages <- 0:12/4 # ages 0-3 years by 3 months
v <- vapply(as.list(zs), function(z)
 LMS2z(ages, z, sex = 1, measure = 'wt', ref = 'who06', toz = FALSE),
  rep(0, length(ages)))
round(v, 2)

## then back-calculate the original LMS curves and display summary statistics
LMSfit(x=ages, y=v, sex=1, centiles=pnorm(zs)*100, plot=FALSE)


sitar documentation built on July 9, 2023, 6:51 p.m.