Learn R Programming

simone (version 0.1-3)

SimDataAffiliation: Simulate an affiliation graph and its associated Gaussian sample

Description

Simulate a gaussian sample from a gaussian graphical network with a latent structure

Usage

SimDataAffiliation (p, n, proba.in, proba.out, alpha, proba.dust=0)

Arguments

p
Scalar : number of nodes in the graph.
n
Scalar : number of Gaussian samples to simulate.
proba.in
Scalar : graph intra-class probability of edge existence.
proba.out
Scalar : graph inter-class probability of edge existence.
alpha
Vector : prior relative probability of the graph's classes. Probabilities are internally normalized once added the dustbin probability, so as dust.proba remains unchanged and alpha sums to 1. Also defines the number of classes by its length.
proba.dust
Scalar : Prior probability of dustbin nodes. Default $0$.

Value

  • Returns a List comprising :
  • cl.theoA vector of node classification
  • K.theoA $p\times p$ precision matrix
  • Sigma.theoA $p\times p$ covariance matrix
  • dataA $n \times p$ matrix that contains a $n$ samples of a Gaussian vector

Details

This function first draws node class belonging for the p nodes using a multinomial law parametered by alpha and proba.dust. The graph is then built as follows: edge existence or absence are drawn from a mixture of binomial distributions, parametered by proba.in, proba.out, proba.dust according to the node class belonging. The edges are then set to -1 or 1 with probability 1/2 while ensuring symmetry. The obtained matrix is normalized so as to have a "heavy diagonal" of unitary values, ensuring inversability. This constitutes the graph's precision matrix K.theo. The theoretic covariance matrix Sigma.theo is obtained by inversing K.theo.

A simulated data set data is then generated as n sample of a Gaussian vector with covariance matrix Sigma.theo.

Examples

Run this code
library(simone)

## The data set parameters
p <- 100
n <- 200
proba.in  <- 0.25
proba.out <- 0.025
alpha <- c(0.5,0.3,0.2)

# Simulate the data set
X  <- SimDataAffiliation (p,n,proba.in,proba.out,alpha,proba.dust=0.2)

## Plot the graph and summary the data set
g <- Gplot(X$K.theo, X$cl.theo, main="A modular network")
summary(X$data)

Run the code above in your browser using DataLab