Learn R Programming

gamlss (version 4.2-4)

rqres.plot: Plotting Randomized Quantile Residuals

Description

This function plots worm plots, van Buuren and Fredriks M. (2001), or QQ-plots of the normalized randomized quantile residuals (Dunn and Smyth, 1996) for a model using a discrete GAMLSS family distribution.

Usage

rqres.plot(obj = NULL, howmany = 6, plot = c("all", "average"), 
           type = c("wp", "QQ"), ...)

Arguments

obj
a fitted GAMLSS model object from a "discrete" type of family
howmany
The number of QQ-plots required up to ten i.e. howmany=6
plot
whether to plot all plots all the residual realisations "all" or just the mean "average"
type
whether to plot worm plots "wp"or QQ plots "QQ" with default worm plots
...
for extra arguments

Value

  • If save it is TRUE then the vector of the median residuals is saved.

Details

For discrete family distributions, the gamlss() function saves on exit one realization of randomized quantile residuals which can be plotted using the generic function plot which calls the plot.gamlss. Looking at only one realization can be misleading, so the current function creates QQ-plots for several realizations. The function allows up to 10 QQ-plots to be plotted. Occasionally one wishes to create a lot of realizations and then take a median of them (separately for each ordered value) to create a single median realization. The option all in combinations with the option howmany creates a QQ-plot of the medians of the normalized randomized quantile residuals. These 'median' randomized quantile residuals can be saved using the option (save=TRUE).

References

Dunn, P. K. and Smyth, G. K. (1996) Randomised quantile residuals, J. Comput. Graph. Statist., 5, 236--244 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.

Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use the GAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (see also http://www.gamlss.org/).

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, http://www.jstatsoft.org/v23/i07.

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

See Also

plot.gamlss, gamlss

Examples

Run this code
data(aids) # fitting a model from a discrete distribution 
h<-gamlss(y~pb(x)+qrt, family=NBI, data=aids) # 
plot(h)
# plot qq- plots from 6 realization of the randomized quantile residuals
rqres.plot(h) 
# a qq-plot from the medians from 40 realizations
rqres.plot(h,howmany=40,plot="average") #

Run the code above in your browser using DataLab