Calculate variance adjustments for discard or mean body weight data
Source:R/helper_fxns.R
calc_var_adjust.RdFunction developed for U.S. west coast Sablefish assessment in 2019 to tune discard data or mean body weight data which are common inputs for U.S. west coast groundfish assessments but as of 2023 have not often had any data weighting method applied to them.
Usage
calc_var_adjust(data, type = c("CV", "sd"))Arguments
- data
Either the "discard" or "mnwgt" elements of the list returned by
SS_output(). Other data types might work here but haven't been tested.- type
Either "CV" or "sd" specifying the type of control file variance adjustment, where the SS3 options are
2=add_to_discard_stddev`` and3=add_to_bodywt_CV, so ifdatais discard data, type should be "CV" and ifdata` is mean body weight, type should be "sd".
Value
A table of input and estimated uncertainty values in units of both CV and sd including the following:
fleetis the fleet numbermean_outis the mean of the expected valuesmean_inis the mean of the observed valuesCV_inis the mean input CVsd_inis the mean input SD values (which may include variance adjustments already)sd_outis the SD of the observed relative to the expected values, calculated as described aboveCV_outis the CV of the observed relative to the expected, calculated as described aboveaddedis the value that could be added to any existing value in the "Input variance adjustments factors" section of the control file.typeis the data type code used in "Input variance adjustments factors"
Details
The calculation is based on sd_out = sqrt(mean(Obs - Exp)^2)). Added sd is calculated as sd_out - sd_in where sd_in is the mean of the input standard deviations (possibly including existing variance adjustments). When a CV adjustment is required, the sd_out is converted to CV_out by dividing by the mean of the expected values and with the added CV calculated as CV_out - CV_in.