Description Usage Arguments Details Value See Also Examples
findLabels
finds the optimal permutation of labels that minimizes
the weighted squared difference between the arrays of subpopulation parameters from a fitted mixed membership
model, θ and a given comparison model.
1  findLabels(model, comparison, exhaustive = TRUE)

model 
the fitted 
comparison 
an array of the same dimensions as model$theta which contains the subpopulation parameters from another model.

exhaustive 
a boolean for whether an exhaustive search should be performed. If false, a greedy algorithim is used instead. 
Mixed Membership models are invariant to permutations of the subpopulation labels; swapping the names of each subpopulation yields an equivalent model.
The ordering of the labels in a fitted model is dependent on the initialization points of the variational EM algorithim. The function findLabels
selects a
permutation of the subpopulation labels that best matches a given comparison model by minimizing the weighted squared difference between the
θ arrays. The weights are determined by the relative frequencies of each group.
Loss = ∑_j ∑_k α_k/α_0 [∑_v (\hatθ_{k,v}  θ_{k,v})^2] where α_0 = ∑_k α_k
If K, number of subpopulations, is small, the method searches through all K! permutations of the subpopulation labels and select the permutation which minimizes the loss. If K is large, a greedy algorithim can be used instead. This algorithm selects the best match for each fitted subpopulation starting with the group with the largest fitted relative frequency.
findLabels
returns a list with two objects: perm
and loss
. perm
is the optimal permutation of the labels with respect to the squared error loss.
loss
is the calculated value of the weighted squared error loss (shown above) for the optimal permutation.
permuteLabels
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18  ## Not run:
# See mixedMemModel documentation for how to generate data and instantiate a mixedMemModel object
# After the data as been generated, we initialize the array of subpopulation parameters (theta)
# according to a permutation of the true labeling
set.seed(123)
perm = sample.int(K, size = K, replace = FALSE)
theta1 = theta_truth[,perm,]
test_model < mixedMemModel(Total = Total, J = J,Rj = Rj, Nijr= Nijr, K = K, Vj = Vj,dist = dist,
obs = obs, alpha = alpha, theta = theta1)
out < mmVarFit(test_model)
opt.perm < findLabels(out, theta_truth)
opt.perm
# produce mixedMemModel object with subpopulation labels permuted to best match
# the comparison model
out = permuteLabels(out, opt.perm$perm)
## End(Not run)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.