Find and Fit GAMLSS Families

Description

These functions provide useful infrastructures for finding suitable GAMLSS families for a response variable.

Usage

## list of available families from gamlss.dist package
available_families(type = c("continuous", "discrete"), families = NULL, ...)

## find suitable response distribution
find_family(y, families = NULL, k = 2, verbose = TRUE, ...)

## fit distribution parameters
fit_family(y, family = NO, plot = TRUE, ...)

## find gamlss2 model
find_gamlss2(formula, families = NULL, k = 2,
  select = FALSE, verbose = TRUE, ...)

Arguments

type Character, is the response continuous or discrete?
families Character, the names of the family objects of the gamlss.dist package that should be returned.
y The response vector or matrix.
k Numeric, the penalty factor that should be used for the GAIC.
verbose Logical, should runtime information be printed?
family A family object that should be used for estimation, see also gamlss2.family.
plot Logical, should a plot of the fitted density be provided?
formula A model formula, see gamlss2.
select Logical, if set to select = TRUE, model term selection is enforced using model fitting function select_gamlss2.
For function available_families(), arguments passed to the family objects, e.g., for setting link functions mu.link = “log”. Further arguments to be passed to gamlss2 when using find_family(), or arguments legend = TRUE/FALSE, pos = “topright” (see also function legend), main, xlab and ylab when argument plot = TRUE using function fit_family(). For function find_gamlss2(), arguments are passed to available_families() and gamlss2.

Details

The function find_family() employs gamlss2 to estimate intercept-only models for each specified family object in the families argument. Note that model estimation occurs within a try block with warnings suppressed. Additionally, the function calculates the GAIC for each family whenever feasible and returns the values sorted in ascending order of the selected fit criterion, so smaller values indicate a better fit.

Function fit_family() fits a single intercept-only model using the specified family and creates a plot of the fitted density.

Value

Function find_family() returns a vector of GAIC values for the different fitted families. Function fit_family() returns the fitted intercept-only model.

See Also

gamlss2.

Examples

library("gamlss2")


data("rent", package = "gamlss.data")

## find a suitable response to the response
ic <- find_family(rent$R)
print(ic)

## fit parameters using the BCCG family
fit_family(rent$R, family = BCCG)

## count data
data("polio", package = "gamlss.data")

## search best count model
ic <- find_family(polio, k = 0,
  families = available_families(type = "discrete"))
print(ic)

## fit parameters using the ZAPIG family
fit_family(polio, family = ZAPIG)

## search complete model
## m <- find_gamlss2(R ~ s(Fl) + s(A) | . | . | ., data = rent,
##   select = TRUE, mu.link = "log")