GenerateData: Generate random dataset

Description Usage Arguments Value Examples

View source: R/GenerateData.R

Description

This function is used to generate random datasets following mixture of product multinomial distribution

Usage

1
2
3
4
5
6
7
8
GenerateData(
  n,
  p,
  d,
  k = 3,
  theta = rdirichlet(1, rep(10, k)),
  psi = InitialPsi(p, d, k)
)

Arguments

n

- number of samples

p

- number of variables

d

- a vector which denotes the number of categories for each variable. It could be distinct among variables.

k

- number of latent classes

theta

- probability for latent class

psi

- probability for specific category

Value

data - generated random dataset, a matrix with n rows and p columns.

Examples

1
2
3
4
# dimension parameters
n<-200; p<-5; d<-rep(2,p);
# generate complete data
Complete<-GenerateData(n, p, d, k = 3)

Example output

Loading required package: DirichletReg
Loading required package: Formula
Loading required package: rgl
Warning messages:
1: In rgl.init(initValue, onlyNULL) : RGL: unable to open X11 display
2: 'rgl_init' failed, running with rgl.useNULL = TRUE 
3: .onUnload failed in unloadNamespace() for 'rgl', details:
  call: fun(...)
  error: object 'rgl_quit' not found 

MMDai documentation built on May 2, 2020, 9:05 a.m.

Related to GenerateData in MMDai...