model_GAIC: Plotting GAIC for GAMLSS models

View source: R/model_GAIC.R

model_GAICR Documentation

Plotting GAIC for GAMLSS models

Description

The function model_GAIC() is similar to the function GAIC.scaled() of the package gamlss. It produces, [for a given set of different fitted models or for a table produced by chooseDist()], the scaled Akaike values (see Burnham and Anderson (2002) section 2.9 for a similar concept of the GAIC weights. The plot of the GAIC's should not be interpreted as posterior probabilities of models given the data but can be used for model selection purpose since they produce a scaled ranking of the model using their relative importance i.e. from the worst to the best model.

The function model_GAIC_lollipop() is almost identical to model_GAIC() but the result is a lollipop plot.

Usage

model_GAIC(object, ..., k = 2, c = FALSE, plot = TRUE, 
       which = 1, diff.dev = 1000, text.to.show = NULL, 
       col = "rosybrown", width = 0.9, horiz = TRUE,
       scale = c("[0,1]","[max,min]"), title)

model_GAIC_lollipop(object, ..., k = 2, c = FALSE, plot = TRUE, 
         which = 1, diff.dev = 1000, text.to.show = NULL, 
         col = "skyblue", col.point = "blue", pch.point = 19, 
         width = 0.9, horiz = TRUE, 
         scale = c("[0,1]", "[max,min]"), order.val = TRUE, title)  

Arguments

object

a set of gamlss fitted model(s) or a matrix table produced by chooseDist().

...

it allows several GAMLSS object to be compared using a GAIC

k

the penalty with default k=2

c

whether the corrected AIC, i.e. AICc, should be used, note that it applies only when k=2

plot

whether to plot with default equal TRUE

which

which column of GAIC table to plot

diff.dev

this argument applies only a matrix table produced by chooseDist() and prevents models with a difference in deviance greater than diff.dev from the ‘best’ model to be considered (or plotted).

text.to.show

if NULL, model_GAIC() shows the model names otherwise the character in this list (the length of which should be equal to the length of models)

col

The colour of the bars (or lines. in the lollipop)

col.point

The colour of the points in the lollipop

pch.point

The points character in the lollipop

width

the width of the bars

horiz

whether to plot the bars horizontally (default) or vertically

scale

the scale of the plot, "[0,1]" plots the AIC's from the worst to the best models in a scale from [0,1]. "[max,min]" plots the AIC's from the worst model to the best model but in the original scale of the AIC's

title

if different title is needed

order.val

whether to order the models from the best to the worst

Details

The option allow the AIC to be plotted from worst to best on a [0,1] scale using the formula i.e. (AIC_w-AIC_m)/(AIC_w-AIC_b)) where the AIC_w and AIC_b are the worst and best AIC, respectively, and AIC_m is the AIC of the current model. If the option scale is set to[max,min] the difference (AIC_w-AIC_m) is plotted.

Value

It returns a bar plot using package ggplot2.

Author(s)

Mikis Stasinopoulos, Bob Rigby and Fernanda De Bastiani

References

Burnham K. P. and Anderson D. R (2002). Model Selection and Multimodel Inference A Practical Information-Theoretic Approach, Second Edition, Springer-Verlag New York, Inc.

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. 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

GAIC.scaled

Examples

data(abdom)
m1 <- gamlss(y~x, family=NO, data=abdom)
m2 <- gamlss(y~x, sigma.fo=~x, family=NO, data=abdom)
m3 <- gamlss(y~pb(x), sigma.fo=~x, family=NO, data=abdom)
m4 <- gamlss(y~pb(x), sigma.fo=~pb(x), family=NO, data=abdom)

model_GAIC(m1,m2, m3, m4)

MT <- chooseDist(m3)
model_GAIC(MT)
model_GAIC(MT, which=2)
model_GAIC_lollipop(m1,m2, m3, m4)

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