Skip to contents

Function for residual diagnostics. Plots residuals and 3x sigma limits for indices or mean age or length and outputs a runs test table. Note, if you do not want to plot the residuals, use SSrunstest().

Usage

SSplotRunstest(
  ss3rep,
  mixing = "less",
  subplots = c("cpue", "len", "age", "size", "con")[1],
  plot = TRUE,
  print = deprecated(),
  print_plot = FALSE,
  png = deprecated(),
  use_png = print_plot,
  pdf = deprecated(),
  use_pdf = FALSE,
  indexselect = NULL,
  miny = 1,
  col = NULL,
  pch = 21,
  lty = 1,
  lwd = 2,
  tickEndYr = FALSE,
  xlim = "default",
  ylim = "default",
  ylimAdj = 1.4,
  xaxs = "i",
  yaxs = "i",
  xylabs = TRUE,
  type = "o",
  legend = TRUE,
  legendloc = "top",
  legendcex = 1,
  pwidth = 6.5,
  pheight = 5,
  punits = "in",
  res = 300,
  ptsize = 10,
  cex.main = 1,
  plotdir = NULL,
  filenameprefix = "",
  par = list(mar = c(5, 4, 1, 1) + 0.1),
  verbose = TRUE,
  new = TRUE,
  add = FALSE
)

Arguments

ss3rep

Stock Synthesis output as read by r4ss::SS_output()

mixing

c("less","greater","two.sided"). Default less is checking for positive autocorrelation only

subplots

optional flag for:

  • "cpue" Index of abundance data

  • "len" Length composition data

  • "size" Generalized size composition data

  • "age" Age composition data

  • "con" Conditional age-at-length data

plot

DEPRECATED. By default, TRUE, Plots (and subplots) are drawn to the plot device. The option to explicitly disable this option (FALSE), is not implemented. This option flag will be defunct in a future version

print

DEPRECATED, please use print_plot.

print_plot

Flag to enable plot graphic device to print to PNG or PNG files.

png

DEPRECATED. Please use use_png.

use_png

Enables plots to be generated to PNG files. Defaults to print value

pdf

DEPRECATED. Please use use_pdf.

use_pdf

Enables plots to be generated to pdf file.

indexselect

Vector of fleet numbers for each model for which to compare

miny

the absolute value of the min and max value for ylim. Default is 1

col

Optional vector of colors to be used for lines. Input NULL

pch

Optional vector of plot character values

lty

Optional vector of line types

lwd

Optional vector of line widths

tickEndYr

Logical flag: set TRUE or FALSE to switch to turn on/off extra axis mark at final year in timeseries plots.

xlim

Optional, years to use for x-axis. Default value NULL (or "default"), uses all years available.

ylim

Optional, values for y-axis range to display on plot. The default: "default", will range from -1 to 1.

ylimAdj

Multiplier for ylim parameter. Allows additional white space.

xaxs

Choice of xaxs parameter See ?par for more info.

yaxs

Choice of yaxs parameter. See ?par for more info.

xylabs

Logical flag: set TRUE or FALSE to include x- and y-axis labels to the plot. Defaults to TRUE

type

The type of plot to be drawn. For more details, see plot.

legend

Flag to enable legend to plot. TRUE by default.

legendloc

Location of legend. Either a string like "topleft" or a vector of two numeric values representing the fraction of the maximum in the x and y dimensions, respectively. See help("legend") for more info on the string options.

legendcex

Allows to adjust legend cex

pwidth

Default width of plot printed to plot in units of punits

pheight

Height of plot printed to plot in units of punits

punits

Measurement units for pwidth and pheight. Default is "in".

  • "px" (pixels)

  • "in" (inches)

  • "cm" (centimeters)

  • "mm" (millimeters)

res

Resolution for plots printed to files.

ptsize

Point size for plotted text in plots printed in files. See help("png") for more details

cex.main

Character expansion for plot titles.

plotdir

Directory where output plot file will be written. By default, it will be the directory where the model was run.

filenameprefix

Additional text to append to output plot file name. It will be separated from default name by an underscore.

par

A numerical vector of the form c(bottom, left, top, right) which gives the number of lines of margin to be specified on the four sides of the plot,which is passed to par(). Entering NULL passes plot's default par() values (which depends on whether the main title is included or not)

verbose

Flag to print additional diagnostic messages to R console

new

Deprecated. New plot windows are created by default (TRUE), and the option to disable this, via FALSE, is unused.

add

suppresses par() to create multiplot figs

Value

a dataframe with runs test p-value, if the test has passed or failed, 3x sigma high and low limits, and the type of data used. Rows are for each fleet. Note, runs test passed if p-value > 0.05 (residuals are random) and failed if p-value < 0.5 (residuals are not random)

Author

Henning Winker (JRC-EC) and Laurance Kell (Sea++)