Description Usage Arguments Value See Also Examples
View source: R/fcs2SingleEQR.R
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.
1 | fcs2SingleEQR(fit, newData, subset = 1:nrow(newData), na.action, mu, rho)
|
fit |
an |
newData |
a data frame with surveys as rows and variables as columns.
It should contain all variables required by |
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 ( |
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 |
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
|
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.
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.
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.