Description Usage Arguments Value Examples
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.
1 |
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. |
depending on rep
value, either
an (n-by-n)
observation matrix, or
a length-rep
list where each element
is an observation is an (n-by-n)
realization from the model.
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.