centiles: Plots the centile curves for a GAMLSS object

Description Usage Arguments Details Value Warning Author(s) References See Also Examples

Description

This function centiles() plots centiles curves for distributions belonging to the GAMLSS family of distributions. The function also tabulates the sample percentages below each centile curve (for comparison with the model percentages given by the argument cent.) The function centiles.fan() plots a fan-chart of the centile curves. A restriction of the functions is that it applies to models with one explanatory variable only.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
centiles(obj, xvar, cent = c(0.4, 2, 10, 25, 50, 75, 90, 98, 99.6), 
         legend = TRUE, ylab = "y", xlab = "x", main = NULL, 
         main.gsub = "@", xleg = min(xvar), yleg = max(obj$y), 
         xlim = range(xvar), ylim = range(obj$y), save = FALSE, 
         plot = TRUE, points = TRUE,  pch =  15, cex = 0.5, col =  gray(0.7), 
         col.centiles = 1:length(cent) + 2, lty.centiles = 1, lwd.centiles = 1, ...)
centiles.fan(obj, xvar, cent = c(0.4, 2, 10, 25, 50, 75, 90, 98, 99.6), 
         ylab = "y", xlab = "x", main = NULL, main.gsub = "@", 
         xleg = min(xvar), yleg = max(obj$y), xlim = range(xvar), 
         ylim = range(obj$y), points = FALSE,  median = TRUE, pch =  15, 
         cex = 0.5, col =  gray(0.7),
         colors = c("cm", "gray", "rainbow", "heat", "terrain", "topo"), ...)

Arguments

obj

a fitted gamlss object from fitting a gamlss distribution

xvar

the unique explanatory variable

cent

a vector with elements the % centile values for which the centile curves have to be evaluated

legend

whether a legend is required in the plot or not, the default is legent=TRUE

ylab

the y-variable label

xlab

the x-variable label

main

the main title here as character. If NULL the default title "centile curves using NO" (or the relevant distributions name) is shown

main.gsub

if the main.gsub (with default "@") appears in the main title then it is substituted with the default title.

xleg

position of the legend in the x-axis

yleg

position of the legend in the y-axis

xlim

the limits of the x-axis

ylim

the limits of the y-axis

save

whether to save the sample percentages or not with default equal to FALSE. In this case the sample percentages are printed but are not saved

plot

whether to plot the centiles. This option is useful for centile.split

pch

the character to be used as the default in plotting points see par

cex

size of character see par

col

plotting colour see par

col.centiles

Plotting colours for the centile curves

lty.centiles

line type for the centile curves

lwd.centiles

The line width for the centile curves

colors

the different colour schemes to be used for the fan-chart. The following are available c("cm","gray", "rainbow", "heat", "terrain", "topo"),

points

whether the data points should be plotted, default is TRUE for centiles() and FALSE for centiles.fan()

median

whether the median should be plotted (only in centiles.fan())

...

for extra arguments

Details

Centiles are calculated using the fitted values in obj and xvar must correspond exactly to the predictor in obj to plot correctly.

col.centiles, lty.centiles and lwd.centiles may be vector arguments and are recycled to the length cent if necessary.

Value

A centile plot is produced and the sample centiles below each centile curve are printed (or saved)

Warning

This function is appropriate only when one continuous explanatory variable is fitted in the model

Author(s)

Mikis Stasinopoulos d.stasinopoulos@londonmet.ac.uk, Bob Rigby r.rigby@londonmet.ac.uk with contribution from Steve Ellison

References

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.

Rigby, R. A., Stasinopoulos, D. M., Heller, G. Z., and De Bastiani, F. (2019) Distributions for modeling location, scale, and shape: Using GAMLSS in R, Chapman and Hall/CRC. An older version can be found in https://www.gamlss.com/.

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, https://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 https://www.gamlss.com/).

See Also

gamlss, centiles.split , centiles.com

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
data(abdom)
h<-gamlss(y~pb(x), sigma.formula=~pb(x), family=BCT, data=abdom) 
# default plot
centiles(h,xvar=abdom$x)
# control of colours and lines
centiles(h, xvar=abdom$x,  col.cent=c(2,3,4,5,1,5,4,3,2,1), 
              lwd.cent=c(1,1,1,1,2,1,1,1,1))
#Control line types
centiles(h, xvar=abdom$x,  col.cent=1, cent=c(.5,2.5,50,97.5,99.5), 
              lty.centiles=c(3,2,1,2,3),lwd.cent=c(1,1,2,1,1))
# control of the main title
centiles(h, xvar=abdom$x,  main="Abdominal data \n @")
# the fan-chart
centiles.fan(h,xvar=abdom$x, colors="rainbow")
rm(h)

Example output

Loading required package: splines
Loading required package: gamlss.data
Loading required package: gamlss.dist
Loading required package: MASS
Loading required package: nlme
Loading required package: parallel
 **********   GAMLSS Version 5.0-2  ********** 
For more on GAMLSS look at http://www.gamlss.org/
Type gamlssNews() to see new features/changes/bug fixes.

GAMLSS-RS iteration 1: Global Deviance = 4771.925 
GAMLSS-RS iteration 2: Global Deviance = 4771.039 
GAMLSS-RS iteration 3: Global Deviance = 4770.999 
GAMLSS-RS iteration 4: Global Deviance = 4770.994 
GAMLSS-RS iteration 5: Global Deviance = 4770.993 
% of cases below  0.4 centile is  0.3278689 
% of cases below  2 centile is  2.459016 
% of cases below  10 centile is  8.688525 
% of cases below  25 centile is  26.22951 
% of cases below  50 centile is  50.16393 
% of cases below  75 centile is  73.77049 
% of cases below  90 centile is  90 
% of cases below  98 centile is  98.03279 
% of cases below  99.6 centile is  99.67213 
% of cases below  0.4 centile is  0.3278689 
% of cases below  2 centile is  2.459016 
% of cases below  10 centile is  8.688525 
% of cases below  25 centile is  26.22951 
% of cases below  50 centile is  50.16393 
% of cases below  75 centile is  73.77049 
% of cases below  90 centile is  90 
% of cases below  98 centile is  98.03279 
% of cases below  99.6 centile is  99.67213 
% of cases below  0.5 centile is  0.6557377 
% of cases below  2.5 centile is  2.459016 
% of cases below  50 centile is  50.16393 
% of cases below  97.5 centile is  97.70492 
% of cases below  99.5 centile is  99.5082 
% of cases below  0.4 centile is  0.3278689 
% of cases below  2 centile is  2.459016 
% of cases below  10 centile is  8.688525 
% of cases below  25 centile is  26.22951 
% of cases below  50 centile is  50.16393 
% of cases below  75 centile is  73.77049 
% of cases below  90 centile is  90 
% of cases below  98 centile is  98.03279 
% of cases below  99.6 centile is  99.67213 

gamlss documentation built on March 31, 2021, 5:10 p.m.