Learn R Programming

gamlss.ggplots (version 2.1-12)

resid_density: Density of the residuals in a GAMLLSS model

Description

The function resid_density() plots an histogram and a density estimator of the normalised quantile residuals from a fitted GAMLSS model. The function model_density() plots density estimators of the normalised quantile residuals from more than one fitted GAMLSS models.

Usage

resid_density(obj, resid, hist.col = "black", hist.fill = "white", 
              dens.fill = "#FF6666", title)
model_density(obj, ..., title)

Value

A density plot of the residuals is produced.

Arguments

obj

The function needs a GAMLSS fitted model or

resid

any standarised residual

hist.col

The colour of the border of the histogram

hist.fill

The colout of the hisogram

dens.fill

the colour of the desnsity

title

A title if needed

...

extra GAMLSS models

Author

Mikis Stasinopoulos, Bob Rigby and Fernanda De Bastiani

Details

This function resid_density() is a denity plot (similar to of the four plots produded when the plotting function plot.gamlss() is used within the gamlss package. I uses plotting function from the ggplot2 package.

References

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

plot.gamlss

Examples

Run this code
data(abdom)
a<-gamlss(y~pb(x),family=LO,data=abdom)
b<-gamlss(y~pb(x),family=NO,data=abdom)
resid_density(a)
model_density(a,b)

Run the code above in your browser using DataLab