rlca: Generate data from lca model

View source: R/tools_generator.R

rlcaR Documentation

Generate data from lca model

Description

rlca returns a data.frame with factor sampled from an lca model

Usage

rlca(N, pi, theta)

Arguments

N

The size of the graph to generate

pi

A numeric vector of length K with clusters proportions (will be normalized to sum up to 1).

theta

A list of size V

Details

This function takes the desired graph size, cluster proportions and connectivity matrix as input and sample a graph accordingly together with the clusters labels.

Value

A list with fields:

  • x: the multi-graph adjacency matrix as an array

  • K: number of generated clusters

  • N: number of vertex

  • cl: vector of clusters labels

  • pi: clusters proportions

  • theta:

Examples

theta <- list(
  matrix(c(0.1, 0.9, 0.9, 0.1, 0.5, 0.5, 0.3, 0.7), ncol = 2, byrow = TRUE),
  matrix(c(0.5, 0.5, 0.3, 0.7, 0.05, 0.95, 0.3, 0.7), ncol = 2, byrow = TRUE),
  matrix(c(0.5, 0.5, 0.9, 0.1, 0.5, 0.5, 0.1, 0.9), ncol = 2, byrow = TRUE)
)
lca.data <- rlca(100, rep(1 / 4, 4), theta)

comeetie/greed documentation built on Oct. 10, 2022, 5:37 p.m.