alldist()
and allvc
of the npmlreg
package of
Jochen Einbeck, John Hinde and Ross Darnell.gamlssNP(formula, random = ~1, family = NO(), data = NULL, K = 4,
mixture = c("np", "gq"),
tol = 0.5, weights, pluginz, control = NP.control(...),
g.control = gamlss.control(trace = FALSE), ...)
gamlssNP
produces an object of class "gamlssNP".
This object contain several components.gamlssNP()
is a modification of the R functions
alldist()
and allvc
created by Jochen Einbeck and John Hinde.
Both functions were originally created by Ross Darnell (2002). Here the two
functions are merged to one gamlssNP
and allows finite mixture from
gamlss family of distributions.
The following are comments from the original Einbeck and Hinde
documentation.
"The nonparametric maximum likelihood (NPML) approach was
introduced in Aitkin (1996) as a tool to fit overdispersed
generalized linear models. Aitkin (1999) extended this method to
generalized linear models with shared random effects arising through
variance component or repeated measures structure. Applications are
two-stage sample designs, when firstly the primary sampling units
(the upper-level units, e.g. classes) and then the secondary
sampling units (lower-level units, e.g. students) are selected, or
longitudinal data.
Models of this type have also been referred to as
multi-level models (Goldstein, 2003). This R function is restricted
to 2-level models. The idea of NPML is to approximate the unknown
and unspecified distribution of the random effect by a discrete
mixture of k exponential family densities, leading to a simple
expression of the marginal likelihood, which can then be maximized
using a standard EM algorithm. When option 'gq' is set, then
Gauss-Hermite masses and mass points are used and considered as
fixed, otherwise they serve as starting points for the EM algorithm.
The position of the starting points can be concentrated or extended
by setting tol smaller or larger than one, respectively. Variance
component models with random coefficients (Aitkin, Hinde & Francis,
2005, p. 491) are also possible, in this case the option
random.distribution is restricted to the setting 'np' . The weights
have to be understood as frequency weights, i.e. setting all weights
equal to 2 will duplicate each data point and hence double the
disparity and deviance. Warning: There might be some options and
circumstances which had not been tested and where the weights do not
work."
Note that in keeping with the gamlss notation disparity is called global deviance.gamlss
, gamlss.family
data(enzyme)
# equivalent model using gamlssNP
mmNP1 <- gamlssNP(act~1, data=enzyme, random=~1,family=NO, K=2)
mmNP2 <- gamlssNP(act~1, data=enzyme, random=~1, sigma.fo=~MASS, family=NO, K=2)
AIC(mmNP1, mmNP2)
Run the code above in your browser using DataLab