npEM
algorithm, for mixtures
of multivariate data where the coordinates of a row (case)
in the data matrix are assumed to be made of independent but multivariate blocks (instead of just coordinates),
conditional on the mixture
component (subpopulation) from which they are drawn (Chauveau and Hoang 2015).
mvnpEM(x, mu0, blockid = 1:ncol(x), samebw = TRUE, bwdefault = apply(x,2,bw.nrd0), init = NULL, eps = 1e-8, maxiter = 500, verb = TRUE)
x
) that are in the same block. The default has all distinct elements,
indicating that the model has $r$ blocks of dimension 1, in which case the model is handled
directly by the npEM
algorithm.
See example below for actual multivariate blocks example.TRUE
, use the same bandwidth per coordinate for
all iteration and all components. If FALSE
,
use a separate bandwidth for each component and coordinate, and update
this bandwidth at each iteration of the algorithm using a suitably
modified bw.nrd0
method as described in
Benaglia et al (2011) and Chauveau and Hoang (2015).bw.nrd0
for each coordinate (column) of the data.NULL
,
a kmeans
clustering with mu0
initial centers is applied to the data and the
initial matrix of posteriors is built from the result.lambda
vector (of mixing proportion estimates) does not exceed
eps
.maxiter
iterations (see eps
above).mvnpEM
returns a list of class mvnpEM
with the following items:
blockid
input argument. Needed by any method that produces density
estimates from the output, like plot.mvnpEM
.samebw
input argument.
Needed by any method that produces density estimates from the output, like plot.mvnpEM
.samebw
input argument. If samebw = TRUE
, a
vectors with the bandwidth value for each of the r
coordinates (same for all components and iterations).
If samebw = FALSE
, a $m x r$ matrix, where each row is associated to one component
and gives the $r$ bandwidth values, one for each coordinate.
Needed by any method that produces density estimates from the output, like plot.mvnpEM
.
plot.mvnpEM
, npEM
# Example as in Chauveau and Hoang (2015) with 6 coordinates
## Not run:
# m=2; r=6; blockid <-c(1,1,2,2,3,3) # 3 bivariate blocks
# # generate some data x ...
# a <- mvnpEM(x, mu0=2, blockid, samebw=F) # adaptive bandwidth
# plot(a) # this S3 method produces 6 plots of univariate marginals
# summary(a)## End(Not run)
Run the code above in your browser using DataLab