Chapter 2 A list of key functions in the r4Casal2 package

2.1 Accessor functions

  • get_derived_quanitites() or for lazy people (like myself) get_dqs(). These will return all the derived quantities for a model output.

  • get_selectivities will return a data frame with all the selectivity reports for a model output.

  • get_selectivities_by_year will return a data frame with all the reports of type selectivity_by_year from a model output.

  • get_catchabilities will return a data frame with all the catchability reports for a model output.

  • get_fisheries will return a data frame with information from an instantaneous_mortality process for a model output.

  • get_BH_recruitment will return a data frame with information from a recruitment_beverton_holt process for a model output.

  • get_abundance_observations will return a data frame with information from an abundance or biomass observation for a model output.

  • get_composition_observations will return a data frame with information from an proportion_at_length, proportion_at_age, process_removals_by_age and process_removals_by_length observation for a model output.

  • get_composition_mean_bin will return a data frame with information from an proportion_at_length, proportion_at_age, process_removals_by_age and process_removals_by_length summarised as the mean length or mean age.

  • get_tag_recapture_observations will return a data frame with information from an tag_recapture_by_length_for_growth, tag_recapture_by_length and tag_recapture_by_age observation for a model output.

  • get_partition will return a data frame with partition data from partition report.

  • get_inital_partition will return a data frame with initial partition initialisation_partition report.

  • get_profile Will return a data frame for a profile report.

  • get_estimated_values Will return a data frame for a estimate_value report.

  • get_transformed_parameters Will return a data frame for a parameter_transformations report.

  • get_timevarying_parameters Will return a data frame for a time_varying report.

  • get_simulated_age_resids Will reformat simulated data read in by the read.simulated.data function.

  • get_projections will return a data frame of all projection reports from a model output.

  • get_growth will return a data frame of all age_length report from a model output.

  • get_covariance will return a data frame of all covariance_matrix report from a model output.

2.2 Other useful functions

  • aggregate_objective_report This reformats an objective function report to be “similar” to CASALs output.

  • create_simulation_reports This will create a range of @report.type=simulated_observation Casal2 reports that can help set up simulations. See Section 7 on why you want to do this.

  • build_assessment_bookdown This will create a bookdown template for an assessment model MPD run.

  • summarise_config Will summarize input files see Section 3

  • calculate_composition_stage_two_weights Calculates the stage-two weights using Francis (2011) TA1.8 method.

  • get_high_correlations Returns index of parameters that have high correlations from MPD. This requires the Casal2 model to have reported the correlation_matrix

  • run_automatic_reweighting Automatically apply iterative reweighting methods for a Casal2 model

  • extract_reweighted_mpds extract all the reweighted mpds that are created by run_automatic_reweighting. Useful to then plot the effect of reweighting

  • error_value_table Create a data.frame of all observations from a casal2 mpd run outlining likelihood type, observation type and error value by year and observation.

  • summarise_estimated_parameters If a model reports estimate_summary this function will extract two data frames that can be used to assess starting values and estimated values along with prior assumptions.

  • plot_profile Will plot profiles for reports that have been run with casal2 -p format.

References

Francis, RIC Chris. 2011. “Data Weighting in Statistical Fisheries Stock Assessment Models.” Canadian Journal of Fisheries and Aquatic Sciences 68 (6): 1124–38.