cLMS: LMS conversion to and from z-scores

View source: R/LMS2z.R

cLMSR Documentation

LMS conversion to and from z-scores

Description

Routines to handle references constructed with the LMS method. Given a set of LMS values, the functions convert z-scores to measurement centiles and vice versa.

Usage

cLMS(z, L = 1, M, S)

zLMS(x, L = 1, M, S)

Arguments

z

vector or one-column matrix of z-scores to be converted to measurements.

L

vector of Box-Cox transformation (lambda) values, L in the LMS method.

M

vector of medians (mu), M in the LMS method.

S

vector of coefficients of variation (sigma), S in the LMS method.

x

vector or one-column matrix of measurements to be converted to z-scores.

Details

L, M and S – and if vectors then x and z – should all be the same length, recycled if necessary. The formulae converting x to z and vice versa are:

z = \frac{(x/M)^L - 1}{L S}

x = M (1 + L S z)^{1/L})

where L is reset to 10^-7 if it is zero. The LMS method is the same as the BCCG family in the gamlss package, except that lambda in LMS is referred to as nu in BCCG.

Value

If x and z are vectors zLMS and cLMS each return a vector, respectively of z-scores and measurement centiles, with length matching the length of (the longest of) x or z, L, M and S. If x or z are matrices zLMS and cLMS each return a matrix, the number of rows matching the length of (the longest of) L, M and S, and the number of columns matching the length of x or z.

Author(s)

Tim Cole tim.cole@ucl.ac.uk

See Also

z2cent, LMS2z, pdLMS

Examples


cLMS(z = as.matrix(-2:2), L = 1:-1, M = 5:7, S = rep(0.1, 3))
cLMS(z = 0:2, L = 1:-1, M = 7, S = 0.1)
cLMS(z = as.matrix(0:2), L = 1:-1, M = 7, S = 0.1)
zLMS(x = 6.5, L = 1:-1, M = 5:7, S = rep(0.1, 3))


statist7/sitar documentation built on Feb. 7, 2024, 2:08 a.m.