Learn R Programming

XMRF (version 1.0)

XMRF.Sim: Generate simulated data from XMRF models

Description

Generate data from different multivariate distributions with different network structures.

Usage

XMRF.Sim(n = 100, p = 50, model = "LPGM", graph.type = "scale-free")

Arguments

n
number of samples, default to 100.
p
number of variables, default to 50.
model
Markov Network models to indicate the distribution family of the data to be generated, default to "LPGM". Other model options include "PGM", "TPGM", "SPGM", "GGM" and "ISM".
graph.type
graph structure with 3 options:"scale-free", "hub", and "lattice". Default to "scale-free".

Value

  • A list of two elements:
  • Bpxp adjacency matrix of the generated graph.
  • Xpxn data matrix.

Details

This function will first generate a graph of the specified graph structure; then based on the generated network, it simulates a multivariate data matrix that follows distribution for the Markov Random Fields model specified.

Examples

Run this code
library(XMRF)

# simulate scale-free network and data of multivariate Poisson for LPGM
sim <- XMRF.Sim(n=100, p=20, model="LPGM", graph.type="scale-free")
hist(sim$X)
plotNet(sim$B)

# simulate hub network and data of multivariate Gaussian for GGM
sim <- XMRF.Sim(n=100, p=20, model="GGM", graph.type="hub")
hist(sim$X)
plotNet(sim$B)

# simulate hub network and data of multivariate bionomial for ISM
sim <- XMRF.Sim(n=100, p=15, model="ISM", graph.type="hub")
hist(sim$X)
plotNet(sim$B)

Run the code above in your browser using DataLab