Description Usage Arguments Details Value Author(s) See Also Examples
MAP
obtains maximum a posteriori (MAP) classifications. unMAP
converts a classification vector into an indicator matrix.
1 2 |
mat |
An N \times G matrix, typically N denotes observations from a dataset and G denotes the number of underlying groups in the data. Each row is expected to contain positive entries which sum to 1, but this isn't strictly necessary. |
tie |
May take one of two values, |
vec |
An vector consisting of integer entries. |
For each row in mat
, MAP
assigns an indexing value identifying the entry in the row taking the highest value. In the case where multiple values in a row share a common largest value, tie
determines how such a value is chosen. If tie = "random"
, one of the suitable values is chosen at random; when tie = "standard"
, the first such suitable value is selected, in common with other packages. Defaults to "random"
.
MAP
returns a classification vector. unMAP
returns a classification matrix, with each row indicating group membership by the column entry which is non-zero (and equal to one).
Arthur White
1 2 3 4 5 6 7 8 9 10 11 12 13 | ##Simple example
s1<- sample(1:2, 10, replace=TRUE)
unMAP(s1)
MAP(unMAP(s1))
##More to the point
data(Alzheimer)
fit<- blca.em(Alzheimer, 2)
MAP(fit$Z) ## Best estimates of group membership.
mat1<- matrix(1/3, nrow=10, ncol=3) ##demonstrating the use of "tie" argument
MAP(mat1, tie="random")
MAP(mat1, tie="standard")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.