Fit the mixture variants of the Poisson lognormal with a variational algorithm. Use the (g)lm syntax for model specification (covariates, offsets).
Usage
PLNmixture(formula, data, subset, clusters = 1:5, control = PLNmixture_param())Arguments
- formula
an object of class "formula": a symbolic description of the model to be fitted.
- data
an optional data frame, list or environment (or object coercible by as.data.frame to a data frame) containing the variables in the model. If not found in data, the variables are taken from environment(formula), typically the environment from which the model is called.
- subset
an optional vector specifying a subset of observations to be used in the fitting process.
- clusters
a vector of integer containing the successive number of clusters (or components) to be considered
- control
a list-like structure for controlling the optimization, with default generated by
PLNmixture_param(). See the associated documentation for details.
Value
an R6 object with class PLNmixturefamily, which contains
a collection of models with class PLNmixturefit
See also
The classes PLNmixturefamily, PLNmixturefit and PLNmixture_param()
Examples
## Use parallel to dispatch the computations on 2 workers
if (FALSE) { # \dontrun{
options(mc.cores = 2)
} # }
data(trichoptera)
trichoptera <- prepare_data(trichoptera$Abundance, trichoptera$Covariate)
myMixtures <- PLNmixture(Abundance ~ 1 + offset(log(Offset)), clusters = 1:4, data = trichoptera,
control = PLNmixture_param(smoothing = 'none'))
#>
#> Initialization...
#>
#> Adjusting 4 PLN mixture models.
#> number of cluster = 1
number of cluster = 2
number of cluster = 3
number of cluster = 4
#> Post-treatments
#> DONE!
if (FALSE) { # \dontrun{
options(mc.cores = 1)
} # }
