Learn R Programming

gamlss (version 5.0-5)

fitDist: Fits Different Parametric gamlss.family distributions to data

Description

This function is using the function gamlssML() to fit all relevant parametric gamlss.family distributions to a data vector. The final model is the one which is selected by the generalised Akaike information criterion with penalty k.

Usage

fitDist(y, k = 2, 
      type = c("realAll", "realline", "realplus", "real0to1", "counts", "binom"), 
      try.gamlss = FALSE, extra = NULL, data = NULL, ...)

Arguments

y

the data vector

k

the penalty for the GAIC with default values k=2 the standard AIC

type

the type of distribution to be tried see details

try.gamlss

if gamlssML() failed whether should try gamlss instead. This will slow up things for big data.

extra

whether extra distribution should be tried which are not in the type list

data

the data frame where y ca be found

for extra arguments to be passed to gamlssML() to gamlss()

Value

A gamlssML object with two extra components:

fits

an ordered list according to the GAIC of the fitted distribution

failed

the distributions where the gamlssML)() (or gamlss()) fits have failed

Details

The following are the different type argument:

  • realAll all the gamlss.family continuous distributions defined on the real line, i.e. realline plus realplus

  • reallinethe gamlss.family continuous distributions : "GU", "RG" ,"LO", "NET", "TF", "PE", "SN1", "SN2", "SHASH", "EGB2", "JSU", "SEP1", "SEP2", "SEP3", "SEP4","ST1", "ST2", "ST3", "ST4", "ST5", "GT"

  • realplus the gamlss.family continuous distributions in the positive leal line: "EXP","GA","IG","LNO", "WEI3", "BCCGo", "exGAUS", "GG", "GIG", "BCTo", "BCPEo"

  • real0to1the gamlss.family continuous distributions from 0 to 1: "BE", "BEINF", "BEINF0", "BEINF1", "BEOI", "BEZI", "GB1"

  • countsthe gamlss.family distributions for counts: "PO", "LG", "NBI", "NBII", "PIG", "DEL", "SI", "ZIP", "ZAP", "ZALG", "ZANBI", "ZIP2", "ZIPIG"

  • binomthe gamlss.family distributions for binomial type data :"BI", "BB", "ZIBI", "ZIBB", "ZABI", "ZABB"

References

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

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.

(see also http://www.gamlss.org/).

See Also

gamlss,gamlssML

Examples

Run this code
# NOT RUN {
y <- rt(100, df=1)
m1<-fitDist(y, type="realline")
m1$fits
m1$failed
# an example of using  extra
# }
# NOT RUN {
library(gamlss.tr)
data(tensile)
gen.trun(par=1,family="GA", type="right")
gen.trun(par=1,"LOGNO", type="right")
gen.trun(par=c(0,1),"TF", type="both")
ma<-fitDist(str, type="real0to1", extra=c("GAtr", "LOGNOtr", "TFtr"), data=tensile)
# }

Run the code above in your browser using DataLab