This function plots centiles curves for separate ranges of the unique explanatory variable x.
It is similar to the centiles
function but the range of x is split at a user defined values xcut.point
into r separate ranges.
The functions also tabulates the sample percentages below each centile curve for each of the r ranges of x
(for comparison with the model percentage given by cent)
The model should have only one explanatory variable.
centiles.split(obj, xvar = NULL, xcut.points = NULL, n.inter = 4,
cent = c(0.4, 2, 10, 25, 50, 75, 90, 98, 99.6),
legend = FALSE, main = NULL, main.gsub = "@",
ylab = "y", xlab = "x", ylim = NULL, overlap = 0,
save = TRUE, plot = TRUE, ...)
a fitted gamlss object from fitting a gamlss continuous distribution
the unique explanatory variable
the x-axis cut off points e.g. c(20,30)
. If xcut.points=NULL
then the n.inter
argument is activated
if xcut.points=NULL
this argument gives the number of intervals in which the x-variable will be splited, with default 4
a vector with elements the % centile values for which the centile curves are to be evaluated
whether a legend is required in the plots or not, the default is legent=FALSE
the main title as character. If NULL the default title (shown the intervals) is shown
if the main.gsub
(with default "@") appears in the main
title then it is substituted with the default title.
the y-variable label
the x-variable label
the range of the y-variable axis
how much overlapping in the xvar
intervals. Default value is overlap=0
for non overlapping intervals
whether to save the sample percentages or not with default equal to TRUE
.
In this case the functions produce a matrix giving the sample percentages for each interval
whether to plot the centles. This option is usefull if the sample statistics only are to be used
for extra arguments
Centile plots are produced and the sample centiles below each centile curve for each of the r ranges of x can be saved into a matrix.
This function is appropriate when only one continuous explanatory variable is fitted in the model
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale and shape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Stasinopoulos D. M. Rigby R.A. (2007) Generalized additive models for location scale and shape (GAMLSS) in R. Journal of Statistical Software, Vol. 23, Issue 7, Dec 2007, http://www.jstatsoft.org/v23/i07.
Stasinopoulos D. M., Rigby R.A., Heller G., Voudouris V., and De Bastiani F., (2017) Flexible Regression and Smoothing: Using GAMLSS in R, Chapman and Hall/CRC.
(see also http://www.gamlss.org/).
# NOT RUN {
data(abdom)
h<-gamlss(y~pb(x), sigma.formula=~pb(x), family=BCT, data=abdom)
mout <- centiles.split(h,xvar=abdom$x)
mout
rm(h,mout)
# }
Run the code above in your browser using DataLab