cwm(formulaY, familyY=gaussian, data,link, Xnorm=NULL, modelXnorm=NULL, Xbin=NULL,
Xbtrials=NULL, Xpois=NULL, Xmult=NULL, k=1:3, initialization=c("random.soft",
"random.hard", "kmeans", "mclust", "manual"), start.z=NULL, seed=NULL, maxR=1,
iter.max=1000, threshold=1.0e-04, parallel=FALSE)
ICget(object, criteria)
bestmodel(object, criteria, k=NULL, modelXnorm=NULL)
modelget(object, criteria="BIC", k=NULL, modelXnorm=NULL)
## S3 method for class 'cwm':
summary(object, criteria="BIC", k=NULL, modelXnorm=NULL, concomitant=FALSE,
digits = getOption("digits")-2, ...)
formula
" (or one that can be coerced to that class): a symbolic description of the model to be fitted."gaussian"
with default"link=identity"
"poisson"
with default"link=log"
"binomial"
with defaudata.frame
, list
, or environment
with the variables link
argument in family
.c("E", "V")
for a single continuous covariate, and c("EII", "VII", "EEI", "VEI", "EVI", "VVI", "EEE", "VEE", "EVE", "EEV", "VVE", "
Xbin
. If omitted, the maximum of each column in Xbin
is chosen."random.soft"
"random.hard"
"kmeans"
"mclust"
"manual"<
initialization="manual"
.NULL
, current seed is not changed. Default value is NULL
.TRUE
, the package parallel
is used for parallel computation. When several models are estimated, computational time is reduced. The number of cores to use may be scwm
object.TRUE
, concomitant variables parameters are displayed. Default is FALSE
"AIC", "AICc", "AICu", "AIC3", "AWE", "BIC", "CAIC", "ICL".
Default value is "BIC"
.cwm
object, which is a list of values related to the model selected. It contains:call
.formula
containing a symbolic description of the model fitted.data.frame
with the variables needed to use formulaY
.Xnorm
, Xbin
, Xpois
, Xmult
.Xbtrials
Xbin
.posterior
iter
k
size
cluster
loglik
df
prior
IC
converged
TRUE
if EM algorithm converged}GLModels
model
glm
" class object.}sigma
familyY
is gaussian
or t
}t_df
familyY
is t
}nuY
familyY
is Gamma
. The gamma distribution is parameterized according to McCullagh, P. and Nelder, J. 1989, p. 30}concomitant
{a list with estimated concomitant variables parameters for each mixture component}normal.mu
normal.Sigma
normal.model
multinomial.model
multinomial.probs
poisson.lambda
binomial.p
normal.dnorm, multinomial.dmulti, poisson.dpois, binomial.dbin
Xbin
bestmodel
, summary
and print
consider the models with the best information criteria in criteria
, among those with k
groups and modelXnorm
parsimonious model. If criteria
is missing, the model with best BIC is returned.
The modelget
method returns a cwm
object containing the best model according to a single criterion in .flexCWM-package
, tourism
data("students")
str(students)
attach(students)
# mixture of Gaussian distributions
res <- cwm(Xnorm=HEIGHT, k=1:3, initialization="kmeans")
summary(res)
plot(res)
# mixture of Gaussian regressions
res2 <- cwm(HEIGHT ~ HEIGHT.F, k=1:3, initialization="mclust")
summary(res2)
plot(res2)
Run the code above in your browser using DataLab