gmodel.P: Generate graphs given a probability matrix

Description Usage Arguments Value Examples

View source: R/gmodel.P.R

Description

Given an (n\times n) probability matrix P, gmodel.P generates binary observation graphs corresponding to Bernoulli distribution whose parameter matches to the element of P.

Usage

1
gmodel.P(P, rep = 1, noloop = TRUE, symmetric.out = FALSE)

Arguments

P

an (n\times n) probability matrix.

rep

the number of observations to be generated.

noloop

a logical value; TRUE for graphs without self-loops, FALSE otherwise.

symmetric.out

a logical value; FALSE for generated graphs to be nonsymmetric, TRUE otherwise. Note that TRUE is supported only if the input matrix P is symmetric.

Value

depending on rep value, either

(rep=1)

an (n-by-n) observation matrix, or

(rep>1)

a length-rep list where each element is an observation is an (n-by-n) realization from the model.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## set inputs
modelP <- matrix(runif(16),nrow=4)

## generate 3 observations without self-loops.
out <- gmodel.P(modelP,rep=3,noloop=TRUE)

## visualize generated graphs
opar = par(no.readonly=TRUE)
par(mfrow=c(1,3), pty="s")
image(out[[1]], main="1st sample")
image(out[[2]], main="2nd sample")
image(out[[3]], main="3rd sample")
par(opar)

graphon documentation built on Aug. 13, 2021, 5:06 p.m.