centile_bucket: Centile bucket plot

View source: R/Bucket_plot.R

centile_bucketR Documentation

Centile bucket plot

Description

A bucket plot is a graphical way to check the skewness and kurtosis of a continuous variable or the residuals of a fitted GAMLSS model. It plots the centile skewness (tail or central) and transformed centile kurtosis of the variable (or residuals) together with a cloud of points obtained using a non-parametric bootstrap from the original variable (or residuals). It also provides a graphical way of performing a Monte Carlo simulation test on whether the centile skewness and transformed centile kurtosis of the variable of interest are simultaneously equal to zero.

There are two function here:

i) cenlile_bucket() for a single bucket plot. Note that model_cent_bucket() and centile_bucket() are synonymous.

ii) centile_bucket_wrap() for multiple bucket plots cut according to terms in the model.

Usage

centile_bucket(x, ..., type = c("tail", "central"), weights = NULL, 
       no_bootstrap = 99, col_bootstrap = hcl.colors(length.obj, 
       palette = "Set 2"), alpha_bootstrap = 1, text_to_show = NULL, 
       cex_text = 5, col_text = "black", colour_bucket = FALSE, 
       line_width = 0.5, sim_test = FALSE, no_sim_test = 1000, 
       col_sim_test = gray(0.7), alpha_sim_test = 0.1, seed_test = 1234)

model_cent_bucket(x, ..., type = c("tail", "central"), weights = NULL, 
       no_bootstrap = 99, col_bootstrap = hcl.colors(length.obj, 
       palette = "Set 2"), alpha_bootstrap = 1, text_to_show = NULL, 
       cex_text = 5, col_text = "black", colour_bucket = FALSE, 
       line_width = 0.5, sim_test = FALSE, no_sim_test = 1000, 
       col_sim_test = gray(0.7), alpha_sim_test = 0.1, seed_test = 1234)


centile_bucket_wrap(x, ..., type = c("tail", "central"), weights = NULL, 
      xvar = NULL, n_inter = 4, no_bootstrap = 99, 
      col_bootstrap = hcl.colors(length.obj, palette = "Set 2"), 
      alpha_bootstrap = 1, text_to_show = NULL, check_overlap_text = FALSE, 
      cex_text = 5, col_text = "black", colour_bucket = FALSE, 
      line_width = 0.5, sim_test = FALSE, no_sim_test = 1000, 
      col_sim_test = gray(0.7), alpha_sim_test = 0.1, seed_test = 1234)       
       

Arguments

x

x should be a continuous vector of a GAMLSS fitted model.

...

for more that one continuous vectors or fitted models

type

whether "tail" of "central" skewness and kurtosis

weights

if priors weights are needed

no_bootstrap

the number of bootstrap samples for the cloud around the point of skewness and kurtosis.

col_bootstrap

The colour of the bootstrap samples

alpha_bootstrap

The transparency parameter of the bootstrap samples.

text_to_show

what text to show in the plots, default the names of vectors or models

cex_text

the character size of the text

col_text

the colour of the text

colour_bucket

whether colour or gray lines in the bucket

line_width

the line width

sim_test

whether to Monde Carlo simulation is needed to check the null hypothesis that there is no centile skewness and transformed centile kurtosis in the sample.

no_sim_test

The number of simulation for the test

col_sim_test

the colour used for displaying the Monde Carlo test values

alpha_sim_test

The transparency parameter of the Monde Carlo samples.

seed_test

A seed value for the Monde Carlo simulation.

xvar

the x term

n_inter

how many intervals needed

check_overlap_text

whether to check overlapping text

Details

More details about centile bucket plots is given in De Bastiani et al. (2022)

Value

A plot displaying the centile skewness and transformed centile kurtosis of the sample or residual of a model.

Note

The bucket plot provides an additional residual diagnostic tool that can be used for fitted model checking, alongside other diagnostic tools, for example worm plots, and Q (and Z) statistics.

Author(s)

Mikis Stasinopoulos, Bob Rigby and Fernanda De Bastiani

References

De Bastiani, F., Stasinopoulos, D. M., Rigby, R. A., Heller, G. Z., and Lucas A. (2022) Bucket Plot: A Visual Tool for Skewness and Kurtosis Comparisons. To be published.

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. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1201/9780429298547")} 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, \Sexpr[results=rd]{tools:::Rd_expr_doi("10.18637/jss.v023.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. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1201/b21973")}

Stasinopoulos, M. D., Rigby, R. A., and De Bastiani F., (2018) GAMLSS: a distributional regression approach, Statistical Modelling, Vol. 18, pp, 248-273, SAGE Publications Sage India: New Delhi, India.

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, Q.stats

Examples

m1 <- gamlss(R~pb(Fl)+pb(A), data=rent, family=GA)
centile_bucket(m1)

centile_bucket_wrap(m1, xvar=rent$A)


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