[R] Warning in gamlss function centiles.pred
rwnahhas
ramzi.nahhas at wright.edu
Thu Sep 19 16:48:55 CEST 2013
Hello,
I am getting a warning message in GAMLSS and have not been able to figure
out what the problem is, or if
it is something I should be concerned about.
I fit the following 4 models and find that fit2.bcpe is the one with the
lowest AIC
fit1.bcpe = gamlss(y~pb(x),
data=DAT, family=BCPE)
fit2.bcpe = gamlss(y~pb(x), sigma.formula=~pb(x),
data=DAT, family=BCPE)
fit3.bcpe = gamlss(y~pb(x), sigma.formula=~pb(x), nu.formula=~pb(x),
data=DAT, family=BCPE)
fit4.bcpe = gamlss(y~pb(x), sigma.formula=~pb(x), nu.formula=~pb(x),
tau.formula=~pb(x), data=DAT, family=BCPE)
AIC(fit1.bcpe, fit2.bcpe, fit3.bcpe, fit4.bcpe)
# df AIC
# fit2.bcpe 23.67571 15802.37
# fit3.bcpe 24.67868 15803.90
# fit4.bcpe 25.67313 15805.56
# fit1.bcpe 20.60762 15823.97
Then I use centiles.pred() to get predictions:
centiles.pred(fit2.bcpe, type=c("centiles"), xname="x", xvalues=18,
cent=c(3,15,50,85,97))
# new prediction
# new prediction
# x C3 C15 C50 C85 C97
# 1 18 100.3498 105.4568 111.4948 117.7682 123.4695
# Warning message:
# In predict.gamlss(obj, what = "mu", newdata = newx, type = "response",
:
# There is a discrepancy between the original and the
re-fit
# used to achieve 'safe' predictions
I thought perhaps that I am getting this error because of the use of the
pb() function. In the example
below, using x+I(x^2)+I(x^3) instead of poly(x,3) solves the problem,
although the exact same
predictions are produced making me wonder if the warning is something I can
just ignore.
data(aids)
a = gamlss(y~poly(x,3), family=PO, data=aids)
newaids = data.frame(x=c(45,46,47))
centiles.pred(a, type=c("centiles"), xname="x", xvalues=c(45,46,47),
cent=c(3,15,50,85,97))
# x C3 C15 C50 C85 C97
# 1 45 420 438 460 483 501
# 2 46 442 461 483 506 525
# 3 47 468 487 510 533 553
# Warning message:
# In predict.gamlss(obj, what = "mu", newdata = newx, type = "response",
:
# There is a discrepancy between the original and the
re-fit
# used to achieve 'safe' predictions
a = gamlss(y~x+I(x^2)+I(x^3), family=PO, data=aids)
centiles.pred(a, type=c("centiles"), xname="x", xvalues=c(45,46,47),
cent=c(3,15,50,85,97))
# x C3 C15 C50 C85 C97
# 1 45 420 438 460 483 501
# 2 46 442 461 483 506 525
# 3 47 468 487 510 533 553
# No warning, but same predictions.
So I thought perhaps the problem was the use of pb(), but I do NOT get the
warning if I make predictions
for any of the other 3 models:
centiles.pred(fit1.bcpe, type=c("centiles"), xname="x", xvalues=18,
cent=c(3,15,50,85,97), plot=T)
# x C3 C15 C50 C85 C97
# 1 18 100.1979 105.4092 111.4645 117.7477 123.547
centiles.pred(fit3.bcpe, type=c("centiles"), xname="x", xvalues=18,
cent=c(3,15,50,85,97), plot=T)
# x C3 C15 C50 C85 C97
# 1 18 100.4709 105.4202 111.3888 117.729 123.6178
centiles.pred(fit4.bcpe, type=c("centiles"), xname="x", xvalues=18,
cent=c(3,15,50,85,97), plot=T)
# x C3 C15 C50 C85 C97
# 1 18 100.3045 105.3596 111.2794 117.5696 123.5994
(1) If the warning is not because of pb(), then what is causing it?
(2) Can I ignore the warning? At least in the poly() example, the
predictions are the same after I fix the
problem causing the warning. And in my data, the predictions are similar
across the 4 models.
Thanks!
Ramzi
--
View this message in context: http://r.789695.n4.nabble.com/Warning-in-gamlss-function-centiles-pred-tp4676513.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list