Learn R Programming

nethet (version 1.4.2)

sim_mix_networks: sim_mix_networks

Description

Generate inverse covariances, means, mixing probabilities, and simulate data from resulting mixture model.

Usage

sim_mix_networks(n, p, n.comp, sparsity = 0.7, mix.prob = rep(1/n.comp,
  n.comp), Mu = NULL, Sig = NULL, ...)

Arguments

n
Number of data points to simulate.
p
Dimensionality of the data.
n.comp
Number of components of the mixture model.
sparsity
Determines the proportion of non-zero off-diagonal entries.
mix.prob
Mixture probabilities for the components; defaults to uniform distribution.
Mu
Means for the mixture components, a p by n.comp matrix. If NULL, sampled from a standard Gaussian.
Sig
Covariances for the mixture components, a p by p by n.comp array. If NULL, generated using generate_inv_cov.
...
Further arguments passed to sim_mix.

Value

  • A list with components: Mu Means of the mixture components. Sig Covariances of the mixture components. data Simulated data, a n by p matrix. S Component assignments, a vector of length n.

Details

This function generates n.comp mean vectors from a standard Gaussian and n.comp covariance matrices, with at most (1-sparsity)*p(p-1)/2 non-zero off-diagonal entries, where the non-zero entries are sampled from a beta distribution. Then it uses sim_mix to simulate from a mixture model with these means and covariance matrices.

Means Mu and covariance matrices Sig can also be supplied by the user.

Examples

Run this code
# Generate dataset with 100 samples of dimensionality 30, and 4 components
test.data = sim_mix_networks(n=100, p=30, n.comp=4)

Run the code above in your browser using DataLab