GetMAPLabels: Retrieve the MAP estimates for the component labels

Description Usage Arguments Value Author(s) See Also Examples

View source: R/postgen_ops.R

Description

The function returns the Maximum A Posteriori (MAP) estimates of the component labels (membership indicator variables) based on a damcmc_res object (output from est_mix_damcmc) or a bdmcmc_res object (output from est_mix_bdmcmc) for the chain corresponding to MAP number of components.

For examples see

http://faculty.missouri.edu/~micheasa/sppmix/sppmix_all_examples.html#GetMAPLabels

Usage

1

Arguments

fit

Object of class damcmc_res or bdmcmc_res.

Value

A vector with size equal to the number of points, containing the MAP estimators of the component labels (or membership indicator variables). This the most likely component we would classify a point in.

Author(s)

Jiaxun Chen

See Also

normmix, to_int_surf, rsppmix, est_mix_damcmc

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
truemix <- normmix(ps=c(.4, .2,.4), mus=list(c(0.3, 0.3), c(.5,.5),c(0.7, 0.7)),
 sigmas = list(.02*diag(2), .05*diag(2), .01*diag(2)))
intsurf=to_int_surf(truemix,lambda = 100, win = spatstat::square(1))
pp1 <- rsppmix(intsurf)
plot(pp1)
plot(pp1, mus = intsurf$mus)#plot the mixture means as well
#plot the points with different colors depending on the true component label
plot(pp1, colors = TRUE)
#plot the points with different colors depending on the estimated component label
fit <- est_mix_damcmc(pp1, 3)
est_comp <- GetMAPLabels(fit)
plot(pp1, estcomp = est_comp, colors = TRUE)
fitBD <- est_mix_bdmcmc(pp1, 5)
est_compBD <- GetMAPLabels(fitBD)
plot(pp1, estcomp = est_compBD, colors = TRUE)

sppmix documentation built on Jan. 13, 2021, 10:04 p.m.