gamlssMX | R Documentation |
The function gamlssMX
is design for fitting a K fold non parametric mixture of gamlss family distributions.
gamlssMX(formula = formula(data), pi.formula = ~1,
family = "NO", weights, K = 2, prob = NULL,
data, 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, control = MX.control(),
g.control = gamlss.control(trace = FALSE),
zero.component = FALSE, ... )
formula |
This argument it should be a formula (or a list of formulea of length
K) for modelling the |
pi.formula |
This should be a formula for modelling the prior probabilities as a
function of explanatory variables. Note that no smoothing of other
additive terms are allowed here only the usual linear terms. The
modelling here is done using the |
family |
This should be a |
weights |
prior weights if needed |
K |
the number of finite mixtures with default |
prob |
prior probabilities if required for starting values |
data |
the data frame nedded for the fit. Note that this is compulsory if |
control |
This argument sets the control parameters for the EM iterations algorithm.
The default setting are given in the |
g.control |
This argument can be used to pass to |
n |
the number of fits required in |
zero.component |
whether zero component models exist, default is |
... |
for extra arguments |
Mikis Stasinopoulos and Bob Rigby
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.
Rigby, R. A., Stasinopoulos, D. M., Heller, G. Z., and De Bastiani, F. (2019) Distributions for modeling location, scale, and shape: Using GAMLSS in R, Chapman and Hall/CRC. An older version can be found in https://www.gamlss.com/.
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, https://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.
Stasinopoulos M.D., Kneib T, Klein N, Mayr A, Heller GZ. (2024) Generalized Additive Models for Location, Scale and Shape: A Distributional Regression Approach, with Applications. Cambridge University Press.
(see also https://www.gamlss.com/).
gamlss
, gamlss.family
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.