Description Usage Arguments Details Value See Also Examples
Edge presence probabilities are drawn from a posterior Beta distribution
Beta(α,β), in which parameters α and β correspond to total
(pseudo-)counts of the times when an edge was 1 and 0, respectively. By default, an uninformative
prior (Jeffrey's prior, i.e. α.prior =
β.prior = 0.5) is used, and is added to the observed edge weights in Adj, so that:
α = Adj + α.prior, β = samp.effort - Adj + β.prior
where samp.effort - Adj is a positive or null integer.
1 2 3 4 5 6 7 | draw_edgeProb(
Adj,
samp.effort,
Adj.subfun = NULL,
alpha.prior = 0.5,
beta.prior = 0.5
)
|
Adj |
integer matrix, the adjacency matrix (see |
samp.effort |
integer scalar, the sampling effort (see |
Adj.subfun |
function, the matrix subsetting function relevant for the adjacency matrix
|
alpha.prior |
positive numeric scalar, the parameter alpha (added to shape1 in |
beta.prior |
positive numeric scalar, the parameter beta (added to shape2 in |
For Bayesian inference and conjugation, a prior beta distribution Beta(α.prior,β.prior) is used, with default
α.prior = β.prior = 0.5
which corresponds to Jeffrey's prior. Alternative parametrization can rely on
α.prior = β.prior = 1
for a prior beta distribution equivalent to a uniform distribution over [0,1].
In simunet(), a new edgeProb is drawn before simulating binary scans. Two
scanLists outputted from an identical Adj matrix and samp.effort will result in different
edgeProbs, but these edgeProbs are drawn from the same posterior Beta distribution
Beta(α,β).
The edgeProb used is stored in the scanList outputted by simunet() as an attribute in the
attributes list attrs, and can be retrieved via attrs(scan.list,"edgeProb")).
This procedure is equivalent to drawing a scanList from a Beta-Binomial distribution
BetaBinom(n.scans,α,β), but allows
"decomposing" the simulated edge weights into a list of binary scans instead of outputting only a
new weighted adjacency matrix.
numeric matrix of edge presence probabilities
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | # Internally used in `generate_edgeProb()`, itself used in `simunet()`
set.seed(42)
n <- 5L
samp.effort <- 241L
# Adjacency matrix import
## random directed adjacency matrix
Adj <- matrix(sample(1:samp.effort,n * n),
nrow = 5,dimnames = list(letters[1:n],letters[1:n]))
diag(Adj) <- 0L
Adj
sL <- simunet(Adj = Adj,samp.effort = samp.effort,mode = "directed",n.scans = 20L)
attrs(sL,"edge.Prob")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.