Learn R Programming

gamlss.mx (version 4.3-1)

gamlssMX: Function to fit finite mixture of gamlss family distributions

Description

The function gamlssMX is design for fitting a K fold non parametric mixture of gamlss family distributions.

Usage

gamlssMX(formula = formula(data), pi.formula = ~1, 
         family = "NO", weights, K = 2, prob = NULL, 
         data = sys.parent(), control = MX.control(), 
         g.control = gamlss.control(trace = FALSE), 
         zero.component = FALSE,   ...)
gamlssMXfits(n = 5, formula = formula(data), pi.formula = ~1, 
         family = "NO", weights, K = 2, prob = NULL, 
         data = sys.parent(), control = MX.control(), 
         g.control = gamlss.control(trace = FALSE),
         zero.component = FALSE, ... )

Arguments

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. and Akantziliotou C. (2003) Instructions on how to use the GAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (see also http://www.gamlss.org/).

See Also

gamlss, gamlss.family

Examples

Run this code
library(MASS)
data(geyser)
# fitting 2 finite normal mixtures 
m1<-gamlssMX(waiting~1,data=geyser,family=NO, K=2)
#fitting 2 finite gamma mixtures 
m2<-gamlssMX(waiting~1,data=geyser,family=GA, K=2)
# fitting a model for pi
# first create a data frame
geyser1<-matrix(0,ncol=2, nrow=298)
geyser1[,1] <-geyser$waiting[-1]
geyser1[,2] <-geyser$duration[-299]
colnames(geyser1)<- c("waiting", "duration")
geyser1 <-data.frame(geyser1)
# get the best of 5 fits
m3<-gamlssMXfits(n=5, waiting~1, pi.formula=~duration, data=geyser1,family=NO, K=2)
m3

Run the code above in your browser using DataLab