# How to simulate from LMS parameters

I am trying to simulate a distribution of weights from the LMS parameters given in the CDC growth chart AGEWT given here

Let's say I want to simulate 10 weights for 2 year olds (Agemos == 24) in the dataset. My thinking is that the box-cox transformation leads to transformed data being approximately normally distributed. Hence, I can assume median to be equal to the mean and standard deviation equal to M*S (S being the coefficient of variation).

I use rnorm function in R, i.e.

x = rnorm(n = 10, mean = M, sd = S*M)


Then, I can back-transform based on the following equation (lambda = L is not zero)

where the LHS is equal to the x in the equation above. So, the raw weights can be calculated as

However, for the data in the WTAGE dataset (for Agemos == 24), the values of L (lambda) make the argument to the log in the numerator of the RHS negative, hence I am not able take log of those values to calculate y, i.e. for L = -0.2061524, S = 0.1081258, M = 12.67076, Agemos = 24.0, the value of argument to the log function in the numerator of RHS is negative, so I can't calculate the raw values.

My question is, what am I doing wrong here?

Secondly, the CDC page provides a formula to calculate any percentile from the LMS parameters. They also provide 3rd, 5th, 10th, 25th, 50th, 75th, 90th, 95th and 97th percentile. Can I use this information to infer a background distribution and sample from that, and if yes, how?

Thank you.

I cannot follow what you are doing with the logs: your second equation does not follow from the first and the first is the equation for a vanilla Box-Cox transform with parameter $$\lambda$$ but does not indicate how the other two parameters ($$M$$ and $$S$$) are supposed to enter the picture.

However, this report gives the formula for an LMS distribution as:

$$X = M (1 + LSZ)^{1/L} \tag{1}$$

where $$M$$, $$L$$, and $$S$$ are real-valued parameters and $$Z$$ is a standard normal distribution $$Z \sim \mathcal{N}(0, 1)$$. $$X$$ is therefore a random variable with the skewed distribution for the anthropomorphic variable. Note that while this is indeed a power transform just Box-Cox, the parameter $$L$$ is not being used in the same way as the parameter $$\lambda$$ in the usual Box-Cox transform and it's best not to conflate the two.

Equation (1) roughly corresponds to the R function:

lms <- function(L, M, S) function(Z) M * (1 + L*S*Z)^(1/L)


This constructs and returns a function f(z) which translates normally distributed values into shifted and skewed values.

Using the parameters you give for WTAGE at Agemos=24, we can calculate some percentile values and see that they match exactly the values on the WTAGE spreadsheet you referenced.

> f <- lms(L = -0.2061524, S = 0.1081258, M = 12.67076)
> f( qnorm(0.5) )
[1] 12.67076
> f( qnorm(0.1) )
[1] 11.05265
> f( qnorm(0.9) )
[1] 14.58339


We can also use the same function to randomly sample from the LMS distribution $$X$$:

> f( Z=rnorm(n=5) )
[1] 14.15190 10.56655 12.16368 14.86803 12.83904

• Thank you very much for your answer. In the paper, Z is mentioned as the desired percentile in standard deviation units. Could you explain how you infer Z to be the standard normal distribution? Thank you! May 6, 2019 at 20:27
• @SN248 - Z is (almost) standard notation for a random variable with standard normal distribution; they also mention in the preceding paragraph that in this case Box-Cox is a transformation "to normality." Plugging in a raw percentile, which would be a number between 0 and 1, clearly will not work, so the implication is that the percentile should be converted to a z-score by passing it through the inverse CDF (R's qnorm() function) of the normal distribution. So what the paper meant was : "Z is the [z-score associated with the] desired percentile in standard deviation units." May 6, 2019 at 20:52
• Thanks! I think I understand now. May 6, 2019 at 21:03