BMMmodel {bayesmix} | R Documentation |
Creates the text for the BUGS-model specification and the values of the initialization, prior specification and the observations read in by jags.
BMMmodel(y, k, priors, inits = "initsFS", aprioriWeights = 1, no.empty.classes = FALSE, restrict = "none", ...)
y |
a numeric vector. |
k |
integer indicating the number of segments. |
priors |
specification of priors by a named list or a
BMMpriors object. |
inits |
specification of initial values by a named list or string indicating the function to be called. |
aprioriWeights |
specification of prior of the a-priori weights. If
aprioriWeights does not have length = k, there is an equal
prior for the a-priori weights assumed. |
no.empty.classes |
logical: should it be prevented that empty classes arise during sampling. |
restrict |
one of "none", "mu", "tau". |
... |
further parameters for the function specified in
inits . |
By default the function initsFS
is called for generating
initial values. Any other function specified by inits
is
assumed to have at least x
, k
and restrict
as
input parameters.
The parameter restrict
indicates if a
location-shift model ("tau"), a scale contaminated model
("mu") or a model where both variables vary over components shall
be fitted.
If the logical no.empty.classes
is TRUE
there
are observations added to the model that the classes are not empty. This
signifies that the likelihood when sampling the class affiliations is
changed thus that any data point which is sampled and is the last one
in its class stays there.
If y
is specified there is an object of class BMMmodel
returned with components:
inits |
named list for -inits.R-file. |
data |
named list for -data.R-file. |
bugs |
text for .bug-file with prefix missing. |
If y
is missing there is an object of class BMMsetup
returned containing the parameter specifications. When JAGSsetup
is called with this object as model argument, BMMmodel
is
called with y
and the other parameters as input arguments
before creating the input files for jags.
Bettina Gruen
data(fish) model <- BMMmodel(fish, k = 4, priors = list(kind = "independence", parameter = "priorsFish", hierarchical = "tau"), initialValues = list(S0 = 2)) model