resid_wp: Worm plot using ggplot2

View source: R/resid_wp_new.R

resid_wpR Documentation

Worm plot using ggplot2

Description

The function produces worm plot of the residuals of a fitted model. A worm plot is a de-trended normal QQ-plot so departure from normality is highlighted.

The function plot_wp() it is similar to the gamlss package function wp() when the argument xvar is not used.

Usage

resid_wp(obj, resid, value = 3, points_col = "steelblue4", 
         poly_col = "darkred", 
         check_overlap = TRUE, title, ylim)

model_wp(obj, ..., title)  

resid_wp_wrap(obj, resid, value = 3, xvar = NULL, n_inter = 4, 
         points_col = "steelblue4", poly_col = "darkred", 
         alpha_bound = 0.1, check_overlap = TRUE, title, ylim)
         
model_wp_wrap(obj, ..., xvar = NULL, value = 3, n_inter = 4, 
         points_col = "steelblue4", alpha_bound = 0.1, 
         check_overlap = TRUE, ylim, title)         

Arguments

obj

a GAMLSS fitted object or any other fitted model where the resid() method works (preferably the residuals should be standardised or better normalised quantile residuals. Note for model_wp only gamlss object are accepted.)

resid

if object is missing this argument can be used to specify the residual vector (again it should a normalised quantile residual vector)

value

A cut off point to indicate large residuals, default is value=3

xvar

the x term for which the worm plot will be plotted against

n_inter

the number of intervals for continuous x-term

points_col

the color of the points in the plot

poly_col

the colour of the fitted polynomial in the plot

check_overlap

to check for overlap when plotting the observation numbers

alpha_bound

the transparency parameter for the coinfidence bound

title

required title

ylim

if the y limit should be different from the default max(y)+.1

...

extra GAMLSS models

Value

A worm plot is produced

Author(s)

Mikis Stasinopoulos, Bob Rigby and Fernanda De Bastiani

References

van Buuren and Fredriks M. (2001) Worm plot: simple diagnostic device for modelling growth reference curves. Statistics in Medicine, 20, 1259–1277

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

wp

Examples

data(abdom)
# with data
a<-gamlss(y~pb(x),sigma.fo=~pb(x,1),family=LO,data=abdom)
resid_wp(a)
resid_wp(resid=resid(a))

gamlss.ggplots documentation built on May 29, 2024, 1:34 a.m.