Dear Daniel,

The centiles.pred is currently set up for a gamlss object fitted using the
function gamlss, not function lms
(but we will aim to change this soon).

The lms function uses calibration=TRUE as default
(this automatically adjusts the centile curves so that the sample %'s below
each centile curve equals the value of cent,
see Matsumoto et al. (2012) Energy Policy, 48, 820-828).
The gamlss function does not automatically do this.

The warning about 'safe' predictions can be caused by the prediction range
of x being wider than the data range of x
(see section 3.4 of the gamlss manual, Stasinopoulos et al. (2008)
'Instructions on how to use the gamlss package in R, 2nd edition',
or see Chambers and Hastie (1992) 'Statistical Models in S').

Robert Rigby



Date: Tue, 10 Dec 2013 18:27:45 +0000
From: D?niel Kehl <kehld@ktk.pte.hu>
To: David Winsemius <dwinsemius@comcast.net>
Cc: "r-help@r-project.org" <r-help@r-project.org>
Subject: Re: [R] growth curve estimation
Message-ID:
        <33D76D77E9AC4B438DA38B348ED6890D0B90B0A3@EMAIL.ktkdom.pte.hu>
Content-Type: text/plain; charset="iso-8859-2"
Dear Vito, Robert and David,
thank you for your replies, although I made some step forward on my own,
your answers helped a lot and gave me more insight.
The only question I have left is why this code gives me an error (and that
is what David asked for):
m1 <- lms(BMI,age,data=adatok_fiu, cent=c(3,10,25,50,75,90,97),
families="BCCG")
centiles.pred(m1, xname="age", xvalues=seq(10,20,.5),
cent=c(3,10,25,50,75,90,97))
Error in X[onlydata, , drop = FALSE] :
  (subscript) logical subscript too long
but
m3 <- gamlss(BMI~pb(age), sigma.formula=~pb(age), nu.formula = ~pb(age),
tau.formula = ~pb(age), family=BCT, data=adatok_fiu)
centiles.pred(m3, xname="age", xvalues=seq(10,20,.5),
cent=c(3,10,25,50,75,90,97))
works as expected (although I get a warning message
Warning message:
In predict.gamlss(obj, what = "tau", newdata = newx, type = "response",  :
  There is a discrepancy  between the original and the re-fit
 used to achieve 'safe' predictions

I had the feeling centiles.pred should work for the result of an lms()
function just like in case of gamlss().
Thank you all again!
daniel

Companies Act 2006 : http://www.londonmet.ac.uk/companyinfo

	[[alternative HTML version deleted]]

