gmodel.P: Generate graphs given a probability matrix

Description Usage Arguments Value Examples

View source: R/gmodel.P.R

Description

Given an (n-by-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-by-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
## 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
par(mfrow=c(1,3))
image(out[[1]])
image(out[[2]])
image(out[[3]])

graphon documentation built on Nov. 17, 2017, 5:28 a.m.

Related to gmodel.P in graphon...