The function centiles.pred
is a great option to extract z-scores based on a gamlss model like in the following code:
library(gamlss)
FIT = gamlss(mpg ~ disp, data = mtcars, family = BCPE)
NEWDATA = data.frame(disp = 300, mpg = 17)
centiles.pred(FIT, xvalues = NEWDATA$disp, xname = "disp", yval = NEWDATA$mpg, type = "z-scores")
However, the help-page of centiles.pred
says "A restriction of the function is that it applies to models with only one explanatory variable". In many cases, however, you have more than one explanatory variable as in the following example:
FIT = gamlss(mpg ~ disp + qsec, data = mtcars, family = BCPE)
My question is:
Is there a workable way to calculate z-scores and centiles (also according to the arguments family = "standard-centiles"
, and family = "centiles"
in the function centiled.pred
) from a gamlss model with more than one explanatory variable?