distfit: Maximum-Likelihood Fitting of Parametric Distributions

Description Usage Arguments Details Value References See Also Examples

View source: R/distfit.R

Description

The function distfit carries out maximum-likelihood estimation of parameters for a specified distribution family, for example from the GAMLSS family (for generalized additive models for location, scale, and shape). The parameters can be transformed through link functions but do not depend on further covariates (i.e., are constant across observations).

Usage

1
2
3
distfit(y, family = NO(), weights = NULL, start = NULL, start.eta = NULL,
          vcov = TRUE, type.hessian =  c("checklist", "analytic", "numeric"),
          method = "L-BFGS-B", estfun = TRUE, optim.control = list(), ...)

Arguments

y

numeric vector of the response

family

specification of the response distribution. Either a gamlss.family object, a list generating function or a family list.

weights

optional numeric vector of case weights.

start

starting values for the distribution parameters handed over to optim

start.eta

starting values for the distribution parameters on the link scale handed over to optim.

vcov

logical. Specifies whether or not a variance-covariance matrix should be calculated and returned.

type.hessian

Can either be 'checklist', 'analytic' or 'numeric' to decide how the hessian matrix should be calculated in the fitting process in distfit. For 'checklist' it is checked whether a function 'hdist' is given in the family list. If so, 'type.hessian' is set to 'analytic', otherwise to 'numeric'.

method

Optimization which should be applied in optim

estfun

logical. Should the matrix of observation-wise score contributions (or empirical estimating functions) be returned?

optim.control

A list with optim control parameters.

...

further arguments passed to optim.

Details

The function distfit fits distributions, similar to fitdistr from MASS (Venables and Ripley 2002) but based on GAMLSS families (Stasinopoulos and Rigby 2007).

Provides analytical gradients and hessian, can be plugged into mob.

The resulting object of class distfit comes with a set of standard methods to generic functions including coef, estfun, vcov, predict and logLik.

Value

distfit returns an object of class distfit which is a list with the following components:

npar

number of parameter

y

numeric vector of the response

ny

number of observations

weights

numeric vector of case weights handed over as input argument

family

employed distribution family list of class disttree.family

start

used starting values in optim that were handed over as input argument

starteta

starting values on the link scale used in optim

opt

list returned by optim

converged

logical. TRUE if optim returns convergence = 0 and FALSE else.

par

fitted distribution parameters (on parameter scale)

eta

fitted distribution parameters (on link scale)

hess

hessian matrix

vcov

variance-covariance matrix

loglik

value of the maximized log-likelihood function

call

function call

estfun

matrix with the scores for the estimated parameters. Each line represents an observation and each column a parameter.

ddist

density function with the estimated distribution parameters already plugged in

pdist

probability function with the estimated distribution parameters already plugged in

qdist

quantile function with the estimated distribution parameters already plugged in

rdist

random number generating function with the estimated distribution parameters already plugged in

method

optimization method applied in optim

References

Stasinopoulos DM, Rigby RA (2007). Generalized Additive Models for Location Scale and Shape (GAMLSS) in R, Journal of Statistical Software, 23(7), 1-46. doi: 10.18637/jss.v023.i07

Venables WN, Ripley BD (2002). Modern Applied Statistics with S. 4th Edition. Springer-Verlag, New York.

See Also

gamlss.family, optim

Examples

1
2
3
4
5
6
## simulate artifical negative binomial data
set.seed(0)
y <- rnbinom(1000, size = 1, mu = 2)
  
## simple distfit
df <- distfit(y, family = NBI)

disttree documentation built on Aug. 14, 2019, 3 a.m.

Related to distfit in disttree...