Learn R Programming

r4ss (version 1.24.0)

SSplotPars: Plot distributions of priors, posteriors, and estimates.

Description

Make multi-figure plots of prior, posterior, and estimated asymptotic parameter distributions. MCMC not required to make function work.

Usage

SSplotPars(dir = "c:/path/", repfile = "Report.sso",
  xlab = "Parameter value", ylab = "Density", postfile = "posteriors.sso",
  showpost = TRUE, showprior = TRUE, showmle = TRUE, showinit = TRUE,
  showrecdev = TRUE, priorinit = TRUE, priorfinal = TRUE,
  showlegend = TRUE, fitrange = FALSE, xaxs = "i", xlim = NULL,
  ylim = NULL, verbose = TRUE, nrows = 3, ncols = 3, ltyvec = c(1, 1,
  3, 4), colvec = c("blue", "red", "black", "gray60", rgb(0, 0, 0, 0.5)),
  new = TRUE, pdf = FALSE, pwidth = 6.5, pheight = 5, punits = "in",
  ptsize = 10, returntable = FALSE, strings = c(), exact = FALSE,
  newheaders = NULL, burn = 0, thin = 1, ctlfile = "control.ss_new")

Arguments

dir

Directory where all files are located.

repfile

Name of report file. Default="Report.sso".

xlab

Label on horizontal axis.

ylab

Label on vertical axis.

postfile

Name of MCMC posteriors file (not required). Default="posteriors.sso".

showpost

Show posterior distribution as bar graph? Default=TRUE.

showprior

Show prior distribution as black line? Default=TRUE.

showmle

Show MLE estimate and asymptotic variance estimate with blue lines? Default=TRUE.

showinit

Show initial value as red triangle? Default=TRUE.

showrecdev

Include recdevs in the plot? Default=TRUE.

priorinit

TRUE/FALSE for prior probability at initial value (not implemented).

priorfinal

TRUE/FALSE for prior probability at final value (not implemented).

showlegend

Show the legend? Default=TRUE.

fitrange

Fit range tightly around MLE & posterior distributions, instead of full parameter range? Default=FALSE.

xaxs

Parameter input for x-axis. See ?par for more info. Default="i".

xlim

Optional x-axis limits to be applied to all plots. Otherwise, limits are based on the model results. Default=NULL.

ylim

Optional y-axis limits to be applied to all plots. Otherwise, limits are based on the model results. Default=NULL.

verbose

Controls amount of text output (maybe). Default=TRUE.

nrows

How many rows in multi-figure plot. Default=3.

ncols

How many columns in multi-figure plot. Default=3.

ltyvec

Vector of line types used for lines showing MLE and prior distributions and the median of the posterior distribution

colvec

Vector of colors used for lines and polygons showing MLE, initial value, prior, posterior, and median of the posterior.

new

Open new window for plotting? Default=TRUE.

pdf

Write to PDF file instead of R GUI? Default=FALSE.

pwidth

Default width of plots printed to files in units of punits. Default=7.

pheight

Default height width of plots printed to files in units of punits. Default=7.

punits

Units for pwidth and pheight. Can be "px" (pixels), "in" (inches), "cm" or "mm". Default="in".

ptsize

Point size for plotted text in plots printed to files (see help("png") in R for details). Default=12.

returntable

Return table of parameter info? Default=FALSE.

strings

Subset parameters included in the plot using substring from parameter names (i.e. "SR" will get "SR_R0" and "SR_steep" if they are both estimated quantities in this model). Default=c().

exact

Should strings input match parameter names exactly? Otherwise substrings are allowed. Default=FALSE.

newheaders

Optional vector of headers for each panel to replace the parameter names. Default=NULL.

burn

Additional burn-in applied to MCMC posteriors. Default=0.

thin

Additional thinning applied to MCMC posteriors. Default=1.

ctlfile

Specify control file to get min and max recdev values (otherwise assumed to be -5 and 5). Default="control.ss_new".

Examples

Run this code
# NOT RUN {
# }
# NOT RUN {
pars <- SSplotPars(dir='c:/SS/Simple/')

# strings can be partial match
pars <- SSplotPars(dir='c:/SS/Simple/',strings=c("steep"))
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab