Learn R Programming

r4ss (version 1.11)

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",
postfile = "posteriors.sso", showpost = T, showprior = T,
showmle = T, showinit = T, showrecdev = T, priorinit = T,
priorfinal = T, showlegend = T, fitrange = F, xaxs="i",
xlim=NULL, ylim=NULL, verbose = T, nrows = 3, ncols = 3,
new = T, pdf = F, pwidth = 7, pheight = 7, punits="in",
ptsize = 12, returntable = F, strings = c(), exact = F,
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".
postfile
Name of MCMC posteriors file (not required). Default="posteriors.sso".
showpost
Show posterior distribution as bar graph? Default=T.
showprior
Show prior distribution as black line? Default=T.
showmle
Show MLE estimate and asymptotic variance estimate with blue lines? Default=T.
showinit
Show initial value as red triangle? Default=T.
showrecdev
Include recdevs in the plot? Default=T.
priorinit
T/F for prior probability at initial value (not implemented).
priorfinal
T/F for prior probability at final value (not implemented).
showlegend
Show the legend? Default=T.
fitrange
Fit range tightly around MLE & posterior distributions, instead of full parameter range? Default=F.
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=T.
nrows
How many rows in multi-figure plot. Default=3.
ncols
How many columns in multi-figure plot. Default=3.
new
Open new window for plotting? Default=T.
pdf
Write to PDF file instead of R GUI? Default=F.
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=F.
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=F.
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
pars <- SSplotPars(dir='c:/SS/Simple/')

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

Run the code above in your browser using DataLab