ppplot: Probability-Probability Plot of FCS2 Model Fit

Description Usage Arguments Details Value Warning See Also

View source: R/ppplot.R

Description

Produces a Probability-Probability (P-P) plot of the fitted total catch that can be used to assess the model fit.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
ppplot(
  fit,
  dataFrame,
  subset = 1:nrow(dataFrame),
  na.action,
  n.sims = 100,
  ciprob = 0.95,
  title = "",
  addCI = TRUE,
  progressBar = TRUE,
  mu,
  rho,
  seed = NULL
)

Arguments

fit

an "fcs2Fit" object, usually returned by fcs2FitModel.

dataFrame

a data frame with surveys as rows and variables as columns. It should contain all variables required by fit. This is usually the same data frame used to create fit.

subset

an optional vector specifying a subset of surveys to be used to create the P-P plot.

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.fcs2Fit. 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.

n.sims

the number of datasets to simulate from the fitted model to generate the confidence interval if addCI is TRUE.

ciprob

the desired limits for the confidence interval added if addCI is TRUE. The default is 0.95 representing a 95% interval.

title

an optional title for the plot.

addCI

whether to add a confidence interval to the plot (default is TRUE).

progressBar

whether to show a progress bar when calculating the confidence interval, since this can take some time.

mu

a matrix of abundance samples can optionally be provided, as generated from abundance using the same fit, dataFrame and subset.

rho

a matrix of prevalence samples can optionally be provided, as generated from prevalence using the same fit, dataFrame and subset.

seed

set random seed to allow repeatable results.

Details

If addCI is TRUE, a confidence interval is found by Monte Carlo simulation. n.sims datasets of fish catches are simulated from the fitted model, each using the same observed covariates, and the P-P plot line is found for each. The confidence interval then represents the extent covered by the central ciprob proportion of these.

If the observed data is typical of data simulated from the model, we would expect the observed P-P plot line to fall within the confidence interval ciprob * 100% of the time.

Value

If addCI is TRUE, the proportion of observed P-P plot points within the confidence limits is printed to screen and invisibly returned.

Warning

Generating the confidence interval can take some time, especially if n.sims is large.

See Also

plot.fcs2Fit


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