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.
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)
A worm plot is produced
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.)
if object is missing this argument can be used to specify the residual vector (again it should a normalised quantile residual vector)
A cut off point to indicate large residuals, default is value=3
the x term for which the worm plot will be plotted against
the number of intervals for continuous x-term
the color of the points in the plot
the colour of the fitted polynomial in the plot
to check for overlap when plotting the observation numbers
the transparency parameter for the coinfidence bound
required title
if the y limit should be different from the default max(y)+.1
extra GAMLSS models
Mikis Stasinopoulos, Bob Rigby and Fernanda De Bastiani
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/).
wp
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))
Run the code above in your browser using DataLab