rmixedMem: Simulate Mixed Membership Data

Description Usage Arguments Details Value

View source: R/rmixedMem.R


Simulate data from a mixed membership model.


rmixedMem(Total, J, Rj, Nijr, K, Vj, dist, theta, alpha, lambda = NULL)



the number of individuals in the sample.


the number of variables observed on each individual.


a vector of positive integers of length J specifying the number of repeated measurements for each variable.


an array of dimension (Total, J, max(Rj)) indicating the number of ranking levels for each replication. For multinomial and Bernoulli variables, Nijr[i,j,r] = 1. For rank variables, Nijr[i,j,r] indicates the number of items ranked for each individual.


the number of latent sub-populations.


a vector of length J specifying the number of possible candidates for each variable. For a Bernoulli variable Vj[j] = 1. For a multinomial or rank variable, Vj[j] is the number of possible categories/items.


a vector of strings of length J specifying variable types. Options are "bernoulli", "multinomial" or "rank" corresponing to the distributions of the observed variables.


an 3 way array of dimensions (J,K,max(Vj)) which governs the variable distributions. Parameter theta[j,k,] governs the distirbution of responses on variable j for an inidvidually completely in sub-population k. If the number of items/categories differs across variables, any unusued portions of theta should be set to 0.


a positive K-length vector which is the parameter for the Dirichlet distribution of membership scores.


an optional matrix of dimensions (Total, K) containing the membership scores for each individual. If the lambda argument is not specified, the group membership scores will be automatically sampled from a Dirichlet(alpha)


rmixedMem simulates data from a mixed membership model given the specified parameters and dimensions. The function returns a random sample of observations obs, context indicators Z, and group membership scores lambda.


rmixedMem returns a list containing a three items: A matrix of group memberships scores lambda, an array of context indicators Z and an array of observations obs.

mixedMem documentation built on Dec. 2, 2020, 1:09 a.m.