% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/CM_int.R, R/CMfun.R
\name{get_report}
\alias{get_report}
\alias{get_CMdata}
\alias{CMfigures}
\alias{CM_trace}
\alias{CM_pairs}
\alias{CM_fit_esc}
\alias{CM_fit_pHOS}
\alias{CM_fit_CWTesc}
\alias{CM_fit_CWTcatch}
\alias{CM_maturity}
\alias{CM_vul}
\alias{CM_SRR}
\alias{CM_prod}
\alias{CM_Srep}
\alias{CM_M}
\alias{CM_Megg}
\alias{CM_Njuv}
\alias{CM_recr}
\alias{CM_esc}
\alias{CM_F}
\alias{CM_surv}
\alias{CM_wt}
\alias{CM_surv2}
\alias{CM_wto}
\alias{CM_ER}
\alias{CM_CWT_ER}
\alias{CM_covariate}
\title{Figures for conditioning model results}
\usage{
get_report(stanfit, sims, inc_warmup = FALSE)

get_CMdata(fit)

CM_trace(stanfit, vars, inc_warmup = FALSE)

CM_pairs(stanfit, vars = c("log_so", "log_cr"), inc_warmup = FALSE)

CM_fit_esc(report, d, year)

CM_fit_pHOS(report, d, year)

CM_fit_CWTesc(report, d, year1 = 1, rs_names)

CM_fit_CWTcatch(report, d, PT = TRUE, year1 = 1, rs_names)

CM_maturity(
  report,
  d,
  year1 = 1,
  r = 1,
  brood = TRUE,
  annual = FALSE,
  rs_names
)

CM_vul(report, type = c("vulPT", "vulT"))

CM_SRR(report, year1 = 1)

CM_prod(report, d, year1 = 1)

CM_Srep(report, d, year1 = 1, type = c("spawner", "egg"))

CM_M(report, year1 = 1, ci = TRUE)

CM_Megg(report, year1 = 1, ci = TRUE, surv = FALSE)

CM_Njuv(report, year1 = 1, ci = TRUE)

CM_recr(report, year1 = 1, ci = TRUE)

CM_esc(report, year1 = 1, ci = TRUE)

CM_F(report, PT = TRUE, year1 = 1, ci = TRUE)

CM_surv(report, year1 = 1, ci = TRUE)

CM_wt(stanfit, year1 = 1, ci = TRUE)

CM_surv2(report, year1 = 1, ci = TRUE, ylab = "Survival to age 2")

CM_wto(stanfit, year1 = 1, ci = TRUE)

CM_ER(
  report,
  brood = TRUE,
  type = c("PT", "T", "all"),
  year1 = 1,
  ci = TRUE,
  at_age = TRUE,
  r = 1
)

CM_CWT_ER(
  report,
  brood = TRUE,
  type = c("PT", "T", "all"),
  year1 = 1,
  ci = TRUE,
  rs_names
)

CM_covariate(x, names, year1 = 1, b, ylab = "Covariate")
}
\arguments{
\item{stanfit}{Output from \code{\link[=sample_CM]{sample_CM()}}}

\item{sims}{Optional integer vector for subset of MCMC iterations}

\item{inc_warmup}{Logical, whether to include warmup MCMC samples}

\item{fit}{Output from \verb{[fit_CM()]}}

\item{vars}{Character vector for variable names (see \code{names(stanfit@sim$samples[[1]])}). Regex and partial matching supported because it is passed to the \code{pattern} argument of \code{\link[=grepl]{grepl()}}}

\item{report}{List, output of state variables from individual MCMC samples, obtained with \code{get_report()}}

\item{d}{List of data variables, obtained with \code{get_CMdata()}}

\item{year}{Vector of years}

\item{year1}{Numeric, first year of model}

\item{rs_names}{Character vector of hatchery release strategies}

\item{PT}{Logical, whether to plot preterminal catch, otherwise (plot terminal catch)}

\item{r}{Integer, the release strategy for the figure (only if \code{annual = FALSE})}

\item{brood}{Logical, whether to show results by brood year or return year (FALSE)}

\item{annual}{Logical, whether to show panel figure by individual year (TRUE) or a single time series figure}

\item{type}{Character, indicates type of variable to plot}

\item{ci}{Logical whether to show posterior intervals in addition to posterior median}

\item{surv}{Logical, whether to plot survival (values between 0 - 1) or instantaneous mortality rates}

\item{ylab}{Character y axis label}

\item{at_age}{Logical, whether to make figure by individual age}

\item{x}{Matrix of covariates by year x covariate}

\item{names}{Character of covariate names}

\item{b}{Matrix of fixed effect coefficients by simulation x covariate. If missing only the covariates (\code{x}) are plotted,
otherwise, the dot product \code{sum(x * b)} is calculated by individual simulation and quantiles are plotted}
}
\value{
\itemize{
\item \code{get_report()} returns the list of state variables by individual MCMC samples
}

\itemize{
\item \code{get_CMdata()} returns the list of data variables used in the conditioning model
}

\itemize{
\item \code{CM_trace()} returns a ggplot showing the MCMC trace plot (aka wormplot)
}

\itemize{
\item \code{CM_pairs()} returns output from \code{\link[graphics:pairs]{graphics::pairs()}}, a matrix of scatterplots of MCMC posterior samples
}

\itemize{
\item \code{CM_fit_esc()} returns base graphics with fit to total escapement time series
}

\itemize{
\item \code{CM_fit_pHOS()} returns base graphics with fit to pHOS (census) observations
}

\itemize{
\item \code{CM_fit_CWTesc()} returns ggplot of fit to CWT escapement at age
}

\itemize{
\item \code{CM_fit_CWTcatch()} returns ggplot of fit to CWT catch at age
}

\itemize{
\item \code{CM_maturity()} returns ggplot of estimated maturity at age
}

\itemize{
\item \code{CM_vul()} returns ggplot of estimated fishery vulnerability at age
}

\itemize{
\item \code{CM_SRR()} returns ggplot of estimated stock-recruit relationship (density-dependent juvenile production from egg production) with average
relationship and realized annual values. Years correspond to return years of egg production (predicts juvenile production of the following calendar year).
}

\itemize{
\item \code{CM_prod()} returns ggplot of realized productivity in the absence of fishery harvest, annual values are based on natural mortality and maturity at age
}

\itemize{
\item \code{CM_Srep()} returns ggplot of realized spawner or egg production at replacement, annual values are based on natural mortality and maturity at age
}

\itemize{
\item \code{CM_M()} returns ggplot of estimated natural mortality time series by age (marine stage)
}

\itemize{
\item \code{CM_Megg()} returns ggplot of egg-juvenile mortality time series
}

\itemize{
\item \code{CM_Njuv()} returns ggplot of juvenile abundance
}

\itemize{
\item \code{CM_recr()} returns ggplot of recruitment (mature return)
}

\itemize{
\item \code{CM_esc()} returns ggplot of escapement (after terminal harvest)
}

\itemize{
\item \code{CM_F()} returns ggplot of instantaneous fishing mortality
}

\itemize{
\item \code{CM_surv()} returns ggplot of natural survival (converting from instantaneous units of natural mortality)
}

\itemize{
\item \code{CM_wt()} returns ggplot of annual deviations in egg-juvenile mortality from the Ricker function
}

\itemize{
\item \code{CM_surv2()} returns ggplot of annual survival to age 2, which includes age-1 mortality (marine life stage) for both natural and hatchery origin fish.
Hatchery fish experience additional mortality specified by release mortality.
}

\itemize{
\item \code{CM_wt()} returns ggplot of annual deviations in age 1 natural mortality (first year in marine life stage, deviations from time series average)
}

\itemize{
\item \code{CM_ER()} returns ggplot of exploitation rate either by individual age or aggregate values using adult equivalents
}

\itemize{
\item \code{CM_CWT_ER()} returns ggplot of CWT exploitation rate (by release strategy)
}

\itemize{
\item \code{CM_covariate()} returns ggplot of mortality covariates
}
}
\description{
Functions used by the markdown report to generate summary figures from the age-structured conditoning model
}
