Issue with centiles.pred in gamlss

I have an issue with the gamlss package, in particular with the centiles.pred() function.
For instance, if I run the following code, I get stuck in an error:

library(gamlss)
x <- c(6, 6, 7, 7, 7, 7, 7, 8, 8, 8, 8, 7, 8, 8, 8)
y <- c(372, 375, 340, 370, 386, 396, 398, 357, 360, 360, 362, 415, 365, 366, 368)
data <- data.frame(x, y)
m1 <- gamlss(y~pb(x),sigma.fo=~pb(x), data=data, family=BCT)
centiles(m1, xvar = data$x)
newx <- seq(6, 8, 0.5)
mat <- centiles.pred(m1, xname = "x", xvalues = newx)

When I run the last row, I get the following message:
"Error in data.frame(data, source = namelist) :
arguments imply differing number of rows: 5, 6"

How can I overcome this error?

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.