abundance: Posterior Samples of Abundance and Prevalence Model...

Description Usage Arguments See Also

View source: R/abundance.R

Description

Calculates posterior samples of the abundance or prevalence model components

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
abundance(fit, newData, subset = 1:nrow(newData), na.action, breakdown = FALSE)

prevalence(fit, newData, subset = 1:nrow(newData), na.action, breakdown = FALSE)

prevalence(
  fit,
  newData,
  subset = 1:nrow(newData),
  na.action,
  breakdown = FALSE
)

Arguments

fit

an "fcs2Fit" object containing a full FCS2 model fit, as returned from fcs2FitModel with runBUGS = TRUE.

newData

a data frame with surveys as rows and variables as columns. It should contain all variables required by fit. If missing, the model matrix contained within fit is used.

subset

an optional vector specifying a subset of surveys to calculate samples for.

na.action

a function which indicates what should happen when the data contain missing values (NAs). The default is set by the na.action setting of options and this is usually set to na.omit. This setting removes surveys that contain missing data in any required variables. A vector indicating the rows that were removed can be extracted from the returned object using na.action. Alternatively, na.pass can be used to ignore missing values (where possible) or na.fail can be given to signal an error if missing values are found.

breakdown

logical; If FALSE (the default), samples of the abundance or prevalence are returned for each survey. If TRUE, an array is returned contining each additive term in the abundance or prevalence regression equation. If breakdown = FALSE (the default), a matrix of posterior samples of the abundance μ or prevalence ρ model component is returned for the selected surveys. Monte Carlo samples appear as rows and surveys as columns.

If breakdown = TRUE, a three-dimensional array of regression component samples is returned. Samples are given in the first dimension, surveys in the second and the third dimension corresponds to each additive term in the abundance or prevalence regression. The output from breakdown = FALSE can be calculated by summing over the third dimension and transforming with exp for abundance or expit for prevalence.

If surveys were removed by na.action = na.omit, these can be recovered by applying na.action to the matrix or array.

See Also

fcs2FitModel for producing the required FCS2 model fit.


aquaMetrics/fcs2 documentation built on Aug. 21, 2021, 12:55 p.m.