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 transformed moment skewness and transformed moment 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 the Jarque-Bera test (JarqueandBera,1980).
There are two function here:
i) moment_bucket()
for a single bucket plot. Note that model_mom_bucket()
and moment_bucket()
are synonymous.
ii) moment_bucket_wrap()
for multiple bucket plots cut according to terms in the model.
moment_bucket(x, ..., 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, col_JB_test = gray(.7), alpha_JB_test = .1)
model_mom_bucket(x, ..., 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, col_JB_test = gray(.7), alpha_JB_test = .1)
moment_bucket_wrap(x, ..., 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,
col_JB_test = gray(.7), alpha_JB_test = .1)
A plot displaying the transformed moment skewness and transformed moment kurtosis of the sample or residual of a model.
x should be a continuous vector of a GAMLSS fitted model.
this for more that one continuous vectors or fitted models
if priors weights are needed
the number of bootstrap samples for the cloud around the point of skewness and kurtosis.
The colour of the bootstrap samples
The transparency parameter of the bootstrap samples.
what text to show in the plots, default the names of vectors ot models
the character size of the text
the colour of the text
whether colour or gray lines in the bucket
the line width
the x term
how many intervals needed
whether to check overlapping text
the colour for the Jarque-Bera test
the transparency constant for the Jarque-Bera test
Mikis Stasinopoulos, Bob Rigby and Fernanda De Bastiani
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. 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, 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. 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/).
wp, Q.stats
m1 <- gamlss(R~pb(Fl)+pb(A), data=rent, family=GA)
moment_bucket(m1)
moment_bucket_wrap(m1, xvar=rent$A)
Run the code above in your browser using DataLab