fcs2SingleEQR: Single EQR

Description Usage Arguments Value See Also Examples

View source: R/fcs2SingleEQR.R

Description

Produces Monte Carlo samples of the FCS2 Ecological Quality Ratio (EQR) for a single species and for each survey. The EQR is a number between 0 and 1 which is found by comparing the observed catch with the model's prediction at reference conditions. Higher EQR values are better and these are caused by catching larger numbers of fish. The variability in the Monte Carlo samples of the EQR is due to the uncertainty in the parameters of the FCS2 model. This uncertainty can be used by fcs2Classify to produce probabilistic WFD classifications from each EQR.

Usage

1
fcs2SingleEQR(fit, newData, subset = 1:nrow(newData), na.action, mu, rho)

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. Covariates which are related to human disturbance (pressure variables) should have their values set to the value expected at the site if it were undisturbed (reference conditions) rather than the observed value for each of these variables.

subset

an optional vector specifying a subset of surveys to calculate EQR 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.fcs2EQR. 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.

mu

a matrix of posterior samples of the abundance component μ can optionally be given to save recalculation if already available. This is assumed to have been calculated from abundance using the same arguments as above.

rho

a matrix of posterior samples of the prevalence component ρ can optionally be given to save recalculation if already available. This is assumed to have been calculated from prevalence using the same arguments as above.

Value

Returns an "fcs2EQR" object that contains the EQR samples. The "fcs2EQR" object is essentially a matrix with Monte Carlo samples as rows and surveys as columns.

See Also

print.fcs2EQR, summary.fcs2EQR and fcs2EQRSummaryMatrix for summarising "fcs2EQR" objects;
plot.fcs2EQR for plotting EQR variables;
mean.fcs2EQR and quantile.fcs2EQR for calculating means and quantiles of EQR variables respectively;

fcs2FitModel for producing the required FCS2 model fit;
fcs2Classify for using EQR samples to produce probabilistic WFD classifications.

fcs2JointEQR for producing EQR samples that combine multiple species and/or surveys;
fcs2JointAndSingleEQR for calculating joint and single EQR samples simultaneously.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
## Not run: 

### Very simple example with no covariates
###

# simulate random dataset
Data <- data.frame(SurveyArea=rlnorm(100, 4.6, 0.5))   # random survey area
Data$Catch <- rzinbinom(100, size=1.1, zeroprob=0.3,
                        nbmean=0.3 * Data$SurveyArea)  # single catch per survey

# fit full model with OpenBUGS
fit <- fcs2FitModel("Catch", dataFrame=Data, surveyAreaVar="SurveyArea",
                    runBUGS=TRUE, n.iter=1000, bugsProgram="OpenBUGS")

# calculate samples of single EQR, using same dataset
eqr <- fcs2SingleEQR(fit, Data)

# plot EQR variables for first 9 surveys
plot(eqr, 1:9, boundaries=NULL)

# calculate mean EQR values
mean(eqr)

## End(Not run)

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