rmixedMem: Simulate Data from a discrete mixed membership model

Description Usage Arguments Details Value

Description

Simulate Data from a discrete mixed membership model

Usage

1
2
rmixedMem(Total, J, Rj = rep(1, J), Nijr = array(1, dim = c(Total, J,
  max(Rj))), K, Vj, dist, theta, alpha, lambda = NULL)

Arguments

Total

the number of individuals in the sample.

J

the number of variables observed on each individual.

Rj

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

Nijr

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.

K

the number of latent sub-populations.

Vj

a vector of length J specifying the number of possible categories 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.

dist

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

theta

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. @param lambda 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)

alpha

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

Details

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.

Value

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.


ysamwang/mixedMem documentation built on May 4, 2019, 5:33 p.m.