LMSfit | R Documentation |
A function to summarise an existing set of growth reference centiles as the L, M and S curves of the LMS method.
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,
...
)
x |
vector of tabulated ages. |
y |
matrix of corresponding measurement centiles, e.g. of height or
weight, with |
sex |
two-level factor where level 1 corresponds to male and level 2 to female. |
data |
optional data frame containing |
centiles |
vector of centiles corresponding to the columns of |
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. |
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.
A list with the results:
data frame of sex, x, L, M, S, Lopt, Mopt, Sopt.
matrix of predicted
values of y
.
matrix of predicted
values of z
.
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.
Tim Cole tim.cole@ucl.ac.uk
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.
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.