multinom_EM | R Documentation |
An EM algorithm to fit a multinomial with maximum likelihood
multinom_EM( X, simMM, min_iter = 10, max_iter = 1000, logLik_threshold = 0.01, verbose = TRUE )
X |
A vector of commopent sizes |
simMM |
A matrix of floats (n_cluster, n_cluster) for the similarity matrix between clusters. simMM[i,j] means the proportion of cluster i will be assigned to cluster j, hence colSums(simMM) are ones. |
min_iter |
integer(1). number of minimum iterations |
max_iter |
integer(1). number of maximum iterations |
logLik_threshold |
A float. The threshold of logLikelihood increase for detecting convergence |
verbose |
A logic. Whether to print the iteration times and log likelihood. |
a list containing mu
, a vector for estimated latent proportion
of each cluster, logLik
, a float for the estimated log likelihood,
simMM
, the input of simMM, codeX, the input of X, X_prop
,
the proportion of clusters in the input X, predict_X_prop
, and the
predicted proportion of clusters based on mu and simMM.
X = c(100, 300, 1500, 500, 1000) simMM = create_simMat(5, confuse_rate=0.2) multinom_EM(X, simMM)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.