Description Usage Arguments Author(s) Examples
Models and conducts network pruning for a species dependency network calculated as pairwise conditional probabilities.
1 |
x |
A matrix of species abundances with species in columns. |
zero.na |
Automatically make NA values zero. |
prune |
Reduce the size of the network using a confidence interval test. |
diag.zero |
Set the matrix diagonal (i.e. the trace) to zero. |
Matthew K. Lau
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function (x = "species in cols", zero.na = TRUE, prune = TRUE,
diag.zero = TRUE, pos = TRUE)
{
out <- matrix(NA, nrow = ncol(x), ncol = ncol(x))
for (i in 1:ncol(x)) {
for (j in 1:ncol(x)) {
if (pos) {
out[i, j] <- calcDepend(x[, i], x[, j])
}
else {
out[i, j] <- negDepend(x[, i], x[, j])
}
}
}
if (prune) {
out.rm <- co.net(x, diag.zero = diag.zero)
out[out.rm == 0] <- 0
}
else {
}
if (diag.zero) {
diag(out) <- 0
}
rownames(out) <- colnames(out) <- colnames(x)
if (zero.na) {
out[is.na(out)] <- 0
}
return(out)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.