simu.olbm: Simulate OLBM data

Description Usage Arguments Value References Examples

View source: R/MainCode.R

Description

It simulates an ordinal data matrix according to OLBM.

Usage

1
simu.olbm(M, P, Pi, rho, delta, mu, sd, thresh)

Arguments

M

The number of rows of the ordinal matrix Y.

P

The number of columns of the ordinal matrix Y.

Pi

A Q x L connectivity matrix to manage missing data (coded az zeros in Y).

rho

A vector of length Q, containing multinomial probabilities for row cluster assignments.

delta

A vector of length L, containing multinomial probabilities for column cluster assignments.

mu

A Q x L matrix containing the means of the latent Gaussian distributions.

sd

A Q x L matrix containing the standard deviations of the latent Gaussian distributions.

thresh

A K+1 vector containing the sorted tresholds used to simulate the ordinal entries in Y, where K is the number of ordinal modalities. The first entry in tresh must be -Inf, the last entry +Inf.

Value

It returns a list containing:

Y

An M x P matrix. The observed ordinal entries are integers between 1 and K. Missing data are coded as zeros.

Rclus

A vector of length M containing the row cluster memberships.

Cclus

A vector of length P containing the column cluster memberships.

References

Corneli M.,Bouveyron C. and Latouche P. (2019) Co-Clustering of ordinal data via latent continuous random variables and a classification EM algorithm. (https://hal.archives-ouvertes.fr/hal-01978174)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
M <- 150                                    
P <- 100 
Q <- 3
L <- 2

## connectivity matrix
Pi <- matrix(.7, nrow = Q, ncol = L)
Pi[1,1] <- Pi[2,2] <- Pi[3,2] <- .5

## cluster memberships proportions
rho <- c(1/3, 1/3 ,1/3)
delta <- c(1/2, 1/2)

# Thresholds
thresh <- c(-Inf, 2.37, 2.67, 3.18, 4.33, Inf)     # K = 5

## Gaussian parameters
mu <- matrix(c(0, 3.4, 2.6, 0, 2.6, 3.4), nrow = Q, ncol = L)   
sd <- matrix(c(1.2,1.4,1.0,1.2,1.4,1.0), nrow = Q, ncol = L)

## Data simulation
dat <- simu.olbm(M, P, Pi, rho, delta, mu, sd, thresh)

ordinalLBM documentation built on May 2, 2019, 11:04 a.m.