MRFcov
objectThis function uses outputs from fitted MRFcov
and bootstrap_MRF
models to
generate linear predictions for each observation in data
and
calculate probabilistic network metrics from weighted adjacency matrices.
predict_MRFnetworks(
data,
MRF_mod,
cutoff,
omit_zeros,
metric,
cached_predictions = NULL,
prep_covariates,
n_cores,
progress_bar = FALSE
)
Either a matrix
with nrow = nrow(data)
,
containing each species' predicted network metric at each observation in data
, or
a list
with length = nrow(data)
containing the weighted, undirected
adjacency matrix predicted at each observation in data
Dataframe. The sample data where the
left-most variables are variables that are represented by nodes in the graph.
Colnames from this sample dataset must exactly match the colnames in the dataset that
was used to fit the MRF_mod
A fitted MRFcov
or bootstrap_MRF
object
Single numeric value specifying the linear prediction threshold. Species whose
linear prediction is below this level for a given observation in data
will be
considered absent, meaning they cannot participate in community networks.
Default is 0.5
for family == 'binomial'
or 0
for other families
Logical. If TRUE
, each species will not be considered to
participate in community networks for observations in which that species was not observed
in data
. If FALSE
, the species is still considered to have possibly occurred, based
on the linear prediction for that observation. Default is FALSE
The network metric to be calculated for each observation in data
.
Recognised values are : "degree"
, "eigencentrality"
, or "betweenness"
, or
leave blank to instead return a list of adjacency matrices
Use if providing stored predictions from predict_MRF
to prevent unneccessary replication. Default is to calculate predictions first and then
calculate network metrics
Logical flag stating whether to prep the dataset
by cross-multiplication (TRUE
by default; use FALSE
for predicting
networks from MRFcov_spatial
objects)
Positive integer stating the number of processing cores to split the job across.
Default is 1
(no parallelisation)
Logical. Progress bar in pbapply is used if TRUE
, but this slows estimation.
Interaction parameters are predicted for each observation in data
and then converted into a weighted, undirected adjacency matrix
using graph.adjacency
. Note that the network is probabilistic,
as node occurrences/abundances are predicted using fitted model equations from
MRF_mod
. If a linear prediction for a given observation falls below the
user-specified cutoff
, the node is considered absent from the community and cannot
participate in the network. After correcting for the linear predictions,
the specified network metric (degree centrality,
eigencentrality, or betweenness) for each observation in data
is then calculated and returned in a matrix
. If metric
is not
supplied, the weighted, undirected adjacency matrices are returned in a list
MRFcov
, bootstrap_MRF
, degree
,
eigen_centrality
, betweenness
data("Bird.parasites")
CRFmod <- MRFcov(data = Bird.parasites, n_nodes = 4,
family = "binomial")
predict_MRFnetworks(data = Bird.parasites[1:200, ],
MRF_mod = CRFmod, metric = "degree",
cutoff = 0.25)
Run the code above in your browser using DataLab