Turns the calibrated nightly detection history into site x month community matrices for multivariate ordinations (PCoA, NMDS, RDA). Because those analyses do not model false positives, the entry rule is strict:
a species counts as detected on a night only when it had at least
k_minreliable detections that night, i.e. detections with a calibrated probability >=p_minofcalibrate()(columndetection_k<k_min>of the history);only the core species enter the matrix: species whose calibration is reliable at every site. Other species would create artefactual beta diversity from differences in classifier recall among sites;
each cell is the frequency of nights with detection, standardised by effort: nights with detection / nights recorded at that site x month.
Usage
community_matrices(
history,
core_species,
k_min = 2,
min_nights_month = 5,
drop_empty = FALSE
)Arguments
- history
Nightly detection history, as returned by
detection_history()(v1.2.0historico_deteccao_noite.csvtables are also accepted).- core_species
Species codes (the
speciescolumn) that enter the matrix.- k_min
Repetition rule: 1, 2 or 3 reliable detections on the night.
- min_nights_month
Site x month cells with fewer recorded nights are dropped from the matrices (unstable frequencies) and flagged in
effort.- drop_empty
Drop the site x month rows in which no core species was detected. Distances such as Bray-Curtis are undefined for them.
Value
A list with three tibbles, frequency and counts (one row per
site x month, with site, month, n_nights_recorded and one column
per core species) and effort (site, month, n_nights_recorded,
included), plus trials: a numeric matrix with the dimensions of
the species columns of counts holding the nights recorded, the
Ntrials of a binomial model of the counts (e.g. gllvm::gllvm(),
which needs a matrix when effort varies among samples). The row names
of trials are <site>_<month>.