fcs2Classify: Probabilistic WFD Classifications from EQR Samples

Description Usage Arguments Value See Also Examples

View source: R/fcs2Classify.R

Description

Produces probabilistic Water Framework Directive classifications of Bad, Poor, Good, Moderate or High from Monte Carlo EQR samples.

Usage

1
fcs2Classify(eqr, survey = 1:ncol(eqr), species, boundaries)

Arguments

eqr

an object of class "fcs2EQR" containing Monte Carlo EQR samples, as calculated from fcs2SingleEQR, fcs2JointEQR or fcs2JointAndSingleEQR.

survey

index specifying which surveys (or water bodies etc if surveys joined) to classify.

species

index specifying which species to classify.

boundaries

a vector of length 4 giving the EQR boundaries separating the classes Bad, Poor, Good, Moderate and High. If missing, regularly spaced boundaries of c(0.2, 0.4, 0.6, 0.8) are used with a warning.

Value

A matrix or array containing the probabilities of each WFD class, as estimated from the proportion of EQR samples between the class boundaries. The classes Bad, Poor, Good, Moderate and High are given in rows 1 to 5 respectively, while the columns indicate the selected surveys (or sites/water bodies/etc if surveys were joined when calculating EQRs). If eqr contains EQR samples for multiple fits/species, an array is returned with species as the third dimension.

See Also

plot.fcs2EQR with type="class" for plotting the probabilistic classifications.#' fcs2SingleEQR, fcs2JointEQR or fcs2JointAndSingleEQR for producing "fcs2EQR" objects.

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
25
26
27
28
29
30
31
32
    ## Not run: 
### Very simple example using a single species EQR

# 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

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

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

# define WFD class boundaries
boundaries <- c(0.001, 0.01, 0.25, 0.5)

# plot EQR variables for first 9 surveys,
# shading the probabilities of each class
plot(eqr, 1:9, type="density", boundaries=boundaries)

# calculate probabilistic classifications
fcs2Classify(eqr, boundaries=boundaries)

# plot these probabilities for the first 9 surveys
plot(eqr, 1:9, type="class", boundaries=boundaries)

## End(Not run)

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