fitted_centiles {gamlss.ggplots} | R Documentation |
Plotting centile (growth) curves
Description
The function fitted_centiles()
plots centiles curves for distributions belonging to the GAMLSS family of distributions. The plot is equivalent to the standard plot of gamlss:::centiles()
without a legend.
The function fitted_centiles_legend()
plots centiles curves for distributions belonging to the GAMLSS family of distributions and it is equivalent to the standard plot of gamlss:::centiles()
with a legend. The function is slower than fitted_centiles()
since in order to plot the legend the data have to expanded.
The function model_centiles()
plots centile curves for more than one model. There is no equivalent plot in the original GAMLSS centile plots but it perform the same function as gamlss:::centiles.com()
which compares centiles from different models.
Usage
fitted_centiles(obj, xvar,
cent = c(99.4, 98, 90, 75, 50, 25, 10, 2, 0.4),
points = TRUE, point.col = "gray",
point.size = 1, line.size = 0.8,
line.col = hcl.colors(lc, palette = "Dark 2"),
line.type = rep(1, length(cent)),
xlab = NULL, ylab = NULL, title, ...)
fitted_centiles_legend(obj, xvar,
cent = c(99.4, 98, 90, 75, 50, 25, 10, 2, 0.4),
points = TRUE, point.col = "gray", point.size = 1,
line.size = 0.8, line.col = hcl.colors(ncent,
palette = "Dark 2"), line.type = rep(1, length(cent)),
show.legend = TRUE, save.data = FALSE, title,
xlab = NULL, ylab = NULL, ...)
model_centiles(obj, ..., cent = c(97, 90, 75, 50, 25, 10, 3),
xvar, xlab = "age", points = TRUE,
point.col = gray(0.8),
point.size = 0.05, line.size = 0.7,
line.col = hcl.colors(ncent,palette = "Dark 2"),
ncol = 2, nrow = ceiling(nnames/ncol), in.one = FALSE,
title)
Arguments
obj |
a fitted gamlss object |
xvar |
the (unique) explanatory variable |
cent |
a vector with elements the % centile values for which the centile curves have to be evaluated (note that the order is from the highest to the lowest so legend and the plots are maching) |
points |
whether to plot the points ( |
point.col |
the colour of the points |
point.size |
the zize of the points |
line.size |
the sized of the centile lines |
line.col |
the colour of the centile lines |
line.type |
the type of line (different types of lines for each centile are working with |
xlab |
the label of the x-axis variable |
ylab |
the label of the resposnse variable |
in.one |
whether the |
title |
the title if need it otherwise a dfault title is pronted |
show.legend |
whether to show the legend |
save.data |
whether to save the |
nrow |
the number of rows in the |
ncol |
the number of columns in the |
... |
for extra arguments for |
Details
Centiles are calculated using the fitted values in obj
and xvar
must
correspond exactly to the predictor in obj
to plot correctly.
Value
A plot is created
Warning
This function is appropriate only when one continuous explanatory variable is fitted in the model
Author(s)
Mikis Stasinopoulos, Bob Rigby and Fernanda de Bastiani
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.
Stasinopoulos, M.D., Kneib, T., Klein, N., Mayr, A. and Heller, G.Z., (2024). Generalized Additive Models for Location, Scale and Shape: A Distributional Regression Approach, with Applications (Vol. 56). Cambridge University Press.
(see also https://www.gamlss.com/).
See Also
Examples
data(abdom)
h<-gamlss(y~pb(x), sigma.formula=~pb(x), family=BCTo, data=abdom)
h1 <- gamlss(y~pb(x), sigma.formula=~pb(x), family=LO, data=abdom)
fitted_centiles(h)
fitted_centiles_legend(h)
model_centiles(h, h1)