diff --git a/articles/getting_started.html b/articles/getting_started.html index 89fa6a8..7879cc5 100644 --- a/articles/getting_started.html +++ b/articles/getting_started.html @@ -616,7 +616,7 @@

Blue Grenadier## $ hessian : logi FALSE ## $ method : chr "BFGS" ## $ retape :function (set.defaults = TRUE) -## $ env :<environment: 0x557024d2aa40> +## $ env :<environment: 0x5579e3008048> ## $ report :function (par = last.par) ## $ simulate:function (par = last.par, complete = FALSE) ## $ fn_orig :function (x = last.par[lfixed()], ...) diff --git a/pkgdown.yml b/pkgdown.yml index 53d3b63..e1fe6b8 100644 --- a/pkgdown.yml +++ b/pkgdown.yml @@ -3,7 +3,7 @@ pkgdown: 2.0.9 pkgdown_sha: ~ articles: getting_started: getting_started.html -last_built: 2024-05-30T16:15Z +last_built: 2024-05-30T16:19Z urls: reference: http://pfmc-assessments.github.io/nwfscAgeingError/reference article: http://pfmc-assessments.github.io/nwfscAgeingError/articles diff --git a/search.json b/search.json index 83eac73..3fae217 100644 --- a/search.json +++ b/search.json @@ -1 +1 @@ -[{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/articles/getting_started.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"Estimating ageing error using the TMB model written by André Punt","text":"Uncertainty age estimates needs accounted undertaking stock assessments. Punt et al. (2008) provides methods estimating ageing error matrices account ageing bias imprecision. provide documentation examples Template Model Builder (TMB) implementation methods, incorporating documentation written André Punt. vignette illustrated using data settings associated three stocks Australian Southern Eastern Scalefish Shark Fishery (SESSF) fishery (Blue Grenadier, Bight Redfish, School Whiting), well sablefish U.S. west coast.","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/articles/getting_started.html","id":"software","dir":"Articles","previous_headings":"","what":"Software","title":"Estimating ageing error using the TMB model written by André Punt","text":"current implementation software written André Punt 2020 subsequently updated 2022. several slightly different versions source code circulation, use version maintained Kelli Johnson (NOAA NWFSC). consulted André Punt agreed future development ageing error code done NWFSC GitHub repository.","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/articles/getting_started.html","id":"ageing-error-r-package","dir":"Articles","previous_headings":"Software","what":"Ageing Error R package","title":"Estimating ageing error using the TMB model written by André Punt","text":"NOAA Northwest Fisheries Science Center (NWFSC) GitHub site hosts AgeingError package. newer TMB version software replaced ADMB version main branch repository May 2024. ADMB version still available via git history. can install TMB branch directly GitHub using code . Note TMB Rtools need installed . package can loaded. software requires data model specified using input files described .","code":"remotes::install_github(\"pfmc-assessments/AgeingError\") library(AgeingError)"},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/articles/getting_started.html","id":"input-files","dir":"Articles","previous_headings":"","what":"Input files","title":"Estimating ageing error using the TMB model written by André Punt","text":"two input files needed run software data file (.dat extension) specifications file (.spc extension). described using Blue Grenadier (BG2022) example.","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/articles/getting_started.html","id":"data-file","dir":"Articles","previous_headings":"Input files","what":"Data file","title":"Estimating ageing error using the TMB model written by André Punt","text":"data file (.dat extension) contains age comparison data pair readers specifies range ages permitted data, minus plus groups reference age. data file comprises two sections (age range one section data pair reader comparisons) age range simply specified providing minimum maximum ages. data can’t fall outside specified age range code generate error. input files parsed software using keywords need match exactly expected, text “Range_of_ages” part input just comment help user keep track format. data can entered separate data set pair readers, single data set pairs readers. options described .","code":"Range_of_ages 0 25"},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/articles/getting_started.html","id":"separate-data-sets","dir":"Articles","previous_headings":"Input files > Data file","what":"Separate Data Sets","title":"Estimating ageing error using the TMB model written by André Punt","text":"pair readers (often first second reads reader) one section header Data_set_x (x=1, 2, etc). four lines immediately header number rows paired age determinations (described ) number readers data set (always 2 SESSF) minus group, plus group, reference age reader numbers remainder data set comprises one row data pair age determinations following format. columns reader (1-6) represent age, left column represents number times pair ages assigned two readers. columns readers () need filled -999. second (potentially third) data set follow format first data set, data associated next pair readers (see ). headers data set need headers numbered 1 NDataSet input CreateData(). , NDataSet=3, data file needs sections header Data_set_1, Data_set_2, Data_set_3.","code":"Data_set_1 141 # number of lines 2 # Number of readers 1 20 5 # minus group; plus group; reference age 1 2 3 4 # Which readers 9 0 0 -999 -999 1 0 10 -999 -999 153 1 1 -999 -999 25 1 2 -999 -999 ... 2 23 23 -999 -999 1 24 23 -999 -999 2 24 24 -999 -999 1 25 24 -999 -999 Data_set_2 123 # number of lines 2 # Number of readers 1 20 5 # minus group; plus group; reference age 3 4 1 2 # which readers 27 1 1 -999 -999 13 1 2 -999 -999 3 2 1 -999 -999 227 2 2 -999 -999 ... 2 22 20 -999 -999 1 22 21 -999 -999 1 23 21 -999 -999 1 23 22 -999 -999"},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/articles/getting_started.html","id":"combined-data-set","dir":"Articles","previous_headings":"Input files > Data file","what":"Combined Data Set","title":"Estimating ageing error using the TMB model written by André Punt","text":"alternative separate data sets pair readers combine multiple pairs readers single data set shown . format number readers now 4 data second pair readers follows end first pair.","code":"Data_set_1 264 # number of lines 4 # Number of readers 0 25 5 # minus group; plus group; reference age 1 2 3 4 # Which readers 9 0 0 -999 -999 1 0 10 -999 -999 153 1 1 -999 -999 30 1 2 -999 -999 ... 1 24 23 -999 -999 2 24 24 -999 -999 1 25 24 -999 -999 27 -999 -999 1 1 13 -999 -999 1 2 3 -999 -999 2 1 ... 2 -999 -999 22 20 1 -999 -999 22 21 1 -999 -999 23 21 1 -999 -999 23 22"},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/articles/getting_started.html","id":"other-considerations","dir":"Articles","previous_headings":"Input files > Data file","what":"Other Considerations","title":"Estimating ageing error using the TMB model written by André Punt","text":"Note ages need whole numbers data file. C++ code adds 0.5 age model fitting midpoint age bin. Different agencies created R code specific format ageing comparison data format package. instance CSIRO uses R package SESSFdataproc hosts examples assessment repository SESSFassessments. version code available CSIRO. usually create data file Excel (using summarised output R code) paste text file. data file read R using function CreateData() described examples .","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/articles/getting_started.html","id":"specifications-file","dir":"Articles","previous_headings":"Input files","what":"Specifications file","title":"Estimating ageing error using the TMB model written by André Punt","text":"age-estimates least one age-readers must assumed unbiased (sensitivity choice age-reader examined uncertainty age-reader likely unbiased). options bias precision described entered specifications file (.spc extension), example provided description model options.","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/articles/getting_started.html","id":"bias-options","dir":"Articles","previous_headings":"Input files > Specifications file","what":"Bias options","title":"Estimating ageing error using the TMB model written by André Punt","text":"available options bias : -x Assume relationship expected age true age reader x. [Note ‘’x’’ must lower number reader bias defined. Reader 2 can BiasOpt=-1 match reader 1]. 0 Age-estimates unbiased. 1 expected age animal age \\(\\), \\(E_a\\), linear function true age, .e. \\(E_a =\\alpha \\) (constant coefficient variation). 2 expected age animal age \\(\\), \\(E_a\\), given : \\[E_a = E_L + (E_H - E_L)\\frac{1-\\text{exp}(-\\beta(-1))}{1-\\text{exp}(-\\beta(a_{max}-1))}\\]. C++ code (AgeingError.cpp) also conditional () statements Bias options 4 5 identical option 0 (unbiased) therefore presumably placeholders future options. SESSF typically assume readers unbiased (BiasOpt=0), however, important check assumption using residual plots (André Punt pers. comm.)","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/articles/getting_started.html","id":"sigma-options","dir":"Articles","previous_headings":"Input files > Specifications file","what":"Sigma options","title":"Estimating ageing error using the TMB model written by André Punt","text":"available options random ageing precision : -x. Assume relationship variance age-reading error true age reader x [note ‘’x’’ must lower number reader bias defined]. 1 option assumes constant coefficient variation, one parameter needs specified pair independent readers specification (.spc) file. standard deviation random age-reading error, \\(\\sigma_a\\), linear function true age, .e.: \\[ \\sigma_a = \\begin{cases} \\gamma & \\text{ } =0 \\\\ \\gamma & \\text{otherwise} \\\\ \\end{cases} \\] 2 parameters relate standard deviation (Michaelis-Menten equation). option three parameters need specified pair independent readers specification (.spc) file. standard deviation random age-reading error, \\(\\sigma_a\\), given : \\[ \\sigma_a = \\begin{cases} \\sigma_L + (\\sigma_H - \\sigma_L)\\frac{1}{1-exp(-\\delta(a_{max}-1))} & \\text{ } =0 \\\\ \\sigma_L + (\\sigma_H - \\sigma_L)\\frac{1-exp(-\\delta(-1))}{1-exp(-\\delta(a_{max}-1))} & \\text{otherwise} \\\\ \\end{cases} \\] 3 parameters relate coefficient variation (Michaelis-Menten equation). option three parameters need specified pair independent readers specification (.spc) file. coefficient variation random age-reading error, \\(CV_a\\), given : \\[ CV_a = \\begin{cases} CV_L + (CV_H - CV_L)\\frac{1}{1-\\text{exp}(-\\delta(a_{max}-1))} & \\text{ } =0 \\\\ CV_L + (CV_H - CV_L)\\frac{1-\\text{exp}(-\\delta(-1))}{1-\\text{exp}(-\\delta(a_{max}-1))} & \\text{otherwise} \\\\ \\end{cases} \\] 4 estimates age exact (use option ‘’known age’’ individuals). option returns vector zeroes (perhaps just single zero). 5 standard deviation random age-reading error, \\(\\sigma_a\\), spline function age (Forsythe, Malcolm, Moler type spline implemented tmbutils::splinefun()). number location (ages) knots must specified, number parameters equal number knots. Bounds initial parameters need specified log space. 6 standard deviation random age-reading error, \\(\\sigma_a\\), piecewise linear function age. number location (ages) knots must specified, number parameters equal number knots. Bounds initial parameters need specified log space. 7 linear change standard deviation random age-reading error, \\(\\sigma_a\\), age. option two parameters need specified pair independent readers specifications (.spc) file. 8 linear change coefficient variation random age-reading error, \\(CV_a\\) , age. option two parameters need specified pair independent readers specifications (.spc) file.","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/articles/getting_started.html","id":"example-specifications-file","dir":"Articles","previous_headings":"Input files > Specifications file","what":"Example Specifications file","title":"Estimating ageing error using the TMB model written by André Punt","text":".spc file contains three four sections: 1. reader specification, 2. knots splines breakpoints piecewise linear functions (used), 3. bias parameters, 4. sigma parameters. first section specifies Bias Sigma options reader. reader, one line specifies Bias Sigma options. SigmaOpt=-x used assume relationship expected age true age reader x [note x must lower number reader bias defined]. example (Blue Grenadier) shows two pairs readers (1-2 & 3-4) specified unbiased (BiasOpt=0) readers 1 2 ageing precision SigmaOpt=2. model requires three parameters specified (presumably \\(\\sigma_L\\), \\(\\sigma_H\\), \\(\\delta\\)) pair readers (case Blue Grenadier first second reads two readers). second (optional) section species knots spline linear interpolation models. example taken School Whiting (WHS2.spc). specifies five knots first last knots minimum maximum ages. Note text “# Spline specifications” “# Linear specifications” required code SigmaOpt options 5 6 used. next section specifies conditions Bias parameters estimated. need provide bounds, initial values whether parameter estimated (1) pre-specified (0) initial value. Bias=0 (case SESSF stocks) section blank (NULL), although retain heading (sure heading needed). Sablefish example (Sable.spc) provides example implement bias within ageing error estimation. final section specifies conditions Sigma parameters estimated. Like , need provide bounds, initial values whether parameter estimated (1). One set parameter bounds, initial values /needs provide group readers assume ageing uncertainty (group x/-x). example (SigmaOpt=2) three parameters pair readers.","code":"# reader BiasOpt SigmaOpt 1 0 2 2 0 -1 3 0 2 4 0 -3 # Spline specifications 5 0 3 5 7 9 # Linear specifications 5 0 3 5 7 9 Bias_Pars (low high init, on/off) Sigma_Pars (low high init, on/off) 0 1 0.2 1 # Readers 1 & 2 0.01 1 0.2 1 0 2 0.5 1 0 1 0.2 1 # Readers 3 & 4 0.01 1 0.2 1 0 2 0.5 1"},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/articles/getting_started.html","id":"examples","dir":"Articles","previous_headings":"","what":"Examples","title":"Estimating ageing error using the TMB model written by André Punt","text":"examples focus SESSF species, specify (BiasOpt=0). bias age readings suspected, example implement bias within ageing error estimation provided Sablefish example (Sable.spc).","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/articles/getting_started.html","id":"blue-grenadier","dir":"Articles","previous_headings":"Examples","what":"Blue Grenadier","title":"Estimating ageing error using the TMB model written by André Punt","text":"Blue Grenadier (Macruronus novaezelandiae) deep water species caught trawl south eastern Australia (Tuck Bessell-Browne 2022). age readings two separate readers re-read reads (.e. inter-reader comparisons production data). 2022, estimating ageing error Blue Grenadier challenging, requiring removal problematic data, different models reader improvements model source code. work example . function load data file R isn’t currently exported ageing error R package need use ::: access . Note using data file single data set set NDataSet=1. set verbose=TRUE summary loaded data printed console. Check matches input file, things worth checking include, last line data set. total number reads reader pair. number readers order. plus, minus reference ages. ’s warning potentially missing data, occurs ages minimum age maximum age, however, warning appear correct case. Possibly -999 values data causing warning <0. Next load model specifications using CreateSpecs function. function exported either need call package name ::: access . function creates nested list one list element reader data. setting verbose=TRUE, list print console can check inputs read correctly. Note reader -x Sigma option (.e. relationship expected age true age reader x) parameter values. output function varies model specified (.e. knots zero unless spline piecewise linear model specified - sigma options 5 6). Ageing error estimated using function DoApplyAgeError. function exported R package can called directly. need provide name (Species argument), data, model specs, specify weights (AprobWght SlopeWght) name subdirectory save output (gets created doesn’t exist). set verbose=FALSE example large amount output printed screen. model stored list object BG2022_mod information along data model specifications saved output directory lda file name Species (case “BG2022.lda”). Examine structure model object save model output using ProcessResults function, using ::: function also isn’t exported. want specify effective sample size estimated (CalcEff = TRUE) produces fits individual data points can used identify outliers may impacting model convergence. model creates several output files contain ageing error estimates information need assess fit set verbose = FALSE. following files output subdirectory (case Results). report file (.rpt extension) contains convergence criteria, model specifications, parameter estimates uncertainty ageing error matrices reader (note readers bias sigma option -x identical reader x). LDA file (.lda extension) containing data model specifications. One csv file (.csv extension) reader contains estimated standard deviation coefficient variation age (note readers bias sigma option -x identical reader x). series png file (.png extension) contain plots data model residuals. examination report file (BG2022.rpt) shows maximum gradient -93.96, indicating model converged. Ideally gradient \\(\\pm \\text{1e-4}\\) zero, however, practice achieving models can time consuming involves removing progressively data sometimes accept gradient ~\\(\\pm \\text{1e-3}\\). residual plots show large number outliers exceeding 95% confidence interval table fits individual data points (bottom report file (present CalcEff = TRUE) shows number data points predicted values 0 (close zero e.g. 10e-10), see line 2 (extracted report file). get closer converged model necessary undertake data trimming (removing observations values predicted values 0), specify different ageing error model second reader prespecify (.e. fix) one parameters second reader. done stepwise manner, small changes made, model run results examined changes made achieved final model considered acceptable. refit final model (BG2022_trim_8_1). Load data file. Note number lines data reduced 264 252. Next load model specifications. second reader (3 4 data) specified linear change standard deviation random age-reading error (SigmaOpt=7) fixed first parameter 0.2. run final model. earlier model save results. model now close convergence (gradient = -0.00143) residual plots show concerning features estimates ageing error standard deviation increasing age.","code":"data_dir <- system.file(\"extdata\", package = \"AgeingError\") BG2022_dat <- AgeingError:::CreateData(file.path(data_dir, \"BG2022.dat\"), NDataSet=1, verbose=TRUE, EchoFile=\"BG2022echo.out\") ## readers 1 2 3 4 ## Last line of data set 1 is 1 -999 -999 23 22 ## WARNING - there are some missing data; the effective sample size calculation may be dubious, ## ## Number of rows in NrowStruc 2 ## [1] 2 ## [1] \"ReaderStruc\" ## [,1] [,2] [,3] [,4] [,5] [,6] ## [1,] 1 6099 1 2 0 0 ## [2,] 1 4512 0 0 3 4 ## [1] \"ReaderSumm\" ## [,1] [,2] [,3] ## [1,] 0 0 2 ## [1] \"ReaderSumm\" ## [,1] [,2] [,3] ## [1,] 1 2 2 ## List of 16 ## $ MinAge : num 0 ## $ MaxAge : num 25 ## $ NDataSet : num 1 ## $ MaxReader : num 4 ## $ TheData : num [1, 1:264, 1:5] 9 1 153 30 1 12 454 51 33 499 ... ## $ Npnt : num 264 ## $ ReadPnt : num [1, 1:4] 1 2 3 4 ## $ NReaders : num 4 ## $ MinusA : num 0 ## $ PlusA : num 25 ## $ RefAge : num 5 ## $ ReaderSumm : num [1, 1:3] 1 2 2 ## $ ReaderStruc: num [1:2, 1:6] 1 1 6099 4512 1 ... ## $ MaxCells : num 676 ## $ TotalN : num 10611 ## $ EffN : num 10611 ## NULL BG2022_spc <- AgeingError:::CreateSpecs(file.path(data_dir, \"BG2022.spc\"), DataSpecs=BG2022_dat, verbose=TRUE) ## List of 7 ## $ ModelSpecs:List of 4 ## ..$ :List of 10 ## .. ..$ BiasOpt : num 0 ## .. ..$ SigOpt : num 2 ## .. ..$ BiasPar : NULL ## .. ..$ BiasLow : NULL ## .. ..$ BiasHi : NULL ## .. ..$ BiasUsed : NULL ## .. ..$ SigmaPar : num [1:3] 0.2 0.001 0.5 ## .. ..$ SigmaLow : num [1:3] 0 0.01 0 ## .. ..$ SigmaHi : num [1:3] 1 1 2 ## .. ..$ SigmaUsed: num [1:3] 1 1 1 ## ..$ :List of 10 ## .. ..$ BiasOpt : num 0 ## .. ..$ SigOpt : num -1 ## .. ..$ BiasPar : NULL ## .. ..$ BiasLow : NULL ## .. ..$ BiasHi : NULL ## .. ..$ BiasUsed : NULL ## .. ..$ SigmaPar : NULL ## .. ..$ SigmaLow : NULL ## .. ..$ SigmaHi : NULL ## .. ..$ SigmaUsed: NULL ## ..$ :List of 10 ## .. ..$ BiasOpt : num 0 ## .. ..$ SigOpt : num 2 ## .. ..$ BiasPar : NULL ## .. ..$ BiasLow : NULL ## .. ..$ BiasHi : NULL ## .. ..$ BiasUsed : NULL ## .. ..$ SigmaPar : num [1:3] 0.2 0.001 0.5 ## .. ..$ SigmaLow : num [1:3] 0 0.01 0 ## .. ..$ SigmaHi : num [1:3] 1 1 2 ## .. ..$ SigmaUsed: num [1:3] 1 1 1 ## ..$ :List of 10 ## .. ..$ BiasOpt : num 0 ## .. ..$ SigOpt : num -3 ## .. ..$ BiasPar : NULL ## .. ..$ BiasLow : NULL ## .. ..$ BiasHi : NULL ## .. ..$ BiasUsed : NULL ## .. ..$ SigmaPar : NULL ## .. ..$ SigmaLow : NULL ## .. ..$ SigmaHi : NULL ## .. ..$ SigmaUsed: NULL ## $ NumSigma : num 6 ## $ NumBias : num 0 ## $ xvalsL : num [1:4, 1:100] 0 0 0 0 0 0 0 0 0 0 ... ## $ nknotsL : num [1:4] 0 0 0 0 ## $ xvals : num [1:4, 1:100] 0 0 0 0 0 0 0 0 0 0 ... ## $ nknots : num [1:4] 0 0 0 0 ## NULL BG2022_mod <- AgeingError::DoApplyAgeError(Species = \"BG2022\", DataSpecs = BG2022_dat, ModelSpecsInp = BG2022_spc, AprobWght = 1e-06, SlopeWght = 0.01, SaveDir = \"Results\", verbose = FALSE) str(BG2022_mod) ## List of 12 ## $ par : Named num [1:31] 0.1672 0.2357 0.5399 0.2418 0.0247 ... ## ..- attr(*, \"names\")= chr [1:31] \"SDPar\" \"SDPar\" \"SDPar\" \"SDPar\" ... ## $ fn :function (x) ## $ gr :function (x = last.par[lfixed()], ...) ## $ he :function (x = last.par[lfixed()], atomic = usingAtomics()) ## $ hessian : logi FALSE ## $ method : chr \"BFGS\" ## $ retape :function (set.defaults = TRUE) ## $ env : ## $ report :function (par = last.par) ## $ simulate:function (par = last.par, complete = FALSE) ## $ fn_orig :function (x = last.par[lfixed()], ...) ## $ fitv : num 40778 BG2022_out <- AgeingError:::ProcessResults(Species = \"BG2022\", SaveDir = \"Results\", CalcEff = TRUE, verbose = FALSE) Data set: 1 Data_set Group Group Line Readers Obs Obs_Numbers Pred_Numbers Data Point: 1 1 1 1 0 0 -1 -1 9 15.6581407 9.241041710732 Data Point: 1 1 1 2 0 10 -1 -1 1 1.7397934 0 Data Point: 1 1 1 3 1 1 -1 -1 153 266.1883915 186.217154197499 BG2022final_dat <- AgeingError:::CreateData(file.path(data_dir, \"BG2022_trim_8_1.dat\"), NDataSet=1, verbose=TRUE, EchoFile=\"BG2022finalecho.out\") ## readers 1 2 3 4 ## Last line of data set 1 is 1 -999 -999 23 22 ## WARNING - there are some missing data; the effective sample size calculation may be dubious, ## ## Number of rows in NrowStruc 2 ## [1] 2 ## [1] \"ReaderStruc\" ## [,1] [,2] [,3] [,4] [,5] [,6] ## [1,] 1 6079 1 2 0 0 ## [2,] 1 4512 0 0 3 4 ## [1] \"ReaderSumm\" ## [,1] [,2] [,3] ## [1,] 0 0 2 ## [1] \"ReaderSumm\" ## [,1] [,2] [,3] ## [1,] 1 2 2 ## List of 16 ## $ MinAge : num 0 ## $ MaxAge : num 25 ## $ NDataSet : num 1 ## $ MaxReader : num 4 ## $ TheData : num [1, 1:252, 1:5] 153 30 1 12 454 51 33 499 65 3 ... ## $ Npnt : num 252 ## $ ReadPnt : num [1, 1:4] 1 2 3 4 ## $ NReaders : num 4 ## $ MinusA : num 0 ## $ PlusA : num 25 ## $ RefAge : num 5 ## $ ReaderSumm : num [1, 1:3] 1 2 2 ## $ ReaderStruc: num [1:2, 1:6] 1 1 6079 4512 1 ... ## $ MaxCells : num 676 ## $ TotalN : num 10591 ## $ EffN : num 10591 ## NULL BG2022final_spc <- AgeingError:::CreateSpecs(file.path(data_dir, \"BG2022_trim_8_1.spc\"), DataSpecs=BG2022final_dat, verbose=TRUE) ## List of 7 ## $ ModelSpecs:List of 4 ## ..$ :List of 10 ## .. ..$ BiasOpt : num 0 ## .. ..$ SigOpt : num 2 ## .. ..$ BiasPar : NULL ## .. ..$ BiasLow : NULL ## .. ..$ BiasHi : NULL ## .. ..$ BiasUsed : NULL ## .. ..$ SigmaPar : num [1:3] 0.2 0.001 0.5 ## .. ..$ SigmaLow : num [1:3] 0 0.01 0 ## .. ..$ SigmaHi : num [1:3] 1 1 2 ## .. ..$ SigmaUsed: num [1:3] 1 1 1 ## ..$ :List of 10 ## .. ..$ BiasOpt : num 0 ## .. ..$ SigOpt : num -1 ## .. ..$ BiasPar : NULL ## .. ..$ BiasLow : NULL ## .. ..$ BiasHi : NULL ## .. ..$ BiasUsed : NULL ## .. ..$ SigmaPar : NULL ## .. ..$ SigmaLow : NULL ## .. ..$ SigmaHi : NULL ## .. ..$ SigmaUsed: NULL ## ..$ :List of 10 ## .. ..$ BiasOpt : num 0 ## .. ..$ SigOpt : num 7 ## .. ..$ BiasPar : NULL ## .. ..$ BiasLow : NULL ## .. ..$ BiasHi : NULL ## .. ..$ BiasUsed : NULL ## .. ..$ SigmaPar : num [1:2] 0.2 0.5 ## .. ..$ SigmaLow : num [1:2] 0 0 ## .. ..$ SigmaHi : num [1:2] 1 2 ## .. ..$ SigmaUsed: num [1:2] 0 1 ## ..$ :List of 10 ## .. ..$ BiasOpt : num 0 ## .. ..$ SigOpt : num -3 ## .. ..$ BiasPar : NULL ## .. ..$ BiasLow : NULL ## .. ..$ BiasHi : NULL ## .. ..$ BiasUsed : NULL ## .. ..$ SigmaPar : NULL ## .. ..$ SigmaLow : NULL ## .. ..$ SigmaHi : NULL ## .. ..$ SigmaUsed: NULL ## $ NumSigma : num 5 ## $ NumBias : num 0 ## $ xvalsL : num [1:4, 1:100] 0 0 0 0 0 0 0 0 0 0 ... ## $ nknotsL : num [1:4] 0 0 0 0 ## $ xvals : num [1:4, 1:100] 0 0 0 0 0 0 0 0 0 0 ... ## $ nknots : num [1:4] 0 0 0 0 ## NULL BG2022final_mod <- AgeingError::DoApplyAgeError(Species = \"BG2022_trim_8_1\", DataSpecs = BG2022final_dat, ModelSpecsInp = BG2022final_spc, AprobWght = 1e-06, SlopeWght = 0.01, SaveDir = \"Results\", verbose = FALSE) BG2022final_out <- AgeingError:::ProcessResults(Species = \"BG2022_trim_8_1\", SaveDir = \"Results\", CalcEff = TRUE, verbose = FALSE)"},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/articles/getting_started.html","id":"bight-redfish","dir":"Articles","previous_headings":"Examples","what":"Bight Redfish","title":"Estimating ageing error using the TMB model written by André Punt","text":"Bight Redfish (Centroberyx gerrardi) long-lived species caught trawl Great Australian Bight (Curin-Osorio Burch 2022). age readings three separate readers re-read reads (.e. inter-reader comparisons data). check summary information data file. don’t appear problems, however, still getting warning missing data. Next load model specifications using CreateSpecs function. Bight Redfish fit one parameter model assuming expected age linear function true age. assume inter-reader variability (readers ageing uncertainty reader 1). Note specified readers ageing uncertainty (readers 2–6 SigmaOpt=-1), need provide one line sigma parameters. estimate ageing error Bight Redfish. save Bight Redfish model output. examination report file (REB2022.rpt) shows maximum gradient 0.0221, indicating model quite converged. remove four outliers probability <1e-5 also start model estimated value CV (0.0413288). save revised data model specifications (REB2022_trim.dat REB2022_trim.spc) rerun model (note suppress creation output document). final gradient -0.001973, close convergence.","code":"REB2022_dat <- AgeingError:::CreateData(file.path(data_dir, \"REB2022.dat\"), NDataSet=1, verbose=TRUE, EchoFile=\"REB2022echo.out\") ## readers 1 2 3 4 5 6 ## Last line of data set 1 is 1 -999 -999 -999 -999 62 62 ## WARNING - there are some missing data; the effective sample size calculation may be dubious, ## ## Number of rows in NrowStruc 3 ## [1] 3 ## [1] \"ReaderStruc\" ## [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] ## [1,] 1 800 1 2 0 0 0 0 ## [2,] 1 528 0 0 3 4 0 0 ## [3,] 1 682 0 0 0 0 5 6 ## [1] \"ReaderSumm\" ## [,1] [,2] [,3] ## [1,] 0 0 3 ## [1] \"ReaderSumm\" ## [,1] [,2] [,3] ## [1,] 1 2 3 ## List of 16 ## $ MinAge : num 0 ## $ MaxAge : num 64 ## $ NDataSet : num 1 ## $ MaxReader : num 6 ## $ TheData : num [1, 1:511, 1:7] 1 1 3 2 1 1 4 4 1 1 ... ## $ Npnt : num 511 ## $ ReadPnt : num [1, 1:6] 1 2 3 4 5 6 ## $ NReaders : num 6 ## $ MinusA : num 5 ## $ PlusA : num 40 ## $ RefAge : num 15 ## $ ReaderSumm : num [1, 1:3] 1 2 3 ## $ ReaderStruc: num [1:3, 1:8] 1 1 1 800 528 682 1 0 0 2 ... ## $ MaxCells : num 4225 ## $ TotalN : num 2010 ## $ EffN : num 2010 ## NULL REB2022_spc <- AgeingError:::CreateSpecs(file.path(data_dir, \"REB2022.spc\"), DataSpecs=REB2022_dat, verbose=TRUE) ## List of 7 ## $ ModelSpecs:List of 6 ## ..$ :List of 10 ## .. ..$ BiasOpt : num 0 ## .. ..$ SigOpt : num 1 ## .. ..$ BiasPar : NULL ## .. ..$ BiasLow : NULL ## .. ..$ BiasHi : NULL ## .. ..$ BiasUsed : NULL ## .. ..$ SigmaPar : num 0.1 ## .. ..$ SigmaLow : num 0.001 ## .. ..$ SigmaHi : num 10 ## .. ..$ SigmaUsed: num 1 ## ..$ :List of 10 ## .. ..$ BiasOpt : num 0 ## .. ..$ SigOpt : num -1 ## .. ..$ BiasPar : NULL ## .. ..$ BiasLow : NULL ## .. ..$ BiasHi : NULL ## .. ..$ BiasUsed : NULL ## .. ..$ SigmaPar : NULL ## .. ..$ SigmaLow : NULL ## .. ..$ SigmaHi : NULL ## .. ..$ SigmaUsed: NULL ## ..$ :List of 10 ## .. ..$ BiasOpt : num 0 ## .. ..$ SigOpt : num -1 ## .. ..$ BiasPar : NULL ## .. ..$ BiasLow : NULL ## .. ..$ BiasHi : NULL ## .. ..$ BiasUsed : NULL ## .. ..$ SigmaPar : NULL ## .. ..$ SigmaLow : NULL ## .. ..$ SigmaHi : NULL ## .. ..$ SigmaUsed: NULL ## ..$ :List of 10 ## .. ..$ BiasOpt : num 0 ## .. ..$ SigOpt : num -1 ## .. ..$ BiasPar : NULL ## .. ..$ BiasLow : NULL ## .. ..$ BiasHi : NULL ## .. ..$ BiasUsed : NULL ## .. ..$ SigmaPar : NULL ## .. ..$ SigmaLow : NULL ## .. ..$ SigmaHi : NULL ## .. ..$ SigmaUsed: NULL ## ..$ :List of 10 ## .. ..$ BiasOpt : num 0 ## .. ..$ SigOpt : num -1 ## .. ..$ BiasPar : NULL ## .. ..$ BiasLow : NULL ## .. ..$ BiasHi : NULL ## .. ..$ BiasUsed : NULL ## .. ..$ SigmaPar : NULL ## .. ..$ SigmaLow : NULL ## .. ..$ SigmaHi : NULL ## .. ..$ SigmaUsed: NULL ## ..$ :List of 10 ## .. ..$ BiasOpt : num 0 ## .. ..$ SigOpt : num -1 ## .. ..$ BiasPar : NULL ## .. ..$ BiasLow : NULL ## .. ..$ BiasHi : NULL ## .. ..$ BiasUsed : NULL ## .. ..$ SigmaPar : NULL ## .. ..$ SigmaLow : NULL ## .. ..$ SigmaHi : NULL ## .. ..$ SigmaUsed: NULL ## $ NumSigma : num 1 ## $ NumBias : num 0 ## $ xvalsL : num [1:6, 1:100] 0 0 0 0 0 0 0 0 0 0 ... ## $ nknotsL : num [1:6] 0 0 0 0 0 0 ## $ xvals : num [1:6, 1:100] 0 0 0 0 0 0 0 0 0 0 ... ## $ nknots : num [1:6] 0 0 0 0 0 0 ## NULL REB2022_mod <- AgeingError::DoApplyAgeError(Species = \"REB2022\", DataSpecs = REB2022_dat, ModelSpecsInp = REB2022_spc, AprobWght = 1e-06, SlopeWght = 0.01, SaveDir = \"Results\", verbose = FALSE) REB2022_out <- AgeingError:::ProcessResults(Species = \"REB2022\", SaveDir = \"Results\", CalcEff = TRUE, verbose = FALSE) REB2022_dat2 <- AgeingError:::CreateData(file.path(data_dir, \"REB2022_trim.dat\"), NDataSet=1, verbose=FALSE, EchoFile=\"REB2022_trimecho.out\") REB2022_spc2 <- AgeingError:::CreateSpecs(file.path(data_dir, \"REB2022_trim.spc\"), DataSpecs=REB2022_dat2, verbose=FALSE) REB2022_mod2 <- AgeingError::DoApplyAgeError(Species = \"REB2022_final\", DataSpecs = REB2022_dat2, ModelSpecsInp = REB2022_spc2, AprobWght = 1e-06, SlopeWght = 0.01, SaveDir = \"Results\", verbose = FALSE) REB2022_out2 <- AgeingError:::ProcessResults(Species = \"REB2022_final\", SaveDir = \"Results\", CalcEff = TRUE, verbose = FALSE)"},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/articles/getting_started.html","id":"school-whiting","dir":"Articles","previous_headings":"Examples","what":"School Whiting","title":"Estimating ageing error using the TMB model written by André Punt","text":"School Whiting (Sillago flindersi) short-lived species caught Danish seine trawl south eastern Australia (Day et al. 2020). species provides example data file three separate data sets spline model. Load School Whiting data file, make sure set number data sets three (NDataSet=3). Make sure check summary values data file. Load specifications School Whiting. School Whiting fit spline function (SigmaOption=5) five knots (0, 3, 5, 7, 9). Note initial parameter values log space. Fit ageing error model save results maximum gradient ~2.3-05 indicating model converged. estimated standard deviation age shows ageing uncertainty increasing age 0 age 4, declining ages 5 6 increasing substantially ages 7–9. fits far right hand side age distribution poor little data inform model region. appropriateness model discussed ageing technicians.","code":"WHS2_dat <- AgeingError:::CreateData(file.path(data_dir, \"WHS2.dat\"), NDataSet=3, verbose=TRUE, EchoFile=\"WHS2echo.out\") ## readers 1 2 ## readers 3 4 ## readers 5 6 ## Last line of data set 1 is 1 9 9 ## Last line of data set 2 is 2 8 8 ## Last line of data set 3 is 1 8 7 ## Number of rows in NrowStruc 3 ## [1] 3 ## [1] \"ReaderStruc\" ## [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] ## [1,] 1 1882 1 2 0 0 0 0 ## [2,] 2 366 3 4 0 0 0 0 ## [3,] 3 385 5 6 0 0 0 0 ## [1] \"ReaderSumm\" ## [,1] [,2] [,3] ## [1,] 0 0 1 ## [2,] 0 0 1 ## [3,] 0 0 1 ## [1] \"ReaderSumm\" ## [,1] [,2] [,3] ## [1,] 1 2 1 ## [2,] 2 2 1 ## [3,] 3 2 1 ## List of 16 ## $ MinAge : num 0 ## $ MaxAge : num 9 ## $ NDataSet : num 3 ## $ MaxReader : num 6 ## $ TheData : num [1:3, 1:27, 1:7] 1 4 11 112 1 2 22 25 1 1 ... ## $ Npnt : num [1:3] 27 23 22 ## $ ReadPnt : num [1:3, 1:6] 1 3 5 2 4 6 0 0 0 0 ... ## $ NReaders : num [1:3] 2 2 2 ## $ MinusA : num [1:3] 0 0 0 ## $ PlusA : num [1:3] 9 9 9 ## $ RefAge : num [1:3] 5 5 5 ## $ ReaderSumm : num [1:3, 1:3] 1 2 3 2 2 2 1 1 1 ## $ ReaderStruc: num [1:3, 1:8] 1 2 3 1882 366 ... ## $ MaxCells : num 100 ## $ TotalN : num [1:3] 1882 366 385 ## $ EffN : num [1:3] 1882 366 385 ## NULL WHS2_spc <- AgeingError:::CreateSpecs(file.path(data_dir, \"WHS2.spc\"), DataSpecs=WHS2_dat, verbose=TRUE) ## Spline used to define SD for reader 1 ## Selected knots are located at 0 3 5 7 9 ## List of 7 ## $ ModelSpecs:List of 6 ## ..$ :List of 10 ## .. ..$ BiasOpt : num 0 ## .. ..$ SigOpt : num 5 ## .. ..$ BiasPar : NULL ## .. ..$ BiasLow : NULL ## .. ..$ BiasHi : NULL ## .. ..$ BiasUsed : NULL ## .. ..$ SigmaPar : num [1:5] -2.303 -1.204 -0.693 -0.105 0.9 ## .. ..$ SigmaLow : num [1:5] -10 -10 -10 -10 -10 ## .. ..$ SigmaHi : num [1:5] 40 40 40 40 40 ## .. ..$ SigmaUsed: num [1:5] 1 1 1 1 1 ## ..$ :List of 10 ## .. ..$ BiasOpt : num 0 ## .. ..$ SigOpt : num -1 ## .. ..$ BiasPar : NULL ## .. ..$ BiasLow : NULL ## .. ..$ BiasHi : NULL ## .. ..$ BiasUsed : NULL ## .. ..$ SigmaPar : NULL ## .. ..$ SigmaLow : NULL ## .. ..$ SigmaHi : NULL ## .. ..$ SigmaUsed: NULL ## ..$ :List of 10 ## .. ..$ BiasOpt : num 0 ## .. ..$ SigOpt : num -1 ## .. ..$ BiasPar : NULL ## .. ..$ BiasLow : NULL ## .. ..$ BiasHi : NULL ## .. ..$ BiasUsed : NULL ## .. ..$ SigmaPar : NULL ## .. ..$ SigmaLow : NULL ## .. ..$ SigmaHi : NULL ## .. ..$ SigmaUsed: NULL ## ..$ :List of 10 ## .. ..$ BiasOpt : num 0 ## .. ..$ SigOpt : num -1 ## .. ..$ BiasPar : NULL ## .. ..$ BiasLow : NULL ## .. ..$ BiasHi : NULL ## .. ..$ BiasUsed : NULL ## .. ..$ SigmaPar : NULL ## .. ..$ SigmaLow : NULL ## .. ..$ SigmaHi : NULL ## .. ..$ SigmaUsed: NULL ## ..$ :List of 10 ## .. ..$ BiasOpt : num 0 ## .. ..$ SigOpt : num -1 ## .. ..$ BiasPar : NULL ## .. ..$ BiasLow : NULL ## .. ..$ BiasHi : NULL ## .. ..$ BiasUsed : NULL ## .. ..$ SigmaPar : NULL ## .. ..$ SigmaLow : NULL ## .. ..$ SigmaHi : NULL ## .. ..$ SigmaUsed: NULL ## ..$ :List of 10 ## .. ..$ BiasOpt : num 0 ## .. ..$ SigOpt : num -1 ## .. ..$ BiasPar : NULL ## .. ..$ BiasLow : NULL ## .. ..$ BiasHi : NULL ## .. ..$ BiasUsed : NULL ## .. ..$ SigmaPar : NULL ## .. ..$ SigmaLow : NULL ## .. ..$ SigmaHi : NULL ## .. ..$ SigmaUsed: NULL ## $ NumSigma : num 5 ## $ NumBias : num 0 ## $ xvalsL : num [1:6, 1:100] 0 0 0 0 0 0 0 0 0 0 ... ## $ nknotsL : num [1:6] 0 0 0 0 0 0 ## $ xvals : num [1:6, 1:100] 0 0 0 0 0 0 3 0 0 0 ... ## $ nknots : num [1:6] 5 0 0 0 0 0 ## NULL WHS2_mod <- AgeingError::DoApplyAgeError(Species = \"WHS2\", DataSpecs = WHS2_dat, ModelSpecsInp = WHS2_spc, AprobWght = 1e-06, SlopeWght = 0.01, SaveDir = \"Results\", verbose = FALSE) WHS2_out <- AgeingError:::ProcessResults(Species = \"WHS2\", SaveDir = \"Results\", CalcEff = TRUE, verbose = FALSE)"},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/articles/getting_started.html","id":"sablefish","dir":"Articles","previous_headings":"Examples","what":"Sablefish","title":"Estimating ageing error using the TMB model written by André Punt","text":"Sablefish (Anoplopoma fimbria) provides example using bias option. check summary information data file. data set several inter-reader comparisons. load model specifications using CreateSpecs function. Sablefish example fits three separate series (1-2, 3-4 & 5-6). model assumes following: Bias Options: Reader 5 unbiased, readers 1 & 2 constant bias, reader 6 separate constant bias bias readers 3 & 4 follows Michaelis-Menten relationship. specifications file first list relates constant bias readers 1 & 2, next three lines readers 3 & 4, final line specifies constant bias reader 6. Reader 5 assumed unbiased therefore doesn’t require parameters specified. Sigma Options: Readers 1 & 2 assume linear relationship (constant CV), readers 5 & 6 separate linear relationship. Readers 3 & 4 assume ageing uncertainty follows Michaelis-Menten relationship. parameters specified manner bias option (). code can used fit Sablefish ageing error model. don’t run particular model slow.","code":"Sable_dat <- AgeingError:::CreateData(file.path(data_dir, \"Sable.dat\"), NDataSet=1, verbose=TRUE, EchoFile=\"SableEcho.out\") ## readers 1 2 3 4 5 6 ## Last line of data set 1 is 6 -999 -999 -999 -999 2 2 ## WARNING - there are some missing data; the effective sample size calculation may be dubious, ## ## Number of rows in NrowStruc 6 ## [1] 6 ## [1] \"ReaderStruc\" ## [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] ## [1,] 1 8659 1 2 0 0 0 0 ## [2,] 1 282 0 2 3 0 0 0 ## [3,] 1 8138 0 0 3 4 0 0 ## [4,] 1 226 0 0 0 4 5 0 ## [5,] 1 138 0 2 0 0 5 0 ## [6,] 1 3234 0 0 0 0 5 6 ## [1] \"ReaderSumm\" ## [,1] [,2] [,3] ## [1,] 0 0 6 ## [1] \"ReaderSumm\" ## [,1] [,2] [,3] ## [1,] 1 2 6 ## List of 16 ## $ MinAge : num 1 ## $ MaxAge : num 100 ## $ NDataSet : num 1 ## $ MaxReader : num 6 ## $ TheData : num [1, 1:2494, 1:7] 1 1 1 1 1 1 1 1 1 1 ... ## $ Npnt : num 2494 ## $ ReadPnt : num [1, 1:6] 1 2 3 4 5 6 ## $ NReaders : num 6 ## $ MinusA : num 1 ## $ PlusA : num 50 ## $ RefAge : num 4 ## $ ReaderSumm : num [1, 1:3] 1 2 6 ## $ ReaderStruc: num [1:6, 1:8] 1 1 1 1 1 ... ## $ MaxCells : num 10201 ## $ TotalN : num 20677 ## $ EffN : num 20677 ## NULL Sable_spc <- AgeingError:::CreateSpecs(file.path(data_dir, \"Sable.spc\"), DataSpecs=Sable_dat, verbose=TRUE) ## List of 7 ## $ ModelSpecs:List of 6 ## ..$ :List of 10 ## .. ..$ BiasOpt : num 1 ## .. ..$ SigOpt : num 1 ## .. ..$ BiasPar : num 1 ## .. ..$ BiasLow : num 0.001 ## .. ..$ BiasHi : num 3 ## .. ..$ BiasUsed : num 1 ## .. ..$ SigmaPar : num 1 ## .. ..$ SigmaLow : num 0.001 ## .. ..$ SigmaHi : num 100 ## .. ..$ SigmaUsed: num 1 ## ..$ :List of 10 ## .. ..$ BiasOpt : num -1 ## .. ..$ SigOpt : num -1 ## .. ..$ BiasPar : NULL ## .. ..$ BiasLow : NULL ## .. ..$ BiasHi : NULL ## .. ..$ BiasUsed : NULL ## .. ..$ SigmaPar : NULL ## .. ..$ SigmaLow : NULL ## .. ..$ SigmaHi : NULL ## .. ..$ SigmaUsed: NULL ## ..$ :List of 10 ## .. ..$ BiasOpt : num 2 ## .. ..$ SigOpt : num 2 ## .. ..$ BiasPar : num [1:3] 1e+00 1e-02 1e+02 ## .. ..$ BiasLow : num [1:3] 1e-03 -1e+01 1e-03 ## .. ..$ BiasHi : num [1:3] 10 1 200 ## .. ..$ BiasUsed : num [1:3] 1 1 1 ## .. ..$ SigmaPar : num [1:3] 1 0.01 10 ## .. ..$ SigmaLow : num [1:3] 1e-03 -1e+01 1e-03 ## .. ..$ SigmaHi : num [1:3] 100 1 100 ## .. ..$ SigmaUsed: num [1:3] 1 1 1 ## ..$ :List of 10 ## .. ..$ BiasOpt : num -3 ## .. ..$ SigOpt : num -3 ## .. ..$ BiasPar : NULL ## .. ..$ BiasLow : NULL ## .. ..$ BiasHi : NULL ## .. ..$ BiasUsed : NULL ## .. ..$ SigmaPar : NULL ## .. ..$ SigmaLow : NULL ## .. ..$ SigmaHi : NULL ## .. ..$ SigmaUsed: NULL ## ..$ :List of 10 ## .. ..$ BiasOpt : num 0 ## .. ..$ SigOpt : num 1 ## .. ..$ BiasPar : NULL ## .. ..$ BiasLow : NULL ## .. ..$ BiasHi : NULL ## .. ..$ BiasUsed : NULL ## .. ..$ SigmaPar : num 1 ## .. ..$ SigmaLow : num 0.001 ## .. ..$ SigmaHi : num 100 ## .. ..$ SigmaUsed: num 1 ## ..$ :List of 10 ## .. ..$ BiasOpt : num 1 ## .. ..$ SigOpt : num -5 ## .. ..$ BiasPar : num 1 ## .. ..$ BiasLow : num 0.001 ## .. ..$ BiasHi : num 3 ## .. ..$ BiasUsed : num 1 ## .. ..$ SigmaPar : NULL ## .. ..$ SigmaLow : NULL ## .. ..$ SigmaHi : NULL ## .. ..$ SigmaUsed: NULL ## $ NumSigma : num 5 ## $ NumBias : num 5 ## $ xvalsL : num [1:6, 1:100] 0 0 0 0 0 0 0 0 0 0 ... ## $ nknotsL : num [1:6] 0 0 0 0 0 0 ## $ xvals : num [1:6, 1:100] 0 0 0 0 0 0 0 0 0 0 ... ## $ nknots : num [1:6] 0 0 0 0 0 0 ## NULL ## run the Sablefish model Sable_mod <- AgeingError::DoApplyAgeError(Species = \"Sable\", DataSpecs = Sable_dat, ModelSpecsInp = Sable_spc, AprobWght = 1e-06, SlopeWght = 0.01, SaveDir = \"Results\", verbose = FALSE) ## save the model results Sable_out <- AgeingError:::ProcessResults(Species = \"Sable\", SaveDir = \"Results\", CalcEff = TRUE, verbose = FALSE)"},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/articles/getting_started.html","id":"trouble-shooting","dir":"Articles","previous_headings":"","what":"Trouble Shooting","title":"Estimating ageing error using the TMB model written by André Punt","text":"suggestions getting converged model provided . Vary initial values parameters specifications file. models close convergence, re-run model using estimated parameters initial values. Problematic data can identified residual plots bottom report file prediction probabilities <1e-5. Removing data low probability can improve fit. may sufficient data estimate ageing error multiple combinations readers, data can pooled estimate fewer parameters (bias / sigma option -x) model may appropriate, select different model based residual plots. Prespecify (fix) one parameters pair readers.","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/articles/getting_started.html","id":"acknowledgements","dir":"Articles","previous_headings":"","what":"Acknowledgements","title":"Estimating ageing error using the TMB model written by André Punt","text":"Fish Ageing Services https://www.fishageingservices.com/ provided data Blue Grenadier, Bight Redfish, School Whiting Australian Fisheries Management Authority (AFMA) provided funding data collection otolith reading. sablefish age data provided NWFSC. document prepared documentation examples written André Punt. Pia Bessell-Browne provided helpful comments improved document.","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/articles/getting_started.html","id":"references","dir":"Articles","previous_headings":"","what":"References","title":"Estimating ageing error using the TMB model written by André Punt","text":"Day, J., Hall, K., Bessell-Browne, P., Sporcic, M. (2020) School Whiting (Sillago flindersi) stock assessment based data 2019. discussion SERAG, December 2020. Curin-Osorio, S., Burch, P. (2022). Bight Redfish (Centroberyx gerrardi) stock assessment based data 2021-22. Technical paper presented GABRAG, 22 November 2022, Hobart, Tasmania. Punt, .E., Smith, D.C., KrusicGolub, K., Robertson, S. (2008). Quantifying age-reading error use fisheries stock assessments, application species Australia’s southern eastern scalefish shark fishery. Canadian Journal Fisheries Aquatic Sciences 65: 1991–2005. https://doi.org/10.1139/F08-111 Tuck, G.N., Bessell-Browne, P. (2022). Blue Grenadier (Macruronus novaezelandiae) stock assessment based data 2021. Technical paper presented theSERAG2, 29–-30\\(^{th}\\) November 2022, Melbourne, Victoria. 99pp.","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Andre E. Punt. Author. Kelli F. Johnson. Author. James T. Thorson. Contributor, copyright holder. Ian G. Taylor. Author, maintainer. Paul Burch. Author. Ian J. Stewart. Contributor. Melissa . Haltuch. Contributor.","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Punt AE, Smith DC, KrusicGolub K, Robertson S (2008). “Quantifying age-reading error use fisheries stock assessments, application species Australia's southern eastern scalefish shark fishery.” Canadian Journal Fisheries Aquatic Sciences, 65, 1991–2005. doi:10.1139/F08-11.","code":"@Article{, title = {Quantifying age-reading error for use in fisheries stock assessments, with application to species in {Australia}'s southern and eastern scalefish and shark fishery}, author = {Andre E. Punt and D. C. Smith and K. KrusicGolub and S. Robertson}, year = {2008}, journal = {Canadian Journal of Fisheries and Aquatic Sciences}, volume = {65}, pages = {1991--2005}, doi = {10.1139/F08-11}, }"},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/index.html","id":"description","dir":"","previous_headings":"","what":"Estimating ageing error with TMB from double reads","title":"Estimating ageing error with TMB from double reads","text":"AgeingError Software estimate ageing error given double-reads hard structures (e.g., otoliths)","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/index.html","id":"instructions","dir":"","previous_headings":"","what":"Instructions","title":"Estimating ageing error with TMB from double reads","text":"Install AgeingError package github site follows: See vignette example use.","code":"# using {remotes} remotes::install_github(\"pfmc-assessments/AgeingError\") # using {pak} pak::pak(\"pfmc-assessments/AgeingError\") # Load package library(AgeingError)"},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/AgeingError-package.html","id":null,"dir":"Reference","previous_headings":"","what":"Ageing error software — AgeingError-package","title":"Ageing error software — AgeingError-package","text":"R package support Punt et al. (2008) ageing error model","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/AgeingError-package.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Ageing error software — AgeingError-package","text":"Punt, .E., Smith, D.C., KrusicGolub, K., Robertson, S. 2008. Quantifying age-reading error use fisheries stock assessments, application species Australias southern eastern scalefish shark fishery. Canadian Journal Fisheries Aquatic Sciences 65: 1991-2005.","code":""},{"path":[]},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/AgeingError-package.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Ageing error software — AgeingError-package","text":"Maintainer: Ian G. Taylor ian.taylor@noaa.gov (ORCID) Authors: Andre E. Punt (ORCID) Kelli F. Johnson (ORCID) Paul Burch (ORCID) contributors: James T. Thorson (ORCID) [contributor, copyright holder] Ian J. Stewart [contributor] Melissa . Haltuch (ORCID) [contributor]","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/CreateData.html","id":null,"dir":"Reference","previous_headings":"","what":"Read the ageing error data — CreateData","title":"Read the ageing error data — CreateData","text":"Read ageing error data","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/CreateData.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Read the ageing error data — CreateData","text":"","code":"CreateData(DataFile = \"data.dat\", NDataSet = 1, verbose = FALSE, EchoFile = \"\")"},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/CreateData.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Read the ageing error data — CreateData","text":"DataFile Filename input data NDataSet Number data sets within DataFile verbose Return messages console (addition output EchoFile) EchoFile file path file created appended already exists store information data inputs. default '', leads output printed screen rather saved file. example user-defined input 'EchoTMB.'.","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/CreateData.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Read the ageing error data — CreateData","text":"Andre E. Punt","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/CreateSpecs.html","id":null,"dir":"Reference","previous_headings":"","what":"Read the ageing error specifications — CreateSpecs","title":"Read the ageing error specifications — CreateSpecs","text":"Read ageing error specifications","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/CreateSpecs.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Read the ageing error specifications — CreateSpecs","text":"","code":"CreateSpecs(SpecsFile = \"data.spc\", DataSpecs, verbose = FALSE)"},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/CreateSpecs.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Read the ageing error specifications — CreateSpecs","text":"SpecsFile Filename input specifications. DataSpecs output CreateData() verbose Return messages console (TRUE/FALSE)","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/CreateSpecs.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Read the ageing error specifications — CreateSpecs","text":"Andre E. Punt","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/DoApplyAgeError.html","id":null,"dir":"Reference","previous_headings":"","what":"Run the ageing error optimization routine — DoApplyAgeError","title":"Run the ageing error optimization routine — DoApplyAgeError","text":"Run ageing error optimization routine","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/DoApplyAgeError.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Run the ageing error optimization routine — DoApplyAgeError","text":"","code":"DoApplyAgeError( Species = \"AgeingError\", DataSpecs, ModelSpecsInp, AprobWght = 1e-06, SlopeWght = 0.01, SaveDir = getwd(), verbose = FALSE )"},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/DoApplyAgeError.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Run the ageing error optimization routine — DoApplyAgeError","text":"Species string used create file names. Typically, users use common name species interest, especially saving files multiple species single directory. Though, default \"AgeingError\". DataSpecs data object returned CreateData(). ModelSpecsInp specification object returned CreateSpecs(). AprobWght, SlopeWght Numeric values passed model. defaults 1e-06 0.01. Andre originally hard coded workspace. TODO: decide passed specifications data files. SaveDir path, relative absolute, directory results saved. directory need exist currently created dynamically. verbose logical specifying messages printed. default print, .e., verbose = FALSE.","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/DoApplyAgeError.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Run the ageing error optimization routine — DoApplyAgeError","text":"Andre E. Punt","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/PlotOutputFn.html","id":null,"dir":"Reference","previous_headings":"","what":"Plot output — PlotOutputFn","title":"Plot output — PlotOutputFn","text":"Plots age comparisons results fitted model. Comparisons must conditioned true age observed. , place true age, diagnostic plots generally condition estimated age, fixed mode conditional probability age otolith.","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/PlotOutputFn.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Plot output — PlotOutputFn","text":"","code":"PlotOutputFn( Data, MaxAge, SaveFile, PlotType = c(\"PNG\", \"PDF\"), subplot = 1:3, ReaderNames = NULL, ... )"},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/PlotOutputFn.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Plot output — PlotOutputFn","text":"Data data set first column integer providing number otoliths included row subsequent columns reader lab estimated ag,e reader/lab unique reading error bias. modeling framework allows , , 15 readers, .e., 16 columns. identical rows data frame otoliths exact read every reader/lab combined single row count first column. failed combine identical rows prior running model, alerted error XXX.rep file properly formatted data can ' cut-pasted XXX.dat file use. Missing reads given reader/lab entered -999. Order reader/lab columns similar readers/labs located next one another columns right can mirror columns immediate left terms parameter estimates. MaxAge integer, specifying maximum possible \"true\" age. SaveFile Directory agemat.exe located ADMB intermediate output files located. AdmbFile specified agemat.exe copied directory SaveFile. PlotType string specifying type saved plots desire. default save .png files via argument \"PNG\". option save .pdf files via \"PDF\". subplot Vector integers specifying plots create. default create three plots. ReaderNames Vector names reader, defaults \"Reader 1\", \"Reader 2\", etc. ... Additional arguments passed ageing_comparison().","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/PlotOutputFn.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Plot output — PlotOutputFn","text":"Returns AIC, AICc, BIC fitted model.","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/PlotOutputFn.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Plot output — PlotOutputFn","text":"Error bias reader/lab: panel graph provided panel shows expected standard deviation age reads reader/lab. displayed scatter plot read estimated ages otolith read reader/lab. Proportion--age histogram: estimated proportion age can plotted histogram displayed observed distribution read ages. useful determine hte estimated proportion age generally plausible, e.g., whether many ages estimated proportion age approaches zero, unlikely composite sample moderate effective sample sizes. plot can also used diagnostic confirm AIC selected reasonable values MinusAge PlusAge parameters. function read XXX.rep XXX.par files located SaveFile.","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/PlotOutputFn.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Plot output — PlotOutputFn","text":"Punt, .E., Smith, D.C., KrusicGolub, K., Robertson, S. 2008. Quantifying age-reading error use fisheries stock assessments, application species Australias southern eastern scalefish shark fishery. Can. J. Fish. Aquat. Sci. 65: 1991-2005.","code":""},{"path":[]},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/PlotOutputFn.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Plot output — PlotOutputFn","text":"James T. Thorson, Ian G. Taylor","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/ProcessResults.html","id":null,"dir":"Reference","previous_headings":"","what":"Process results of the ageing error estimation — ProcessResults","title":"Process results of the ageing error estimation — ProcessResults","text":"Process results ageing error estimation","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/ProcessResults.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Process results of the ageing error estimation — ProcessResults","text":"","code":"ProcessResults( Species = \"AgeingError\", SaveDir = getwd(), CalcEff = FALSE, verbose = FALSE )"},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/ProcessResults.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Process results of the ageing error estimation — ProcessResults","text":"Species string used create file names. Typically, users use common name species interest, especially saving files multiple species single directory. Though, default \"AgeingError\". SaveDir path, relative absolute, directory results saved. directory need exist currently created dynamically. CalcEff Calculate effective sample sizes (TRUE/FALSE) verbose logical specifying messages printed. default print, .e., verbose = FALSE.","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/ProcessResults.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Process results of the ageing error estimation — ProcessResults","text":"Andre E. Punt","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/RunFn.html","id":null,"dir":"Reference","previous_headings":"","what":"Run ageing error model — RunFn","title":"Run ageing error model — RunFn","text":"Run Punt et al. (2008) ADMB-based ageing error model within R.","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/RunFn.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Run ageing error model — RunFn","text":"","code":"RunFn( Data, SigOpt, KnotAges, BiasOpt, NDataSets = 1, MinAge, MaxAge, RefAge, MinusAge, PlusAge, MaxSd, MaxExpectedAge, SaveFile, EffSampleSize = 0, Intern = TRUE, AdmbFile = NULL, JustWrite = FALSE, CallType = \"system\", ExtraArgs = \" -est\", verbose = TRUE )"},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/RunFn.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Run ageing error model — RunFn","text":"Data data set first column integer providing number otoliths included row subsequent columns reader lab estimated ag,e reader/lab unique reading error bias. modeling framework allows , , 15 readers, .e., 16 columns. identical rows data frame otoliths exact read every reader/lab combined single row count first column. failed combine identical rows prior running model, alerted error XXX.rep file properly formatted data can ' cut-pasted XXX.dat file use. Missing reads given reader/lab entered -999. Order reader/lab columns similar readers/labs located next one another columns right can mirror columns immediate left terms parameter estimates. SigOpt vector one entry reader (.e., length(SigOpt) == NCOL(Data) -1). entry specifies functional form reading error function true age. Possible entries include following: -0-9+ Mirror standard deviation another reader, negative integer corresponds column reader/lab mirrored minus one, e.g., -1 causes mirror reader/lab 1, data stored second column Data. number must lower -1 times current position vector. 0 error. , potential bias. 1 Constant coefficient variation, .e., 1-parameter linear relationship standard deviation true age. 2 Curvilinear standard deviation, .e., 3-parameter Hollings-form relationship standard deviation true age. 3 Curvilinear coefficient variation, .e., 3-parameter Hollings-form relationship coefficient variation true age. 5 Spline estimated slope beginning end number parameters 2 + number knots. 6 Linear interpolation first knot 1 last knot maximum age, .e., MaxAge. KnotAges Ages associated knot. necessary input SigOpt = 5 SigOpt = 6. BiasOpt vector one entry reader/lab specifying type bias specific reader. Positive values lead estimated parameters negative values used shared parameters readers, just like SigOpt. Parameter sharing common one reader lab working together refine methods matching techniques. Possible entries include following: -0-9+ Mirror bias another reader, negative integer corresponds column reader/lab mirrored minus one, e.g., -1 causes mirror reader/lab 1, data stored second column Data. number must lower -1 times current position vector. 0 Unbiased, least one reader unbiased. 1 Constant coefficient variation, .e., 1-parameter linear relationship bias true age. 2 Curvilinear, .e., 2-parameter Hollings-form relationship bias true age. example entry situation seven readers assume first reader unbiased, readers 2-7 curvilinear bias, reader 3 shares parameters reader 2, reader 5 shares parameters reader 4, reader 7 shares parameters reader 6 look like c(0, 2, -2, 2, -4, 2, -6). NDataSets generally 1 values implemented. MinAge integer, specifying minimum possible \"true\" age. MaxAge integer, specifying maximum possible \"true\" age. RefAge arbitrarily chosen age \"true\" age-composition fixed-effects calculated offset. effect answer potentially effect estimation speed. MinusAge minimum age age-specific age-composition estimated. Ages MinusAge \"true\" proportion--age (\\(P_{}\\)) estimated $$P_a = P_{MinusAge}*exp^{(\\beta*(MinusAge - ))}$$, beta estimated log-linear trend \"true\" proportion--age. MinusAge = MinAge, beta estimated. PlusAge Identical MinusAge except defining age age-specific age composition estimated. MaxSd upper bound possible values standard deviation reading error. MaxExpectedAge Set MaxAge. SaveFile Directory agemat.exe located ADMB intermediate output files located. AdmbFile specified agemat.exe copied directory SaveFile. EffSampleSize Indicating whether effective sample size calculated. Missing values data matrix cause ineffective, case set 0. Intern logical input controls amount output displayed, TRUE indicates ADMB output displayed R FALSE leads suppression information. AdmbFile optional character entry specifies directory agemat.exe copied SaveFile. JustWrite logical input allows just data files written without running ADMB executable. CallType Either \"system\" \"shell\" depending Operating System R run. default \"system\". ExtraArgs string characters providing extra arguments passed ADMB. default \" -est\". verbose logical input controls amount feedback users receive program. default provide output possible verbose = TRUE.","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/RunFn.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Run ageing error model — RunFn","text":"premise Punt et al. (2008) calculate likelihood model parameters given observed data set otolith age reads multiple age readers. reader/lab, two parameters defined, one standard deviation one bias. model calculates expected age read standard deviation normally distributed reading error given true age otolith. relationships can linear curvilinear. true age obviously unobserved process can considered random effect. Thus, software computes likelihood summing across possible discrete values true age otolith. true age requires hyperdistribution represents prior probability otolith given age. hyperdistribution controlled set hyperparameters parameters govern standard deviation bias age reader/lab. Specifically, one hyperparameter estimated every age including MinusAge PlusAge. Ages outside range prior proportion age defined loglinear deviation proportion age extreme ages, .e., MinusAge PlusAge. slope loglinear deviations thus constitutes additional 1 2 fixed effect parameters. true proportion age calculated fixed effects loglinear slope parameters normalizing resulting distribution sums one.","code":""},{"path":[]},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/RunFn.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Run ageing error model — RunFn","text":"James T. Thorson, Ian J. Stewart, Andre E. Punt, Ian G. Taylor","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/RunFn.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Run ageing error model — RunFn","text":"","code":"example(SimulatorFn) #> #> SmltrF> # Parameters for generating data #> SmltrF> # This represents 2 unique readers #> SmltrF> # Row 1 -- Otoliths read only once by reader #> SmltrF> # Row 2 -- Otoliths read twice by reader 1 #> SmltrF> # Row 2 -- Otoliths read only once by reader 2 #> SmltrF> # Row 4 -- Otoliths read twice by reader 2 #> SmltrF> # Row 5 -- Otoliths read once by reader 1 and once by reader 2 #> SmltrF> ReadsMat <- structure(matrix(nrow = 5, ncol = 5, #> SmltrF+ c(rep(25, 5), #> SmltrF+ 1, 1, 0, 0, 1, #> SmltrF+ 0, 1, 0, 0, 0, #> SmltrF+ 0, 0, 1, 1, 1, #> SmltrF+ 0, 0, 0, 1, 0) #> SmltrF+ ), dimnames = list( #> SmltrF+ c(\"Reader1_Only\", \"Reader1_DoubleReads\", #> SmltrF+ \"Reader2_Only\", \"Reader2_DoubleReads\", #> SmltrF+ \"Reader1_&_Reader2\" #> SmltrF+ ), #> SmltrF+ c(\"NumberOfReads\", #> SmltrF+ \"Reader1\", \"Reader1_DoubleReads\", #> SmltrF+ \"Reader2\", \"Reader2_DoubleReads\" #> SmltrF+ )) #> SmltrF+ ) #> #> SmltrF> # Generate data #> SmltrF> set.seed(2) #> #> SmltrF> AgeReads <- SimulatorFn(Nreaders = 4, M = 0.2, #> SmltrF+ SelexForm = \"Logistic\", #> SmltrF+ SelexParams = c(5, 0.2), BiasParams = c(1, 1, 1.1, 1.1), #> SmltrF+ ErrorParams = c(0.2, 0.2, 0.2, 0.2), ReadsMat = ReadsMat, #> SmltrF+ RecCv = 0.6, RecAr1 = 0.8, Amax = 100) if (FALSE) { utils::write.csv(AgeReads, file = file.path(getwd(), \"Simulated_data_example.csv\")) } ##### Format data Nreaders <- ncol(AgeReads) # Change NA to -999 (which the Punt software considers missing data) AgeReads <- ifelse(is.na(AgeReads), -999, AgeReads) # Potentially eliminate rows that are only read once # These rows have no information about reading error, but are potentially # informative about latent age-structure. It is unknown whether eliminating # these rows degrades estimation of error and bias, and is currently # recommended to speed up computation if (FALSE) { KeepRow <- ifelse( rowSums(ifelse(AgeReads == -999, 0, 1), na.rm = TRUE) <= 1, FALSE, TRUE ) AgeReads <- AgeReads[KeepRow, ] } # AgeReads2 is the correctly formatted data object AgeReads2 <- rMx(c(1, AgeReads[1, ])) # Combine duplicate rows for (RowI in 2:nrow(AgeReads)) { DupRow <- NA for (PreviousRowJ in 1:nrow(AgeReads2)) { if (all( AgeReads[RowI,1:Nreaders] == AgeReads2[PreviousRowJ,1:Nreaders+1] )) { DupRow <- PreviousRowJ } } if (is.na(DupRow)) {# Add new row to AgeReads2 AgeReads2 <- rbind(AgeReads2, c(1, AgeReads[RowI, ])) } if(!is.na(DupRow)){# Increment number of samples for previous duplicate AgeReads2[DupRow,1] <- AgeReads2[DupRow,1] + 1 } } ######## Determine settings for ADMB # Define minimum and maximum ages for integral across unobserved ages MinAge <- 1 MaxAge <- ceiling(max(AgeReads2[,-1])/10)*10 BiasOpt <- c(0, -1, 0, -3) SigOpt <- c(1, -1, 6, -3) # Necessary for SigOpt option 5 or 6 KnotAges <- list(NA, NA, c(1, 10, 20, MaxAge), NA) ##### Run the model (MAY TAKE 5-10 MINUTES) if (FALSE) { fileloc <- file.path(tempdir(), \"age\") dir.create(fileloc, showWarnings = FALSE) RunFn(Data = AgeReads2, SigOpt = SigOpt, KnotAges = KnotAges, BiasOpt = BiasOpt, NDataSets = 1, MinAge = MinAge, MaxAge = MaxAge, RefAge = 10, MinusAge = 1, PlusAge = 30, SaveFile = fileloc, AdmbFile = file.path(system.file(\"executables\", package = \"nwfscAgeingError\"), .Platform$file.sep), EffSampleSize = 0, Intern = FALSE, JustWrite = FALSE, CallType = \"shell\" ) }"},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/SimulatorFn.html","id":null,"dir":"Reference","previous_headings":"","what":"Simulate double reading data — SimulatorFn","title":"Simulate double reading data — SimulatorFn","text":"function generate simulated double reading data given properties","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/SimulatorFn.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Simulate double reading data — SimulatorFn","text":"","code":"SimulatorFn( Nreaders, M, SelexForm, ErrorParams, BiasParams, SelexParams, ReadsMat, RecCv = 0.6, RecAr1 = 0.8, Amax = 100 )"},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/SimulatorFn.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Simulate double reading data — SimulatorFn","text":"Nreaders number ageing readers M True natural mortality SelexForm Form selectivity--age (logistic selex--age one implemented). ErrorParams Error type CV following equation: VarAgeRead = (CV*TrueAge)^2 BiasParams Bias type b following equation: EAgeRead = b*TrueAge SelexParams Selectivity parameters, standard logistic equation. ReadsMat Matrix describing number reads per reader combination. row specifies many reads (first column) particular pattern double reads (second Nreaders+1 columns). RecCv CV recruitment, shoudl noted recruitment assumed stationary time. RecAr1 First-order autoregressive coefficient recruitment Amax True maximum age","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/SimulatorFn.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Simulate double reading data — SimulatorFn","text":"Returns simulated double read matrix","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/SimulatorFn.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Simulate double reading data — SimulatorFn","text":"Punt, .E., Smith, D.C., KrusicGolub, K., Robertson, S. 2008. Quantifying age-reading error use fisheries stock assessments, application species Australias southern eastern scalefish shark fishery. Can. J. Fish. Aquat. Sci. 65: 1991-2005.","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/SimulatorFn.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Simulate double reading data — SimulatorFn","text":"James T. Thorson","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/SimulatorFn.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Simulate double reading data — SimulatorFn","text":"","code":"# Parameters for generating data # This represents 2 unique readers # Row 1 -- Otoliths read only once by reader # Row 2 -- Otoliths read twice by reader 1 # Row 2 -- Otoliths read only once by reader 2 # Row 4 -- Otoliths read twice by reader 2 # Row 5 -- Otoliths read once by reader 1 and once by reader 2 ReadsMat <- structure(matrix(nrow = 5, ncol = 5, c(rep(25, 5), 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0) ), dimnames = list( c(\"Reader1_Only\", \"Reader1_DoubleReads\", \"Reader2_Only\", \"Reader2_DoubleReads\", \"Reader1_&_Reader2\" ), c(\"NumberOfReads\", \"Reader1\", \"Reader1_DoubleReads\", \"Reader2\", \"Reader2_DoubleReads\" )) ) # Generate data set.seed(2) AgeReads <- SimulatorFn(Nreaders = 4, M = 0.2, SelexForm = \"Logistic\", SelexParams = c(5, 0.2), BiasParams = c(1, 1, 1.1, 1.1), ErrorParams = c(0.2, 0.2, 0.2, 0.2), ReadsMat = ReadsMat, RecCv = 0.6, RecAr1 = 0.8, Amax = 100)"},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/StepwiseFn.html","id":null,"dir":"Reference","previous_headings":"","what":"Step-wise model selection — StepwiseFn","title":"Step-wise model selection — StepwiseFn","text":"Run step-wise model selection facilitate exploration several modelling configurations using Akaike information criterion (AIC).","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/StepwiseFn.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Step-wise model selection — StepwiseFn","text":"","code":"StepwiseFn( SearchMat, Data, NDataSets, KnotAges, MinAge, MaxAge, RefAge, MaxSd, MaxExpectedAge, SaveFile, EffSampleSize = 0, Intern = TRUE, InformationCriterion = c(\"AIC\", \"AICc\", \"BIC\"), SelectAges = TRUE )"},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/StepwiseFn.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Step-wise model selection — StepwiseFn","text":"SearchMat matrix explaining stepwise model selection options. One row readers error one row readers bias + 2 rows, one MinusAge, .e., age proportion age begins decrease exponentially decreasing age, one PlusAge, .e., age proportion--age begins decrease exponentially increasing age. element given row possible value search across reader. , number columns SearchMat maximum number options want include. Think several vectors stacked row-wise shorter rows filled NA values. reader two two options analyst wants search remainder columns filled NA values row. Data data set first column integer providing number otoliths included row subsequent columns reader lab estimated ag,e reader/lab unique reading error bias. modeling framework allows , , 15 readers, .e., 16 columns. identical rows data frame otoliths exact read every reader/lab combined single row count first column. failed combine identical rows prior running model, alerted error XXX.rep file properly formatted data can ' cut-pasted XXX.dat file use. Missing reads given reader/lab entered -999. Order reader/lab columns similar readers/labs located next one another columns right can mirror columns immediate left terms parameter estimates. NDataSets generally 1 values implemented. KnotAges Ages associated knot. necessary input SigOpt = 5 SigOpt = 6. MinAge integer, specifying minimum possible \"true\" age. MaxAge integer, specifying maximum possible \"true\" age. RefAge arbitrarily chosen age \"true\" age-composition fixed-effects calculated offset. effect answer potentially effect estimation speed. MaxSd upper bound possible values standard deviation reading error. MaxExpectedAge Set MaxAge. SaveFile Directory agemat.exe located ADMB intermediate output files located. AdmbFile specified agemat.exe copied directory SaveFile. EffSampleSize Indicating whether effective sample size calculated. Missing values data matrix cause ineffective, case set 0. Intern logical input controls amount output displayed, TRUE indicates ADMB output displayed R FALSE leads suppression information. InformationCriterion string specifying type information criterion used choose best model. default use AIC, though AIC corrected small sample sizes BIC also available. SelectAges logical input specifying boundaries based MinusAge PlusAge. default TRUE.","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/StepwiseFn.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Step-wise model selection — StepwiseFn","text":"AIC seems like appropriate method select among possible values PlusAge, .e., last row SearchMat, PlusAge determines number estimated fixed-effect hyperparameters used define true proportion--age hyperdistribution. hyperdistribution turn used prior integrating across true age associated otolith. true age, latent effect, can interpreted random effect one observation. , use AIC select among parameterizations fixed effects defining hyperdistribution customary (Pinheiro Bates, 2009). tested sablefish, AIC lead true proportion age biologically plausible.","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/StepwiseFn.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Step-wise model selection — StepwiseFn","text":"Punt, .E., Smith, D.C., KrusicGolub, K., Robertson, S. 2008. Quantifying age-reading error use fisheries stock assessments, application species Australia's southern eastern scalefish shark fishery. Can. J. Fish. Aquat. Sci. 65: 1991-2005. Pinheiro, J.C., Bates, D. 2009. Mixed-Effects Models S S-PLUS. Springer, Germany.","code":""},{"path":[]},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/StepwiseFn.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Step-wise model selection — StepwiseFn","text":"James T. Thorson","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/StepwiseFn.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Step-wise model selection — StepwiseFn","text":"","code":"example(RunFn) #> #> RunFn> example(SimulatorFn) #> #> SmltrF> # Parameters for generating data #> SmltrF> # This represents 2 unique readers #> SmltrF> # Row 1 -- Otoliths read only once by reader #> SmltrF> # Row 2 -- Otoliths read twice by reader 1 #> SmltrF> # Row 2 -- Otoliths read only once by reader 2 #> SmltrF> # Row 4 -- Otoliths read twice by reader 2 #> SmltrF> # Row 5 -- Otoliths read once by reader 1 and once by reader 2 #> SmltrF> ReadsMat <- structure(matrix(nrow = 5, ncol = 5, #> SmltrF+ c(rep(25, 5), #> SmltrF+ 1, 1, 0, 0, 1, #> SmltrF+ 0, 1, 0, 0, 0, #> SmltrF+ 0, 0, 1, 1, 1, #> SmltrF+ 0, 0, 0, 1, 0) #> SmltrF+ ), dimnames = list( #> SmltrF+ c(\"Reader1_Only\", \"Reader1_DoubleReads\", #> SmltrF+ \"Reader2_Only\", \"Reader2_DoubleReads\", #> SmltrF+ \"Reader1_&_Reader2\" #> SmltrF+ ), #> SmltrF+ c(\"NumberOfReads\", #> SmltrF+ \"Reader1\", \"Reader1_DoubleReads\", #> SmltrF+ \"Reader2\", \"Reader2_DoubleReads\" #> SmltrF+ )) #> SmltrF+ ) #> #> SmltrF> # Generate data #> SmltrF> set.seed(2) #> #> SmltrF> AgeReads <- SimulatorFn(Nreaders = 4, M = 0.2, #> SmltrF+ SelexForm = \"Logistic\", #> SmltrF+ SelexParams = c(5, 0.2), BiasParams = c(1, 1, 1.1, 1.1), #> SmltrF+ ErrorParams = c(0.2, 0.2, 0.2, 0.2), ReadsMat = ReadsMat, #> SmltrF+ RecCv = 0.6, RecAr1 = 0.8, Amax = 100) #> #> RunFn> ## Not run: #> RunFn> ##D utils::write.csv(AgeReads, #> RunFn> ##D file = file.path(getwd(), \"Simulated_data_example.csv\")) #> RunFn> ## End(Not run) #> RunFn> #> RunFn> ##### Format data #> RunFn> Nreaders <- ncol(AgeReads) #> #> RunFn> # Change NA to -999 (which the Punt software considers missing data) #> RunFn> AgeReads <- ifelse(is.na(AgeReads), -999, AgeReads) #> #> RunFn> # Potentially eliminate rows that are only read once #> RunFn> # These rows have no information about reading error, but are potentially #> RunFn> # informative about latent age-structure. It is unknown whether eliminating #> RunFn> # these rows degrades estimation of error and bias, and is currently #> RunFn> # recommended to speed up computation #> RunFn> if (FALSE) { #> RunFn+ KeepRow <- ifelse( #> RunFn+ rowSums(ifelse(AgeReads == -999, 0, 1), na.rm = TRUE) <= 1, #> RunFn+ FALSE, TRUE #> RunFn+ ) #> RunFn+ AgeReads <- AgeReads[KeepRow, ] #> RunFn+ } #> #> RunFn> # AgeReads2 is the correctly formatted data object #> RunFn> AgeReads2 <- rMx(c(1, AgeReads[1, ])) #> #> RunFn> # Combine duplicate rows #> RunFn> for (RowI in 2:nrow(AgeReads)) { #> RunFn+ DupRow <- NA #> RunFn+ for (PreviousRowJ in 1:nrow(AgeReads2)) { #> RunFn+ if (all( #> RunFn+ AgeReads[RowI,1:Nreaders] == AgeReads2[PreviousRowJ,1:Nreaders+1] #> RunFn+ )) { #> RunFn+ DupRow <- PreviousRowJ #> RunFn+ } #> RunFn+ } #> RunFn+ if (is.na(DupRow)) {# Add new row to AgeReads2 #> RunFn+ AgeReads2 <- rbind(AgeReads2, c(1, AgeReads[RowI, ])) #> RunFn+ } #> RunFn+ if(!is.na(DupRow)){# Increment number of samples for previous duplicate #> RunFn+ AgeReads2[DupRow,1] <- AgeReads2[DupRow,1] + 1 #> RunFn+ } #> RunFn+ } #> #> RunFn> ######## Determine settings for ADMB #> RunFn> # Define minimum and maximum ages for integral across unobserved ages #> RunFn> MinAge <- 1 #> #> RunFn> MaxAge <- ceiling(max(AgeReads2[,-1])/10)*10 #> #> RunFn> BiasOpt <- c(0, -1, 0, -3) #> #> RunFn> SigOpt <- c(1, -1, 6, -3) #> #> RunFn> # Necessary for SigOpt option 5 or 6 #> RunFn> KnotAges <- list(NA, NA, c(1, 10, 20, MaxAge), NA) #> #> RunFn> ##### Run the model (MAY TAKE 5-10 MINUTES) #> RunFn> ## Not run: #> RunFn> ##D fileloc <- file.path(tempdir(), \"age\") #> RunFn> ##D dir.create(fileloc, showWarnings = FALSE) #> RunFn> ##D RunFn(Data = AgeReads2, SigOpt = SigOpt, KnotAges = KnotAges, #> RunFn> ##D BiasOpt = BiasOpt, #> RunFn> ##D NDataSets = 1, MinAge = MinAge, MaxAge = MaxAge, RefAge = 10, #> RunFn> ##D MinusAge = 1, PlusAge = 30, SaveFile = fileloc, #> RunFn> ##D AdmbFile = file.path(system.file(\"executables\", #> RunFn> ##D package = \"nwfscAgeingError\"), .Platform$file.sep), #> RunFn> ##D EffSampleSize = 0, Intern = FALSE, JustWrite = FALSE, CallType = \"shell\" #> RunFn> ##D ) #> RunFn> ## End(Not run) #> RunFn> #> RunFn> #> RunFn> if (FALSE) { ##### Run the model (MAY TAKE 5-10 MINUTES) fileloc <- file.path(tempdir(), \"age\") dir.create(fileloc, showWarnings = FALSE) RunFn(Data = AgeReads2, SigOpt = SigOpt, KnotAges = KnotAges, BiasOpt = BiasOpt, NDataSets = 1, MinAge = MinAge, MaxAge = MaxAge, RefAge = 10, MinusAge = 1, PlusAge = 30, SaveFile = fileloc, AdmbFile = file.path(system.file(\"executables\", package = \"nwfscAgeingError\"), .Platform$file.sep), EffSampleSize = 0, Intern = FALSE, JustWrite = FALSE, CallType = \"shell\" ) # Plot output PlotOutputFn(Data = AgeReads2, MaxAge = MaxAge, SaveFile = fileloc, PlotType = \"PDF\" ) } ##### Stepwise selection # Parameters MaxAge <- ceiling(max(AgeReads2) / 10) * 10 MinAge <- 1 ##### Stepwise selection StartMinusAge <- 1 StartPlusAge <- 30 # Define matrix explaining stepwise model selection options # One row for each reader + 2 rows for # PlusAge (age where the proportion-at-age begins to # decrease exponentially with increasing age) and # MinusAge (the age where the proportion-at-age begins to # decrease exponentially with decreasing age) # Each element of a given row is a possible value to search # across for that reader SearchMat <- array(NA, dim = c(Nreaders * 2 + 2, 7), dimnames = list(c(paste(\"Error_Reader\", 1:Nreaders), paste(\"Bias_Reader\", 1:Nreaders), \"MinusAge\", \"PlusAge\"), paste(\"Option\", 1:7)) ) # Readers 1 and 3 search across options 1-3 for ERROR SearchMat[c(1, 3), 1:3] <- rep(1, 2) %o% c(1, 2, 3) # Reader 2 mirrors reader 1 SearchMat[2, 1] <- -1 # Reader 4 mirrors reader 3 SearchMat[4, 1] <- -3 # Reader 1 has no BIAS SearchMat[5, 1] <- 0 # Reader 2 mirrors reader 1 SearchMat[6, 1] <- -1 # Reader 3 search across options 0-2 for BIAS SearchMat[7, 1:3] <- c(1, 2, 0) # Reader 4 mirrors reader 3 SearchMat[8, 1] <- -3 # MinusAge searches with a search kernal of -10,-4,-1,+0,+1,+4,+10 SearchMat[9, 1:7] <- c( StartMinusAge, StartMinusAge - 10, StartMinusAge - 4, StartMinusAge - 1, StartMinusAge + 1, StartMinusAge + 4, StartMinusAge + 10 ) SearchMat[9, 1:7] <- ifelse(SearchMat[9,1:7] < MinAge, NA, SearchMat[9, 1:7] ) # PlusAge searches with a search kernal of -10,-4,-1,+0,+1,+4,+10 SearchMat[10, 1:7] <- c( StartPlusAge, StartPlusAge - 10, StartPlusAge - 4, StartPlusAge - 1, StartPlusAge + 1, StartPlusAge + 4, StartPlusAge + 10 ) SearchMat[10,1:7] <- ifelse(SearchMat[10, 1:7] > MaxAge, NA, SearchMat[10, 1:7]) # Run model selection # This outputs a series of files # 1. \"Stepwise - Model loop X.txt\" -- # Shows the AIC/BIC/AICc value for all different combinations # of parameters arising from changing one parameter at a time # according to SearchMat during loop X # 2. \"Stepwise - Record.txt\" -- # The Xth row of IcRecord shows the record of the # Information Criterion for all trials in loop X, # while the Xth row of StateRecord shows the current selected values # for all parameters at the end of loop X # 3. Standard plots for each loop # WARNING: One run of this stepwise model building example can take # 8+ hours, and should be run overnight if (FALSE) { StepwiseFn(SearchMat = SearchMat, Data = AgeReads2, NDataSets = 1, MinAge = MinAge, MaxAge = MaxAge, RefAge = 10, MaxSd = 40, MaxExpectedAge = MaxAge + 10, SaveFile = fileloc, InformationCriterion = c(\"AIC\", \"AICc\", \"BIC\")[3] ) }"},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/ageing_comparison.html","id":null,"dir":"Reference","previous_headings":"","what":"Plot comparison of double age readings — ageing_comparison","title":"Plot comparison of double age readings — ageing_comparison","text":"Plot circles proportional many double readings fell pair coordinates","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/ageing_comparison.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Plot comparison of double age readings — ageing_comparison","text":"","code":"ageing_comparison( xvec, yvec, scale.pts = 2, col.pts = grDevices::grey(0.1, alpha = 0.5), col.hist = grDevices::rgb(0, 0, 0.5, alpha = 0.7), counts = TRUE, maxage = NULL, hist = TRUE, hist.frac = 0.1, xlab = \"Age reader A\", ylab = \"Age reader B\", title = NULL, png = FALSE, filename = \"ageing_comparison.png\", SaveFile = NULL, verbose = TRUE )"},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/ageing_comparison.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Plot comparison of double age readings — ageing_comparison","text":"xvec vector values reader yvec vector values reader B scale.pts Documentation needed. col.pts color points col.hist color histograms counts include text within bubble showing count values? maxage maximum age include plot (yet work well) hist include histogram along axis? hist.frac maximum value histograms fraction maxage xlab label xvec ylab label yvec title Optional title add top plot png Save plot PNG file? filename File name PNG file. SaveFile directory plot saved. NULL value make go working directory. verbose Report messages function runs.","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/ageing_comparison.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Plot comparison of double age readings — ageing_comparison","text":"Ian G. Taylor","code":""},{"path":[]},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/cMx.html","id":"the-function-is-currently-defined-as","dir":"Reference","previous_headings":"","what":"The function is currently defined as","title":"Make a column matrix — cMx","text":"function (Input) .matrix(Input)","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/cMx.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Make a column matrix — cMx","text":"","code":"cMx(Input)"},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/cMx.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Make a column matrix — cMx","text":"Input input converted matrix","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/cMx.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Make a column matrix — cMx","text":"James T. Thorson","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/determine_n_sets.html","id":null,"dir":"Reference","previous_headings":"","what":"Determine the number of data sets in a data file — determine_n_sets","title":"Determine the number of data sets in a data file — determine_n_sets","text":"Determine number data sets data file","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/determine_n_sets.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Determine the number of data sets in a data file — determine_n_sets","text":"","code":"determine_n_sets(file)"},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/determine_n_sets.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Determine the number of data sets in a data file — determine_n_sets","text":"file file path data file.","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/determine_n_sets.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Determine the number of data sets in a data file — determine_n_sets","text":"integer giving number data sets file.","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/determine_n_sets.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Determine the number of data sets in a data file — determine_n_sets","text":"Kelli F. Johnson","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/estgrowth.vb.html","id":null,"dir":"Reference","previous_headings":"","what":"Calculate von Bertanlaffy Growth Parameters from Lengths and Ages — estgrowth.vb","title":"Calculate von Bertanlaffy Growth Parameters from Lengths and Ages — estgrowth.vb","text":"Calculate von Bertanlaffy growth parameters length age data predicted lengths given ages input parameters.","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/estgrowth.vb.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Calculate von Bertanlaffy Growth Parameters from Lengths and Ages — estgrowth.vb","text":"","code":"estgrowth.vb(Par, Ages, Lengths, ReturnType = c(\"NLL\", \"Pred\"), sdFactor = 1)"},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/estgrowth.vb.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Calculate von Bertanlaffy Growth Parameters from Lengths and Ages — estgrowth.vb","text":"Par list von Bertanlaffy growth parameters log space ordered follows: K, Linf, L0, CV0, CV1. Names assigned provided. Ages vector ages years. Values NA accepted. Lengths vector Lengths cm. Lengths can NULL ReturnType == \"Pred\" predicting using ages, lengths just needed estimation purpopses. NULL, ensure one length measurement every age measurement. Values NA accepted. ReturnType single character value \"NLL\" default, leads negative log-likelihood value returned. \"Pred\", three values returned combination length age, low, prediction, high based input parameters standard deviation factor, .e., sdFactor. sdFactor number standard deviations include low high calculations. default 1.0.","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/estgrowth.vb.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Calculate von Bertanlaffy Growth Parameters from Lengths and Ages — estgrowth.vb","text":"Depending ReturnType, either negative log likelihood returned based fits data matrix three columns low, predicted, high values combination length age. Distance low high predicted value depends sdFactor, allowing confidence intervals based normal theory theories created.","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/estgrowth.vb.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Calculate von Bertanlaffy Growth Parameters from Lengths and Ages — estgrowth.vb","text":"","code":"if (FALSE) { bio_dat <- data.frame(Age = rep(0:30, each = 20), Length_cm = rnorm(n = 31 * 20, mean = 50, sd = 5)) pars_in <- lapply(FUN = log, X = list( \"K\" = 0.13, \"Linf\" = 55, \"L0\" = 5, \"CV0\" = 0.1, \"CV1\" = 0.1)) solve <- optim(fn = estgrowth.vb, par = unlist(pars_in), hessian = FALSE, Ages = bio_dat[, \"Age\"], Lengths = bio_dat[, \"Length_cm\"]) predictions <- estgrowth.vb(Par = solve$par, ReturnType = \"Pred\", sdFactor = 1, Ages = bio_dat[, \"Age\"], Lengths = bio_dat[, \"Length_cm\"]) plot(bio_dat$Age, predictions[, \"Lhat_pred\"], xlab = \"Age (years)\", ylab = \"Predicted length (cm)\") exp(solve$par) }"},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/fit.html","id":null,"dir":"Reference","previous_headings":"","what":"Fit an ageing error model using TMB — fit","title":"Fit an ageing error model using TMB — fit","text":"Fit ageing error model using TMB","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/fit.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Fit an ageing error model using TMB — fit","text":"","code":"fit()"},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/fit.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Fit an ageing error model using TMB — fit","text":"Kelli F. Johnson","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/minimizer.html","id":null,"dir":"Reference","previous_headings":"","what":"Minimize the negative log likelihood — minimizer","title":"Minimize the negative log likelihood — minimizer","text":"Minimize negative log likelihood using \"nlmimb\" /\"optim\".","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/minimizer.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Minimize the negative log likelihood — minimizer","text":"","code":"minimizer( model, method = c(\"optim\", \"nlmimb\", \"both\"), lower, upper, verbose = FALSE )"},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/minimizer.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Minimize the negative log likelihood — minimizer","text":"model model optimized. method string specifying desired method used optimization routine. options listed function call, default use \"optim\". Using routines option, via \"\", lead first optimizing model using \"nlminb\" re-optimization model \"optim\". Note using stats::optim(), \"L-BFGS-B\" method used rather default method \"Nelder-Mead\". lower, upper Vectors parameter bounds length number parameters model. verbose logical specifying messages printed. default print, .e., verbose = FALSE.","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/minimizer.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Minimize the negative log likelihood — minimizer","text":"Andre E. Punt","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/plot_output.html","id":null,"dir":"Reference","previous_headings":"","what":"Plot output — plot_output","title":"Plot output — plot_output","text":"Plots age comparisons results fitted Ageing Error model","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/plot_output.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Plot output — plot_output","text":"","code":"plot_output( Data, IDataSet, MaxAge, Report, subplot = 1:3, Nparameters = 0, LogLike = 0, ReaderNames = NULL, Species = \"AgeingError\", SaveDir = getwd(), verbose = FALSE, ... )"},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/plot_output.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Plot output — plot_output","text":"Data Input data matrix IDataSet Index data set used creating filename MaxAge Maximum estimated age Report Results fitting model subplot Vector plots create. Nparameters Number parameters LogLike Negative log likelihood fitting model ReaderNames Vector names reader, defaults 'Reader1', 'Reader2', etc. left default argument NULL. pass vector strings, vector must length NCOL(Data) - 1. Species String used beginning output files SaveDir Directory fitted model verbose Report messages function runs. ... Additional arguments passed ageing_comparison().","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/plot_output.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Plot output — plot_output","text":"Returns AIC, AICc, BIC fitted model.","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/plot_output.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Plot output — plot_output","text":"Punt, .E., Smith, D.C., KrusicGolub, K., Robertson, S. 2008. Quantifying age-reading error use fisheries stock assessments, application species Australias southern eastern scalefish shark fishery. Can. J. Fish. Aquat. Sci. 65: 1991-2005.","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/plot_output.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Plot output — plot_output","text":"James T. Thorson, Ian G. Taylor","code":""},{"path":[]},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/rMx.html","id":"the-function-is-currently-defined-as","dir":"Reference","previous_headings":"","what":"The function is currently defined as","title":"Make a row matrix — rMx","text":"function (Input) (.vector(Input)) Output <- t(.matrix(Input))(!.vector(Input)) Output <- .matrix(Input)Output","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/rMx.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Make a row matrix — rMx","text":"","code":"rMx(Input)"},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/rMx.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Make a row matrix — rMx","text":"Input input converted row matrix","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/rMx.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Make a row matrix — rMx","text":"James T. Thorson","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/run.html","id":null,"dir":"Reference","previous_headings":"","what":"Run ageing error routine — run","title":"Run ageing error routine — run","text":"wrapper running TMB model estimate ageing error given data set specification file.","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/run.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Run ageing error routine — run","text":"","code":"run(file_data, file_specs, directory)"},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/run.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Run ageing error routine — run","text":"file_data string specifying file path data file. file_specs string specifying file path specifications file. directory string specifying file path directory like save results.","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/run.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Run ageing error routine — run","text":"Invisibly return model output.","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/run.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Run ageing error routine — run","text":"Kelli F. Johnson","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/news/index.html","id":"ageingerror-202","dir":"Changelog","previous_headings":"","what":"AgeingError 2.0.2","title":"AgeingError 2.0.2","text":"Switched new TMB version package main branch Renamed github repository nwfscAgeingError AgeingError Adding vignette documenting TMB version Paul Burch Cleared , , files associated ADMB version","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/news/index.html","id":"ageingerror-200","dir":"Changelog","previous_headings":"","what":"AgeingError 2.0.0","title":"AgeingError 2.0.0","text":"Changed package name AgeingError Added TMB code pre-compiled package Added run() wrapper code provided @puntae Increased number examples present package","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/news/index.html","id":"nwfscageingerror-133","dir":"Changelog","previous_headings":"","what":"nwfscAgeingError 1.3.3","title":"nwfscAgeingError 1.3.3","text":"Added NEWS.md file track changes package. Included TMB agemat2.cpp source code . E. Punt","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/news/index.html","id":"nwfscageingerror-132","dir":"Changelog","previous_headings":"","what":"nwfscAgeingError 1.3.2","title":"nwfscAgeingError 1.3.2","text":"version contains updates . E. Punt work CSIRO.","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/news/index.html","id":"nwfscageingerror-131","dir":"Changelog","previous_headings":"","what":"nwfscAgeingError 1.3.1","title":"nwfscAgeingError 1.3.1","text":"Archive 16th November 2021.","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/news/index.html","id":"nwfscageingerror-101","dir":"Changelog","previous_headings":"","what":"nwfscAgeingError 1.0.1","title":"nwfscAgeingError 1.0.1","text":"version used 2017 assessment cycle.","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/news/index.html","id":"nwfscageingerror-100","dir":"Changelog","previous_headings":"","what":"nwfscAgeingError 1.0.0","title":"nwfscAgeingError 1.0.0","text":"version used 2013 assessment cycle. Though repository tagged 2015. Melissa Haltuch noted 2014 code updated summary updates provided . Splines, requires new argument defining knots. Linear interpolation knots, requires new argument defines knots. Changes calculation best true age previous way led strange plots. Improvement effective sample size calculation. Read one data set missing entries, double reads. 2011-based code allowed reading multiple data sets. Increased estimation speed missing values treated. Includes code simulate data. Includes function format input data csv readers columns double reads rows. Plot standardized outputs output file. figures still use development. Ability step multiple runs catalog output using new StepwiseFn() function.","code":""}] +[{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/articles/getting_started.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"Estimating ageing error using the TMB model written by André Punt","text":"Uncertainty age estimates needs accounted undertaking stock assessments. Punt et al. (2008) provides methods estimating ageing error matrices account ageing bias imprecision. provide documentation examples Template Model Builder (TMB) implementation methods, incorporating documentation written André Punt. vignette illustrated using data settings associated three stocks Australian Southern Eastern Scalefish Shark Fishery (SESSF) fishery (Blue Grenadier, Bight Redfish, School Whiting), well sablefish U.S. west coast.","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/articles/getting_started.html","id":"software","dir":"Articles","previous_headings":"","what":"Software","title":"Estimating ageing error using the TMB model written by André Punt","text":"current implementation software written André Punt 2020 subsequently updated 2022. several slightly different versions source code circulation, use version maintained Kelli Johnson (NOAA NWFSC). consulted André Punt agreed future development ageing error code done NWFSC GitHub repository.","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/articles/getting_started.html","id":"ageing-error-r-package","dir":"Articles","previous_headings":"Software","what":"Ageing Error R package","title":"Estimating ageing error using the TMB model written by André Punt","text":"NOAA Northwest Fisheries Science Center (NWFSC) GitHub site hosts AgeingError package. newer TMB version software replaced ADMB version main branch repository May 2024. ADMB version still available via git history. can install TMB branch directly GitHub using code . Note TMB Rtools need installed . package can loaded. software requires data model specified using input files described .","code":"remotes::install_github(\"pfmc-assessments/AgeingError\") library(AgeingError)"},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/articles/getting_started.html","id":"input-files","dir":"Articles","previous_headings":"","what":"Input files","title":"Estimating ageing error using the TMB model written by André Punt","text":"two input files needed run software data file (.dat extension) specifications file (.spc extension). described using Blue Grenadier (BG2022) example.","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/articles/getting_started.html","id":"data-file","dir":"Articles","previous_headings":"Input files","what":"Data file","title":"Estimating ageing error using the TMB model written by André Punt","text":"data file (.dat extension) contains age comparison data pair readers specifies range ages permitted data, minus plus groups reference age. data file comprises two sections (age range one section data pair reader comparisons) age range simply specified providing minimum maximum ages. data can’t fall outside specified age range code generate error. input files parsed software using keywords need match exactly expected, text “Range_of_ages” part input just comment help user keep track format. data can entered separate data set pair readers, single data set pairs readers. options described .","code":"Range_of_ages 0 25"},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/articles/getting_started.html","id":"separate-data-sets","dir":"Articles","previous_headings":"Input files > Data file","what":"Separate Data Sets","title":"Estimating ageing error using the TMB model written by André Punt","text":"pair readers (often first second reads reader) one section header Data_set_x (x=1, 2, etc). four lines immediately header number rows paired age determinations (described ) number readers data set (always 2 SESSF) minus group, plus group, reference age reader numbers remainder data set comprises one row data pair age determinations following format. columns reader (1-6) represent age, left column represents number times pair ages assigned two readers. columns readers () need filled -999. second (potentially third) data set follow format first data set, data associated next pair readers (see ). headers data set need headers numbered 1 NDataSet input CreateData(). , NDataSet=3, data file needs sections header Data_set_1, Data_set_2, Data_set_3.","code":"Data_set_1 141 # number of lines 2 # Number of readers 1 20 5 # minus group; plus group; reference age 1 2 3 4 # Which readers 9 0 0 -999 -999 1 0 10 -999 -999 153 1 1 -999 -999 25 1 2 -999 -999 ... 2 23 23 -999 -999 1 24 23 -999 -999 2 24 24 -999 -999 1 25 24 -999 -999 Data_set_2 123 # number of lines 2 # Number of readers 1 20 5 # minus group; plus group; reference age 3 4 1 2 # which readers 27 1 1 -999 -999 13 1 2 -999 -999 3 2 1 -999 -999 227 2 2 -999 -999 ... 2 22 20 -999 -999 1 22 21 -999 -999 1 23 21 -999 -999 1 23 22 -999 -999"},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/articles/getting_started.html","id":"combined-data-set","dir":"Articles","previous_headings":"Input files > Data file","what":"Combined Data Set","title":"Estimating ageing error using the TMB model written by André Punt","text":"alternative separate data sets pair readers combine multiple pairs readers single data set shown . format number readers now 4 data second pair readers follows end first pair.","code":"Data_set_1 264 # number of lines 4 # Number of readers 0 25 5 # minus group; plus group; reference age 1 2 3 4 # Which readers 9 0 0 -999 -999 1 0 10 -999 -999 153 1 1 -999 -999 30 1 2 -999 -999 ... 1 24 23 -999 -999 2 24 24 -999 -999 1 25 24 -999 -999 27 -999 -999 1 1 13 -999 -999 1 2 3 -999 -999 2 1 ... 2 -999 -999 22 20 1 -999 -999 22 21 1 -999 -999 23 21 1 -999 -999 23 22"},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/articles/getting_started.html","id":"other-considerations","dir":"Articles","previous_headings":"Input files > Data file","what":"Other Considerations","title":"Estimating ageing error using the TMB model written by André Punt","text":"Note ages need whole numbers data file. C++ code adds 0.5 age model fitting midpoint age bin. Different agencies created R code specific format ageing comparison data format package. instance CSIRO uses R package SESSFdataproc hosts examples assessment repository SESSFassessments. version code available CSIRO. usually create data file Excel (using summarised output R code) paste text file. data file read R using function CreateData() described examples .","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/articles/getting_started.html","id":"specifications-file","dir":"Articles","previous_headings":"Input files","what":"Specifications file","title":"Estimating ageing error using the TMB model written by André Punt","text":"age-estimates least one age-readers must assumed unbiased (sensitivity choice age-reader examined uncertainty age-reader likely unbiased). options bias precision described entered specifications file (.spc extension), example provided description model options.","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/articles/getting_started.html","id":"bias-options","dir":"Articles","previous_headings":"Input files > Specifications file","what":"Bias options","title":"Estimating ageing error using the TMB model written by André Punt","text":"available options bias : -x Assume relationship expected age true age reader x. [Note ‘’x’’ must lower number reader bias defined. Reader 2 can BiasOpt=-1 match reader 1]. 0 Age-estimates unbiased. 1 expected age animal age \\(\\), \\(E_a\\), linear function true age, .e. \\(E_a =\\alpha \\) (constant coefficient variation). 2 expected age animal age \\(\\), \\(E_a\\), given : \\[E_a = E_L + (E_H - E_L)\\frac{1-\\text{exp}(-\\beta(-1))}{1-\\text{exp}(-\\beta(a_{max}-1))}\\]. C++ code (AgeingError.cpp) also conditional () statements Bias options 4 5 identical option 0 (unbiased) therefore presumably placeholders future options. SESSF typically assume readers unbiased (BiasOpt=0), however, important check assumption using residual plots (André Punt pers. comm.)","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/articles/getting_started.html","id":"sigma-options","dir":"Articles","previous_headings":"Input files > Specifications file","what":"Sigma options","title":"Estimating ageing error using the TMB model written by André Punt","text":"available options random ageing precision : -x. Assume relationship variance age-reading error true age reader x [note ‘’x’’ must lower number reader bias defined]. 1 option assumes constant coefficient variation, one parameter needs specified pair independent readers specification (.spc) file. standard deviation random age-reading error, \\(\\sigma_a\\), linear function true age, .e.: \\[ \\sigma_a = \\begin{cases} \\gamma & \\text{ } =0 \\\\ \\gamma & \\text{otherwise} \\\\ \\end{cases} \\] 2 parameters relate standard deviation (Michaelis-Menten equation). option three parameters need specified pair independent readers specification (.spc) file. standard deviation random age-reading error, \\(\\sigma_a\\), given : \\[ \\sigma_a = \\begin{cases} \\sigma_L + (\\sigma_H - \\sigma_L)\\frac{1}{1-exp(-\\delta(a_{max}-1))} & \\text{ } =0 \\\\ \\sigma_L + (\\sigma_H - \\sigma_L)\\frac{1-exp(-\\delta(-1))}{1-exp(-\\delta(a_{max}-1))} & \\text{otherwise} \\\\ \\end{cases} \\] 3 parameters relate coefficient variation (Michaelis-Menten equation). option three parameters need specified pair independent readers specification (.spc) file. coefficient variation random age-reading error, \\(CV_a\\), given : \\[ CV_a = \\begin{cases} CV_L + (CV_H - CV_L)\\frac{1}{1-\\text{exp}(-\\delta(a_{max}-1))} & \\text{ } =0 \\\\ CV_L + (CV_H - CV_L)\\frac{1-\\text{exp}(-\\delta(-1))}{1-\\text{exp}(-\\delta(a_{max}-1))} & \\text{otherwise} \\\\ \\end{cases} \\] 4 estimates age exact (use option ‘’known age’’ individuals). option returns vector zeroes (perhaps just single zero). 5 standard deviation random age-reading error, \\(\\sigma_a\\), spline function age (Forsythe, Malcolm, Moler type spline implemented tmbutils::splinefun()). number location (ages) knots must specified, number parameters equal number knots. Bounds initial parameters need specified log space. 6 standard deviation random age-reading error, \\(\\sigma_a\\), piecewise linear function age. number location (ages) knots must specified, number parameters equal number knots. Bounds initial parameters need specified log space. 7 linear change standard deviation random age-reading error, \\(\\sigma_a\\), age. option two parameters need specified pair independent readers specifications (.spc) file. 8 linear change coefficient variation random age-reading error, \\(CV_a\\) , age. option two parameters need specified pair independent readers specifications (.spc) file.","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/articles/getting_started.html","id":"example-specifications-file","dir":"Articles","previous_headings":"Input files > Specifications file","what":"Example Specifications file","title":"Estimating ageing error using the TMB model written by André Punt","text":".spc file contains three four sections: 1. reader specification, 2. knots splines breakpoints piecewise linear functions (used), 3. bias parameters, 4. sigma parameters. first section specifies Bias Sigma options reader. reader, one line specifies Bias Sigma options. SigmaOpt=-x used assume relationship expected age true age reader x [note x must lower number reader bias defined]. example (Blue Grenadier) shows two pairs readers (1-2 & 3-4) specified unbiased (BiasOpt=0) readers 1 2 ageing precision SigmaOpt=2. model requires three parameters specified (presumably \\(\\sigma_L\\), \\(\\sigma_H\\), \\(\\delta\\)) pair readers (case Blue Grenadier first second reads two readers). second (optional) section species knots spline linear interpolation models. example taken School Whiting (WHS2.spc). specifies five knots first last knots minimum maximum ages. Note text “# Spline specifications” “# Linear specifications” required code SigmaOpt options 5 6 used. next section specifies conditions Bias parameters estimated. need provide bounds, initial values whether parameter estimated (1) pre-specified (0) initial value. Bias=0 (case SESSF stocks) section blank (NULL), although retain heading (sure heading needed). Sablefish example (Sable.spc) provides example implement bias within ageing error estimation. final section specifies conditions Sigma parameters estimated. Like , need provide bounds, initial values whether parameter estimated (1). One set parameter bounds, initial values /needs provide group readers assume ageing uncertainty (group x/-x). example (SigmaOpt=2) three parameters pair readers.","code":"# reader BiasOpt SigmaOpt 1 0 2 2 0 -1 3 0 2 4 0 -3 # Spline specifications 5 0 3 5 7 9 # Linear specifications 5 0 3 5 7 9 Bias_Pars (low high init, on/off) Sigma_Pars (low high init, on/off) 0 1 0.2 1 # Readers 1 & 2 0.01 1 0.2 1 0 2 0.5 1 0 1 0.2 1 # Readers 3 & 4 0.01 1 0.2 1 0 2 0.5 1"},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/articles/getting_started.html","id":"examples","dir":"Articles","previous_headings":"","what":"Examples","title":"Estimating ageing error using the TMB model written by André Punt","text":"examples focus SESSF species, specify (BiasOpt=0). bias age readings suspected, example implement bias within ageing error estimation provided Sablefish example (Sable.spc).","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/articles/getting_started.html","id":"blue-grenadier","dir":"Articles","previous_headings":"Examples","what":"Blue Grenadier","title":"Estimating ageing error using the TMB model written by André Punt","text":"Blue Grenadier (Macruronus novaezelandiae) deep water species caught trawl south eastern Australia (Tuck Bessell-Browne 2022). age readings two separate readers re-read reads (.e. inter-reader comparisons production data). 2022, estimating ageing error Blue Grenadier challenging, requiring removal problematic data, different models reader improvements model source code. work example . function load data file R isn’t currently exported ageing error R package need use ::: access . Note using data file single data set set NDataSet=1. set verbose=TRUE summary loaded data printed console. Check matches input file, things worth checking include, last line data set. total number reads reader pair. number readers order. plus, minus reference ages. ’s warning potentially missing data, occurs ages minimum age maximum age, however, warning appear correct case. Possibly -999 values data causing warning <0. Next load model specifications using CreateSpecs function. function exported either need call package name ::: access . function creates nested list one list element reader data. setting verbose=TRUE, list print console can check inputs read correctly. Note reader -x Sigma option (.e. relationship expected age true age reader x) parameter values. output function varies model specified (.e. knots zero unless spline piecewise linear model specified - sigma options 5 6). Ageing error estimated using function DoApplyAgeError. function exported R package can called directly. need provide name (Species argument), data, model specs, specify weights (AprobWght SlopeWght) name subdirectory save output (gets created doesn’t exist). set verbose=FALSE example large amount output printed screen. model stored list object BG2022_mod information along data model specifications saved output directory lda file name Species (case “BG2022.lda”). Examine structure model object save model output using ProcessResults function, using ::: function also isn’t exported. want specify effective sample size estimated (CalcEff = TRUE) produces fits individual data points can used identify outliers may impacting model convergence. model creates several output files contain ageing error estimates information need assess fit set verbose = FALSE. following files output subdirectory (case Results). report file (.rpt extension) contains convergence criteria, model specifications, parameter estimates uncertainty ageing error matrices reader (note readers bias sigma option -x identical reader x). LDA file (.lda extension) containing data model specifications. One csv file (.csv extension) reader contains estimated standard deviation coefficient variation age (note readers bias sigma option -x identical reader x). series png file (.png extension) contain plots data model residuals. examination report file (BG2022.rpt) shows maximum gradient -93.96, indicating model converged. Ideally gradient \\(\\pm \\text{1e-4}\\) zero, however, practice achieving models can time consuming involves removing progressively data sometimes accept gradient ~\\(\\pm \\text{1e-3}\\). residual plots show large number outliers exceeding 95% confidence interval table fits individual data points (bottom report file (present CalcEff = TRUE) shows number data points predicted values 0 (close zero e.g. 10e-10), see line 2 (extracted report file). get closer converged model necessary undertake data trimming (removing observations values predicted values 0), specify different ageing error model second reader prespecify (.e. fix) one parameters second reader. done stepwise manner, small changes made, model run results examined changes made achieved final model considered acceptable. refit final model (BG2022_trim_8_1). Load data file. Note number lines data reduced 264 252. Next load model specifications. second reader (3 4 data) specified linear change standard deviation random age-reading error (SigmaOpt=7) fixed first parameter 0.2. run final model. earlier model save results. model now close convergence (gradient = -0.00143) residual plots show concerning features estimates ageing error standard deviation increasing age.","code":"data_dir <- system.file(\"extdata\", package = \"AgeingError\") BG2022_dat <- AgeingError:::CreateData(file.path(data_dir, \"BG2022.dat\"), NDataSet=1, verbose=TRUE, EchoFile=\"BG2022echo.out\") ## readers 1 2 3 4 ## Last line of data set 1 is 1 -999 -999 23 22 ## WARNING - there are some missing data; the effective sample size calculation may be dubious, ## ## Number of rows in NrowStruc 2 ## [1] 2 ## [1] \"ReaderStruc\" ## [,1] [,2] [,3] [,4] [,5] [,6] ## [1,] 1 6099 1 2 0 0 ## [2,] 1 4512 0 0 3 4 ## [1] \"ReaderSumm\" ## [,1] [,2] [,3] ## [1,] 0 0 2 ## [1] \"ReaderSumm\" ## [,1] [,2] [,3] ## [1,] 1 2 2 ## List of 16 ## $ MinAge : num 0 ## $ MaxAge : num 25 ## $ NDataSet : num 1 ## $ MaxReader : num 4 ## $ TheData : num [1, 1:264, 1:5] 9 1 153 30 1 12 454 51 33 499 ... ## $ Npnt : num 264 ## $ ReadPnt : num [1, 1:4] 1 2 3 4 ## $ NReaders : num 4 ## $ MinusA : num 0 ## $ PlusA : num 25 ## $ RefAge : num 5 ## $ ReaderSumm : num [1, 1:3] 1 2 2 ## $ ReaderStruc: num [1:2, 1:6] 1 1 6099 4512 1 ... ## $ MaxCells : num 676 ## $ TotalN : num 10611 ## $ EffN : num 10611 ## NULL BG2022_spc <- AgeingError:::CreateSpecs(file.path(data_dir, \"BG2022.spc\"), DataSpecs=BG2022_dat, verbose=TRUE) ## List of 7 ## $ ModelSpecs:List of 4 ## ..$ :List of 10 ## .. ..$ BiasOpt : num 0 ## .. ..$ SigOpt : num 2 ## .. ..$ BiasPar : NULL ## .. ..$ BiasLow : NULL ## .. ..$ BiasHi : NULL ## .. ..$ BiasUsed : NULL ## .. ..$ SigmaPar : num [1:3] 0.2 0.001 0.5 ## .. ..$ SigmaLow : num [1:3] 0 0.01 0 ## .. ..$ SigmaHi : num [1:3] 1 1 2 ## .. ..$ SigmaUsed: num [1:3] 1 1 1 ## ..$ :List of 10 ## .. ..$ BiasOpt : num 0 ## .. ..$ SigOpt : num -1 ## .. ..$ BiasPar : NULL ## .. ..$ BiasLow : NULL ## .. ..$ BiasHi : NULL ## .. ..$ BiasUsed : NULL ## .. ..$ SigmaPar : NULL ## .. ..$ SigmaLow : NULL ## .. ..$ SigmaHi : NULL ## .. ..$ SigmaUsed: NULL ## ..$ :List of 10 ## .. ..$ BiasOpt : num 0 ## .. ..$ SigOpt : num 2 ## .. ..$ BiasPar : NULL ## .. ..$ BiasLow : NULL ## .. ..$ BiasHi : NULL ## .. ..$ BiasUsed : NULL ## .. ..$ SigmaPar : num [1:3] 0.2 0.001 0.5 ## .. ..$ SigmaLow : num [1:3] 0 0.01 0 ## .. ..$ SigmaHi : num [1:3] 1 1 2 ## .. ..$ SigmaUsed: num [1:3] 1 1 1 ## ..$ :List of 10 ## .. ..$ BiasOpt : num 0 ## .. ..$ SigOpt : num -3 ## .. ..$ BiasPar : NULL ## .. ..$ BiasLow : NULL ## .. ..$ BiasHi : NULL ## .. ..$ BiasUsed : NULL ## .. ..$ SigmaPar : NULL ## .. ..$ SigmaLow : NULL ## .. ..$ SigmaHi : NULL ## .. ..$ SigmaUsed: NULL ## $ NumSigma : num 6 ## $ NumBias : num 0 ## $ xvalsL : num [1:4, 1:100] 0 0 0 0 0 0 0 0 0 0 ... ## $ nknotsL : num [1:4] 0 0 0 0 ## $ xvals : num [1:4, 1:100] 0 0 0 0 0 0 0 0 0 0 ... ## $ nknots : num [1:4] 0 0 0 0 ## NULL BG2022_mod <- AgeingError::DoApplyAgeError(Species = \"BG2022\", DataSpecs = BG2022_dat, ModelSpecsInp = BG2022_spc, AprobWght = 1e-06, SlopeWght = 0.01, SaveDir = \"Results\", verbose = FALSE) str(BG2022_mod) ## List of 12 ## $ par : Named num [1:31] 0.1672 0.2357 0.5399 0.2418 0.0247 ... ## ..- attr(*, \"names\")= chr [1:31] \"SDPar\" \"SDPar\" \"SDPar\" \"SDPar\" ... ## $ fn :function (x) ## $ gr :function (x = last.par[lfixed()], ...) ## $ he :function (x = last.par[lfixed()], atomic = usingAtomics()) ## $ hessian : logi FALSE ## $ method : chr \"BFGS\" ## $ retape :function (set.defaults = TRUE) ## $ env : ## $ report :function (par = last.par) ## $ simulate:function (par = last.par, complete = FALSE) ## $ fn_orig :function (x = last.par[lfixed()], ...) ## $ fitv : num 40778 BG2022_out <- AgeingError:::ProcessResults(Species = \"BG2022\", SaveDir = \"Results\", CalcEff = TRUE, verbose = FALSE) Data set: 1 Data_set Group Group Line Readers Obs Obs_Numbers Pred_Numbers Data Point: 1 1 1 1 0 0 -1 -1 9 15.6581407 9.241041710732 Data Point: 1 1 1 2 0 10 -1 -1 1 1.7397934 0 Data Point: 1 1 1 3 1 1 -1 -1 153 266.1883915 186.217154197499 BG2022final_dat <- AgeingError:::CreateData(file.path(data_dir, \"BG2022_trim_8_1.dat\"), NDataSet=1, verbose=TRUE, EchoFile=\"BG2022finalecho.out\") ## readers 1 2 3 4 ## Last line of data set 1 is 1 -999 -999 23 22 ## WARNING - there are some missing data; the effective sample size calculation may be dubious, ## ## Number of rows in NrowStruc 2 ## [1] 2 ## [1] \"ReaderStruc\" ## [,1] [,2] [,3] [,4] [,5] [,6] ## [1,] 1 6079 1 2 0 0 ## [2,] 1 4512 0 0 3 4 ## [1] \"ReaderSumm\" ## [,1] [,2] [,3] ## [1,] 0 0 2 ## [1] \"ReaderSumm\" ## [,1] [,2] [,3] ## [1,] 1 2 2 ## List of 16 ## $ MinAge : num 0 ## $ MaxAge : num 25 ## $ NDataSet : num 1 ## $ MaxReader : num 4 ## $ TheData : num [1, 1:252, 1:5] 153 30 1 12 454 51 33 499 65 3 ... ## $ Npnt : num 252 ## $ ReadPnt : num [1, 1:4] 1 2 3 4 ## $ NReaders : num 4 ## $ MinusA : num 0 ## $ PlusA : num 25 ## $ RefAge : num 5 ## $ ReaderSumm : num [1, 1:3] 1 2 2 ## $ ReaderStruc: num [1:2, 1:6] 1 1 6079 4512 1 ... ## $ MaxCells : num 676 ## $ TotalN : num 10591 ## $ EffN : num 10591 ## NULL BG2022final_spc <- AgeingError:::CreateSpecs(file.path(data_dir, \"BG2022_trim_8_1.spc\"), DataSpecs=BG2022final_dat, verbose=TRUE) ## List of 7 ## $ ModelSpecs:List of 4 ## ..$ :List of 10 ## .. ..$ BiasOpt : num 0 ## .. ..$ SigOpt : num 2 ## .. ..$ BiasPar : NULL ## .. ..$ BiasLow : NULL ## .. ..$ BiasHi : NULL ## .. ..$ BiasUsed : NULL ## .. ..$ SigmaPar : num [1:3] 0.2 0.001 0.5 ## .. ..$ SigmaLow : num [1:3] 0 0.01 0 ## .. ..$ SigmaHi : num [1:3] 1 1 2 ## .. ..$ SigmaUsed: num [1:3] 1 1 1 ## ..$ :List of 10 ## .. ..$ BiasOpt : num 0 ## .. ..$ SigOpt : num -1 ## .. ..$ BiasPar : NULL ## .. ..$ BiasLow : NULL ## .. ..$ BiasHi : NULL ## .. ..$ BiasUsed : NULL ## .. ..$ SigmaPar : NULL ## .. ..$ SigmaLow : NULL ## .. ..$ SigmaHi : NULL ## .. ..$ SigmaUsed: NULL ## ..$ :List of 10 ## .. ..$ BiasOpt : num 0 ## .. ..$ SigOpt : num 7 ## .. ..$ BiasPar : NULL ## .. ..$ BiasLow : NULL ## .. ..$ BiasHi : NULL ## .. ..$ BiasUsed : NULL ## .. ..$ SigmaPar : num [1:2] 0.2 0.5 ## .. ..$ SigmaLow : num [1:2] 0 0 ## .. ..$ SigmaHi : num [1:2] 1 2 ## .. ..$ SigmaUsed: num [1:2] 0 1 ## ..$ :List of 10 ## .. ..$ BiasOpt : num 0 ## .. ..$ SigOpt : num -3 ## .. ..$ BiasPar : NULL ## .. ..$ BiasLow : NULL ## .. ..$ BiasHi : NULL ## .. ..$ BiasUsed : NULL ## .. ..$ SigmaPar : NULL ## .. ..$ SigmaLow : NULL ## .. ..$ SigmaHi : NULL ## .. ..$ SigmaUsed: NULL ## $ NumSigma : num 5 ## $ NumBias : num 0 ## $ xvalsL : num [1:4, 1:100] 0 0 0 0 0 0 0 0 0 0 ... ## $ nknotsL : num [1:4] 0 0 0 0 ## $ xvals : num [1:4, 1:100] 0 0 0 0 0 0 0 0 0 0 ... ## $ nknots : num [1:4] 0 0 0 0 ## NULL BG2022final_mod <- AgeingError::DoApplyAgeError(Species = \"BG2022_trim_8_1\", DataSpecs = BG2022final_dat, ModelSpecsInp = BG2022final_spc, AprobWght = 1e-06, SlopeWght = 0.01, SaveDir = \"Results\", verbose = FALSE) BG2022final_out <- AgeingError:::ProcessResults(Species = \"BG2022_trim_8_1\", SaveDir = \"Results\", CalcEff = TRUE, verbose = FALSE)"},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/articles/getting_started.html","id":"bight-redfish","dir":"Articles","previous_headings":"Examples","what":"Bight Redfish","title":"Estimating ageing error using the TMB model written by André Punt","text":"Bight Redfish (Centroberyx gerrardi) long-lived species caught trawl Great Australian Bight (Curin-Osorio Burch 2022). age readings three separate readers re-read reads (.e. inter-reader comparisons data). check summary information data file. don’t appear problems, however, still getting warning missing data. Next load model specifications using CreateSpecs function. Bight Redfish fit one parameter model assuming expected age linear function true age. assume inter-reader variability (readers ageing uncertainty reader 1). Note specified readers ageing uncertainty (readers 2–6 SigmaOpt=-1), need provide one line sigma parameters. estimate ageing error Bight Redfish. save Bight Redfish model output. examination report file (REB2022.rpt) shows maximum gradient 0.0221, indicating model quite converged. remove four outliers probability <1e-5 also start model estimated value CV (0.0413288). save revised data model specifications (REB2022_trim.dat REB2022_trim.spc) rerun model (note suppress creation output document). final gradient -0.001973, close convergence.","code":"REB2022_dat <- AgeingError:::CreateData(file.path(data_dir, \"REB2022.dat\"), NDataSet=1, verbose=TRUE, EchoFile=\"REB2022echo.out\") ## readers 1 2 3 4 5 6 ## Last line of data set 1 is 1 -999 -999 -999 -999 62 62 ## WARNING - there are some missing data; the effective sample size calculation may be dubious, ## ## Number of rows in NrowStruc 3 ## [1] 3 ## [1] \"ReaderStruc\" ## [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] ## [1,] 1 800 1 2 0 0 0 0 ## [2,] 1 528 0 0 3 4 0 0 ## [3,] 1 682 0 0 0 0 5 6 ## [1] \"ReaderSumm\" ## [,1] [,2] [,3] ## [1,] 0 0 3 ## [1] \"ReaderSumm\" ## [,1] [,2] [,3] ## [1,] 1 2 3 ## List of 16 ## $ MinAge : num 0 ## $ MaxAge : num 64 ## $ NDataSet : num 1 ## $ MaxReader : num 6 ## $ TheData : num [1, 1:511, 1:7] 1 1 3 2 1 1 4 4 1 1 ... ## $ Npnt : num 511 ## $ ReadPnt : num [1, 1:6] 1 2 3 4 5 6 ## $ NReaders : num 6 ## $ MinusA : num 5 ## $ PlusA : num 40 ## $ RefAge : num 15 ## $ ReaderSumm : num [1, 1:3] 1 2 3 ## $ ReaderStruc: num [1:3, 1:8] 1 1 1 800 528 682 1 0 0 2 ... ## $ MaxCells : num 4225 ## $ TotalN : num 2010 ## $ EffN : num 2010 ## NULL REB2022_spc <- AgeingError:::CreateSpecs(file.path(data_dir, \"REB2022.spc\"), DataSpecs=REB2022_dat, verbose=TRUE) ## List of 7 ## $ ModelSpecs:List of 6 ## ..$ :List of 10 ## .. ..$ BiasOpt : num 0 ## .. ..$ SigOpt : num 1 ## .. ..$ BiasPar : NULL ## .. ..$ BiasLow : NULL ## .. ..$ BiasHi : NULL ## .. ..$ BiasUsed : NULL ## .. ..$ SigmaPar : num 0.1 ## .. ..$ SigmaLow : num 0.001 ## .. ..$ SigmaHi : num 10 ## .. ..$ SigmaUsed: num 1 ## ..$ :List of 10 ## .. ..$ BiasOpt : num 0 ## .. ..$ SigOpt : num -1 ## .. ..$ BiasPar : NULL ## .. ..$ BiasLow : NULL ## .. ..$ BiasHi : NULL ## .. ..$ BiasUsed : NULL ## .. ..$ SigmaPar : NULL ## .. ..$ SigmaLow : NULL ## .. ..$ SigmaHi : NULL ## .. ..$ SigmaUsed: NULL ## ..$ :List of 10 ## .. ..$ BiasOpt : num 0 ## .. ..$ SigOpt : num -1 ## .. ..$ BiasPar : NULL ## .. ..$ BiasLow : NULL ## .. ..$ BiasHi : NULL ## .. ..$ BiasUsed : NULL ## .. ..$ SigmaPar : NULL ## .. ..$ SigmaLow : NULL ## .. ..$ SigmaHi : NULL ## .. ..$ SigmaUsed: NULL ## ..$ :List of 10 ## .. ..$ BiasOpt : num 0 ## .. ..$ SigOpt : num -1 ## .. ..$ BiasPar : NULL ## .. ..$ BiasLow : NULL ## .. ..$ BiasHi : NULL ## .. ..$ BiasUsed : NULL ## .. ..$ SigmaPar : NULL ## .. ..$ SigmaLow : NULL ## .. ..$ SigmaHi : NULL ## .. ..$ SigmaUsed: NULL ## ..$ :List of 10 ## .. ..$ BiasOpt : num 0 ## .. ..$ SigOpt : num -1 ## .. ..$ BiasPar : NULL ## .. ..$ BiasLow : NULL ## .. ..$ BiasHi : NULL ## .. ..$ BiasUsed : NULL ## .. ..$ SigmaPar : NULL ## .. ..$ SigmaLow : NULL ## .. ..$ SigmaHi : NULL ## .. ..$ SigmaUsed: NULL ## ..$ :List of 10 ## .. ..$ BiasOpt : num 0 ## .. ..$ SigOpt : num -1 ## .. ..$ BiasPar : NULL ## .. ..$ BiasLow : NULL ## .. ..$ BiasHi : NULL ## .. ..$ BiasUsed : NULL ## .. ..$ SigmaPar : NULL ## .. ..$ SigmaLow : NULL ## .. ..$ SigmaHi : NULL ## .. ..$ SigmaUsed: NULL ## $ NumSigma : num 1 ## $ NumBias : num 0 ## $ xvalsL : num [1:6, 1:100] 0 0 0 0 0 0 0 0 0 0 ... ## $ nknotsL : num [1:6] 0 0 0 0 0 0 ## $ xvals : num [1:6, 1:100] 0 0 0 0 0 0 0 0 0 0 ... ## $ nknots : num [1:6] 0 0 0 0 0 0 ## NULL REB2022_mod <- AgeingError::DoApplyAgeError(Species = \"REB2022\", DataSpecs = REB2022_dat, ModelSpecsInp = REB2022_spc, AprobWght = 1e-06, SlopeWght = 0.01, SaveDir = \"Results\", verbose = FALSE) REB2022_out <- AgeingError:::ProcessResults(Species = \"REB2022\", SaveDir = \"Results\", CalcEff = TRUE, verbose = FALSE) REB2022_dat2 <- AgeingError:::CreateData(file.path(data_dir, \"REB2022_trim.dat\"), NDataSet=1, verbose=FALSE, EchoFile=\"REB2022_trimecho.out\") REB2022_spc2 <- AgeingError:::CreateSpecs(file.path(data_dir, \"REB2022_trim.spc\"), DataSpecs=REB2022_dat2, verbose=FALSE) REB2022_mod2 <- AgeingError::DoApplyAgeError(Species = \"REB2022_final\", DataSpecs = REB2022_dat2, ModelSpecsInp = REB2022_spc2, AprobWght = 1e-06, SlopeWght = 0.01, SaveDir = \"Results\", verbose = FALSE) REB2022_out2 <- AgeingError:::ProcessResults(Species = \"REB2022_final\", SaveDir = \"Results\", CalcEff = TRUE, verbose = FALSE)"},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/articles/getting_started.html","id":"school-whiting","dir":"Articles","previous_headings":"Examples","what":"School Whiting","title":"Estimating ageing error using the TMB model written by André Punt","text":"School Whiting (Sillago flindersi) short-lived species caught Danish seine trawl south eastern Australia (Day et al. 2020). species provides example data file three separate data sets spline model. Load School Whiting data file, make sure set number data sets three (NDataSet=3). Make sure check summary values data file. Load specifications School Whiting. School Whiting fit spline function (SigmaOption=5) five knots (0, 3, 5, 7, 9). Note initial parameter values log space. Fit ageing error model save results maximum gradient ~2.3-05 indicating model converged. estimated standard deviation age shows ageing uncertainty increasing age 0 age 4, declining ages 5 6 increasing substantially ages 7–9. fits far right hand side age distribution poor little data inform model region. appropriateness model discussed ageing technicians.","code":"WHS2_dat <- AgeingError:::CreateData(file.path(data_dir, \"WHS2.dat\"), NDataSet=3, verbose=TRUE, EchoFile=\"WHS2echo.out\") ## readers 1 2 ## readers 3 4 ## readers 5 6 ## Last line of data set 1 is 1 9 9 ## Last line of data set 2 is 2 8 8 ## Last line of data set 3 is 1 8 7 ## Number of rows in NrowStruc 3 ## [1] 3 ## [1] \"ReaderStruc\" ## [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] ## [1,] 1 1882 1 2 0 0 0 0 ## [2,] 2 366 3 4 0 0 0 0 ## [3,] 3 385 5 6 0 0 0 0 ## [1] \"ReaderSumm\" ## [,1] [,2] [,3] ## [1,] 0 0 1 ## [2,] 0 0 1 ## [3,] 0 0 1 ## [1] \"ReaderSumm\" ## [,1] [,2] [,3] ## [1,] 1 2 1 ## [2,] 2 2 1 ## [3,] 3 2 1 ## List of 16 ## $ MinAge : num 0 ## $ MaxAge : num 9 ## $ NDataSet : num 3 ## $ MaxReader : num 6 ## $ TheData : num [1:3, 1:27, 1:7] 1 4 11 112 1 2 22 25 1 1 ... ## $ Npnt : num [1:3] 27 23 22 ## $ ReadPnt : num [1:3, 1:6] 1 3 5 2 4 6 0 0 0 0 ... ## $ NReaders : num [1:3] 2 2 2 ## $ MinusA : num [1:3] 0 0 0 ## $ PlusA : num [1:3] 9 9 9 ## $ RefAge : num [1:3] 5 5 5 ## $ ReaderSumm : num [1:3, 1:3] 1 2 3 2 2 2 1 1 1 ## $ ReaderStruc: num [1:3, 1:8] 1 2 3 1882 366 ... ## $ MaxCells : num 100 ## $ TotalN : num [1:3] 1882 366 385 ## $ EffN : num [1:3] 1882 366 385 ## NULL WHS2_spc <- AgeingError:::CreateSpecs(file.path(data_dir, \"WHS2.spc\"), DataSpecs=WHS2_dat, verbose=TRUE) ## Spline used to define SD for reader 1 ## Selected knots are located at 0 3 5 7 9 ## List of 7 ## $ ModelSpecs:List of 6 ## ..$ :List of 10 ## .. ..$ BiasOpt : num 0 ## .. ..$ SigOpt : num 5 ## .. ..$ BiasPar : NULL ## .. ..$ BiasLow : NULL ## .. ..$ BiasHi : NULL ## .. ..$ BiasUsed : NULL ## .. ..$ SigmaPar : num [1:5] -2.303 -1.204 -0.693 -0.105 0.9 ## .. ..$ SigmaLow : num [1:5] -10 -10 -10 -10 -10 ## .. ..$ SigmaHi : num [1:5] 40 40 40 40 40 ## .. ..$ SigmaUsed: num [1:5] 1 1 1 1 1 ## ..$ :List of 10 ## .. ..$ BiasOpt : num 0 ## .. ..$ SigOpt : num -1 ## .. ..$ BiasPar : NULL ## .. ..$ BiasLow : NULL ## .. ..$ BiasHi : NULL ## .. ..$ BiasUsed : NULL ## .. ..$ SigmaPar : NULL ## .. ..$ SigmaLow : NULL ## .. ..$ SigmaHi : NULL ## .. ..$ SigmaUsed: NULL ## ..$ :List of 10 ## .. ..$ BiasOpt : num 0 ## .. ..$ SigOpt : num -1 ## .. ..$ BiasPar : NULL ## .. ..$ BiasLow : NULL ## .. ..$ BiasHi : NULL ## .. ..$ BiasUsed : NULL ## .. ..$ SigmaPar : NULL ## .. ..$ SigmaLow : NULL ## .. ..$ SigmaHi : NULL ## .. ..$ SigmaUsed: NULL ## ..$ :List of 10 ## .. ..$ BiasOpt : num 0 ## .. ..$ SigOpt : num -1 ## .. ..$ BiasPar : NULL ## .. ..$ BiasLow : NULL ## .. ..$ BiasHi : NULL ## .. ..$ BiasUsed : NULL ## .. ..$ SigmaPar : NULL ## .. ..$ SigmaLow : NULL ## .. ..$ SigmaHi : NULL ## .. ..$ SigmaUsed: NULL ## ..$ :List of 10 ## .. ..$ BiasOpt : num 0 ## .. ..$ SigOpt : num -1 ## .. ..$ BiasPar : NULL ## .. ..$ BiasLow : NULL ## .. ..$ BiasHi : NULL ## .. ..$ BiasUsed : NULL ## .. ..$ SigmaPar : NULL ## .. ..$ SigmaLow : NULL ## .. ..$ SigmaHi : NULL ## .. ..$ SigmaUsed: NULL ## ..$ :List of 10 ## .. ..$ BiasOpt : num 0 ## .. ..$ SigOpt : num -1 ## .. ..$ BiasPar : NULL ## .. ..$ BiasLow : NULL ## .. ..$ BiasHi : NULL ## .. ..$ BiasUsed : NULL ## .. ..$ SigmaPar : NULL ## .. ..$ SigmaLow : NULL ## .. ..$ SigmaHi : NULL ## .. ..$ SigmaUsed: NULL ## $ NumSigma : num 5 ## $ NumBias : num 0 ## $ xvalsL : num [1:6, 1:100] 0 0 0 0 0 0 0 0 0 0 ... ## $ nknotsL : num [1:6] 0 0 0 0 0 0 ## $ xvals : num [1:6, 1:100] 0 0 0 0 0 0 3 0 0 0 ... ## $ nknots : num [1:6] 5 0 0 0 0 0 ## NULL WHS2_mod <- AgeingError::DoApplyAgeError(Species = \"WHS2\", DataSpecs = WHS2_dat, ModelSpecsInp = WHS2_spc, AprobWght = 1e-06, SlopeWght = 0.01, SaveDir = \"Results\", verbose = FALSE) WHS2_out <- AgeingError:::ProcessResults(Species = \"WHS2\", SaveDir = \"Results\", CalcEff = TRUE, verbose = FALSE)"},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/articles/getting_started.html","id":"sablefish","dir":"Articles","previous_headings":"Examples","what":"Sablefish","title":"Estimating ageing error using the TMB model written by André Punt","text":"Sablefish (Anoplopoma fimbria) provides example using bias option. check summary information data file. data set several inter-reader comparisons. load model specifications using CreateSpecs function. Sablefish example fits three separate series (1-2, 3-4 & 5-6). model assumes following: Bias Options: Reader 5 unbiased, readers 1 & 2 constant bias, reader 6 separate constant bias bias readers 3 & 4 follows Michaelis-Menten relationship. specifications file first list relates constant bias readers 1 & 2, next three lines readers 3 & 4, final line specifies constant bias reader 6. Reader 5 assumed unbiased therefore doesn’t require parameters specified. Sigma Options: Readers 1 & 2 assume linear relationship (constant CV), readers 5 & 6 separate linear relationship. Readers 3 & 4 assume ageing uncertainty follows Michaelis-Menten relationship. parameters specified manner bias option (). code can used fit Sablefish ageing error model. don’t run particular model slow.","code":"Sable_dat <- AgeingError:::CreateData(file.path(data_dir, \"Sable.dat\"), NDataSet=1, verbose=TRUE, EchoFile=\"SableEcho.out\") ## readers 1 2 3 4 5 6 ## Last line of data set 1 is 6 -999 -999 -999 -999 2 2 ## WARNING - there are some missing data; the effective sample size calculation may be dubious, ## ## Number of rows in NrowStruc 6 ## [1] 6 ## [1] \"ReaderStruc\" ## [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] ## [1,] 1 8659 1 2 0 0 0 0 ## [2,] 1 282 0 2 3 0 0 0 ## [3,] 1 8138 0 0 3 4 0 0 ## [4,] 1 226 0 0 0 4 5 0 ## [5,] 1 138 0 2 0 0 5 0 ## [6,] 1 3234 0 0 0 0 5 6 ## [1] \"ReaderSumm\" ## [,1] [,2] [,3] ## [1,] 0 0 6 ## [1] \"ReaderSumm\" ## [,1] [,2] [,3] ## [1,] 1 2 6 ## List of 16 ## $ MinAge : num 1 ## $ MaxAge : num 100 ## $ NDataSet : num 1 ## $ MaxReader : num 6 ## $ TheData : num [1, 1:2494, 1:7] 1 1 1 1 1 1 1 1 1 1 ... ## $ Npnt : num 2494 ## $ ReadPnt : num [1, 1:6] 1 2 3 4 5 6 ## $ NReaders : num 6 ## $ MinusA : num 1 ## $ PlusA : num 50 ## $ RefAge : num 4 ## $ ReaderSumm : num [1, 1:3] 1 2 6 ## $ ReaderStruc: num [1:6, 1:8] 1 1 1 1 1 ... ## $ MaxCells : num 10201 ## $ TotalN : num 20677 ## $ EffN : num 20677 ## NULL Sable_spc <- AgeingError:::CreateSpecs(file.path(data_dir, \"Sable.spc\"), DataSpecs=Sable_dat, verbose=TRUE) ## List of 7 ## $ ModelSpecs:List of 6 ## ..$ :List of 10 ## .. ..$ BiasOpt : num 1 ## .. ..$ SigOpt : num 1 ## .. ..$ BiasPar : num 1 ## .. ..$ BiasLow : num 0.001 ## .. ..$ BiasHi : num 3 ## .. ..$ BiasUsed : num 1 ## .. ..$ SigmaPar : num 1 ## .. ..$ SigmaLow : num 0.001 ## .. ..$ SigmaHi : num 100 ## .. ..$ SigmaUsed: num 1 ## ..$ :List of 10 ## .. ..$ BiasOpt : num -1 ## .. ..$ SigOpt : num -1 ## .. ..$ BiasPar : NULL ## .. ..$ BiasLow : NULL ## .. ..$ BiasHi : NULL ## .. ..$ BiasUsed : NULL ## .. ..$ SigmaPar : NULL ## .. ..$ SigmaLow : NULL ## .. ..$ SigmaHi : NULL ## .. ..$ SigmaUsed: NULL ## ..$ :List of 10 ## .. ..$ BiasOpt : num 2 ## .. ..$ SigOpt : num 2 ## .. ..$ BiasPar : num [1:3] 1e+00 1e-02 1e+02 ## .. ..$ BiasLow : num [1:3] 1e-03 -1e+01 1e-03 ## .. ..$ BiasHi : num [1:3] 10 1 200 ## .. ..$ BiasUsed : num [1:3] 1 1 1 ## .. ..$ SigmaPar : num [1:3] 1 0.01 10 ## .. ..$ SigmaLow : num [1:3] 1e-03 -1e+01 1e-03 ## .. ..$ SigmaHi : num [1:3] 100 1 100 ## .. ..$ SigmaUsed: num [1:3] 1 1 1 ## ..$ :List of 10 ## .. ..$ BiasOpt : num -3 ## .. ..$ SigOpt : num -3 ## .. ..$ BiasPar : NULL ## .. ..$ BiasLow : NULL ## .. ..$ BiasHi : NULL ## .. ..$ BiasUsed : NULL ## .. ..$ SigmaPar : NULL ## .. ..$ SigmaLow : NULL ## .. ..$ SigmaHi : NULL ## .. ..$ SigmaUsed: NULL ## ..$ :List of 10 ## .. ..$ BiasOpt : num 0 ## .. ..$ SigOpt : num 1 ## .. ..$ BiasPar : NULL ## .. ..$ BiasLow : NULL ## .. ..$ BiasHi : NULL ## .. ..$ BiasUsed : NULL ## .. ..$ SigmaPar : num 1 ## .. ..$ SigmaLow : num 0.001 ## .. ..$ SigmaHi : num 100 ## .. ..$ SigmaUsed: num 1 ## ..$ :List of 10 ## .. ..$ BiasOpt : num 1 ## .. ..$ SigOpt : num -5 ## .. ..$ BiasPar : num 1 ## .. ..$ BiasLow : num 0.001 ## .. ..$ BiasHi : num 3 ## .. ..$ BiasUsed : num 1 ## .. ..$ SigmaPar : NULL ## .. ..$ SigmaLow : NULL ## .. ..$ SigmaHi : NULL ## .. ..$ SigmaUsed: NULL ## $ NumSigma : num 5 ## $ NumBias : num 5 ## $ xvalsL : num [1:6, 1:100] 0 0 0 0 0 0 0 0 0 0 ... ## $ nknotsL : num [1:6] 0 0 0 0 0 0 ## $ xvals : num [1:6, 1:100] 0 0 0 0 0 0 0 0 0 0 ... ## $ nknots : num [1:6] 0 0 0 0 0 0 ## NULL ## run the Sablefish model Sable_mod <- AgeingError::DoApplyAgeError(Species = \"Sable\", DataSpecs = Sable_dat, ModelSpecsInp = Sable_spc, AprobWght = 1e-06, SlopeWght = 0.01, SaveDir = \"Results\", verbose = FALSE) ## save the model results Sable_out <- AgeingError:::ProcessResults(Species = \"Sable\", SaveDir = \"Results\", CalcEff = TRUE, verbose = FALSE)"},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/articles/getting_started.html","id":"trouble-shooting","dir":"Articles","previous_headings":"","what":"Trouble Shooting","title":"Estimating ageing error using the TMB model written by André Punt","text":"suggestions getting converged model provided . Vary initial values parameters specifications file. models close convergence, re-run model using estimated parameters initial values. Problematic data can identified residual plots bottom report file prediction probabilities <1e-5. Removing data low probability can improve fit. may sufficient data estimate ageing error multiple combinations readers, data can pooled estimate fewer parameters (bias / sigma option -x) model may appropriate, select different model based residual plots. Prespecify (fix) one parameters pair readers.","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/articles/getting_started.html","id":"acknowledgements","dir":"Articles","previous_headings":"","what":"Acknowledgements","title":"Estimating ageing error using the TMB model written by André Punt","text":"Fish Ageing Services https://www.fishageingservices.com/ provided data Blue Grenadier, Bight Redfish, School Whiting Australian Fisheries Management Authority (AFMA) provided funding data collection otolith reading. sablefish age data provided NWFSC. document prepared documentation examples written André Punt. Pia Bessell-Browne provided helpful comments improved document.","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/articles/getting_started.html","id":"references","dir":"Articles","previous_headings":"","what":"References","title":"Estimating ageing error using the TMB model written by André Punt","text":"Day, J., Hall, K., Bessell-Browne, P., Sporcic, M. (2020) School Whiting (Sillago flindersi) stock assessment based data 2019. discussion SERAG, December 2020. Curin-Osorio, S., Burch, P. (2022). Bight Redfish (Centroberyx gerrardi) stock assessment based data 2021-22. Technical paper presented GABRAG, 22 November 2022, Hobart, Tasmania. Punt, .E., Smith, D.C., KrusicGolub, K., Robertson, S. (2008). Quantifying age-reading error use fisheries stock assessments, application species Australia’s southern eastern scalefish shark fishery. Canadian Journal Fisheries Aquatic Sciences 65: 1991–2005. https://doi.org/10.1139/F08-111 Tuck, G.N., Bessell-Browne, P. (2022). Blue Grenadier (Macruronus novaezelandiae) stock assessment based data 2021. Technical paper presented theSERAG2, 29–-30\\(^{th}\\) November 2022, Melbourne, Victoria. 99pp.","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Andre E. Punt. Author. Kelli F. Johnson. Author. James T. Thorson. Contributor, copyright holder. Ian G. Taylor. Author, maintainer. Paul Burch. Author. Ian J. Stewart. Contributor. Melissa . Haltuch. Contributor.","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Punt AE, Smith DC, KrusicGolub K, Robertson S (2008). “Quantifying age-reading error use fisheries stock assessments, application species Australia's southern eastern scalefish shark fishery.” Canadian Journal Fisheries Aquatic Sciences, 65, 1991–2005. doi:10.1139/F08-11.","code":"@Article{, title = {Quantifying age-reading error for use in fisheries stock assessments, with application to species in {Australia}'s southern and eastern scalefish and shark fishery}, author = {Andre E. Punt and D. C. Smith and K. KrusicGolub and S. Robertson}, year = {2008}, journal = {Canadian Journal of Fisheries and Aquatic Sciences}, volume = {65}, pages = {1991--2005}, doi = {10.1139/F08-11}, }"},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/index.html","id":"description","dir":"","previous_headings":"","what":"Estimating ageing error with TMB from double reads","title":"Estimating ageing error with TMB from double reads","text":"AgeingError Software estimate ageing error given double-reads hard structures (e.g., otoliths)","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/index.html","id":"instructions","dir":"","previous_headings":"","what":"Instructions","title":"Estimating ageing error with TMB from double reads","text":"Install AgeingError package github site follows: See vignette example use.","code":"# using {remotes} remotes::install_github(\"pfmc-assessments/AgeingError\") # using {pak} pak::pak(\"pfmc-assessments/AgeingError\") # Load package library(AgeingError)"},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/AgeingError-package.html","id":null,"dir":"Reference","previous_headings":"","what":"Ageing error software — AgeingError-package","title":"Ageing error software — AgeingError-package","text":"R package support Punt et al. (2008) ageing error model","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/AgeingError-package.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Ageing error software — AgeingError-package","text":"Punt, .E., Smith, D.C., KrusicGolub, K., Robertson, S. 2008. Quantifying age-reading error use fisheries stock assessments, application species Australias southern eastern scalefish shark fishery. Canadian Journal Fisheries Aquatic Sciences 65: 1991-2005.","code":""},{"path":[]},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/AgeingError-package.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Ageing error software — AgeingError-package","text":"Maintainer: Ian G. Taylor ian.taylor@noaa.gov (ORCID) Authors: Andre E. Punt (ORCID) Kelli F. Johnson (ORCID) Paul Burch (ORCID) contributors: James T. Thorson (ORCID) [contributor, copyright holder] Ian J. Stewart [contributor] Melissa . Haltuch (ORCID) [contributor]","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/CreateData.html","id":null,"dir":"Reference","previous_headings":"","what":"Read the ageing error data — CreateData","title":"Read the ageing error data — CreateData","text":"Read ageing error data","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/CreateData.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Read the ageing error data — CreateData","text":"","code":"CreateData(DataFile = \"data.dat\", NDataSet = 1, verbose = FALSE, EchoFile = \"\")"},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/CreateData.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Read the ageing error data — CreateData","text":"DataFile Filename input data NDataSet Number data sets within DataFile verbose Return messages console (addition output EchoFile) EchoFile file path file created appended already exists store information data inputs. default '', leads output printed screen rather saved file. example user-defined input 'EchoTMB.'.","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/CreateData.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Read the ageing error data — CreateData","text":"Andre E. Punt","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/CreateSpecs.html","id":null,"dir":"Reference","previous_headings":"","what":"Read the ageing error specifications — CreateSpecs","title":"Read the ageing error specifications — CreateSpecs","text":"Read ageing error specifications","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/CreateSpecs.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Read the ageing error specifications — CreateSpecs","text":"","code":"CreateSpecs(SpecsFile = \"data.spc\", DataSpecs, verbose = FALSE)"},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/CreateSpecs.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Read the ageing error specifications — CreateSpecs","text":"SpecsFile Filename input specifications. DataSpecs output CreateData() verbose Return messages console (TRUE/FALSE)","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/CreateSpecs.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Read the ageing error specifications — CreateSpecs","text":"Andre E. Punt","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/DoApplyAgeError.html","id":null,"dir":"Reference","previous_headings":"","what":"Run the ageing error optimization routine — DoApplyAgeError","title":"Run the ageing error optimization routine — DoApplyAgeError","text":"Run ageing error optimization routine","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/DoApplyAgeError.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Run the ageing error optimization routine — DoApplyAgeError","text":"","code":"DoApplyAgeError( Species = \"AgeingError\", DataSpecs, ModelSpecsInp, AprobWght = 1e-06, SlopeWght = 0.01, SaveDir = getwd(), verbose = FALSE )"},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/DoApplyAgeError.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Run the ageing error optimization routine — DoApplyAgeError","text":"Species string used create file names. Typically, users use common name species interest, especially saving files multiple species single directory. Though, default \"AgeingError\". DataSpecs data object returned CreateData(). ModelSpecsInp specification object returned CreateSpecs(). AprobWght, SlopeWght Numeric values passed model. defaults 1e-06 0.01. Andre originally hard coded workspace. TODO: decide passed specifications data files. SaveDir path, relative absolute, directory results saved. directory need exist currently created dynamically. verbose logical specifying messages printed. default print, .e., verbose = FALSE.","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/DoApplyAgeError.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Run the ageing error optimization routine — DoApplyAgeError","text":"Andre E. Punt","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/PlotOutputFn.html","id":null,"dir":"Reference","previous_headings":"","what":"Plot output — PlotOutputFn","title":"Plot output — PlotOutputFn","text":"Plots age comparisons results fitted model. Comparisons must conditioned true age observed. , place true age, diagnostic plots generally condition estimated age, fixed mode conditional probability age otolith.","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/PlotOutputFn.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Plot output — PlotOutputFn","text":"","code":"PlotOutputFn( Data, MaxAge, SaveFile, PlotType = c(\"PNG\", \"PDF\"), subplot = 1:3, ReaderNames = NULL, ... )"},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/PlotOutputFn.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Plot output — PlotOutputFn","text":"Data data set first column integer providing number otoliths included row subsequent columns reader lab estimated ag,e reader/lab unique reading error bias. modeling framework allows , , 15 readers, .e., 16 columns. identical rows data frame otoliths exact read every reader/lab combined single row count first column. failed combine identical rows prior running model, alerted error XXX.rep file properly formatted data can ' cut-pasted XXX.dat file use. Missing reads given reader/lab entered -999. Order reader/lab columns similar readers/labs located next one another columns right can mirror columns immediate left terms parameter estimates. MaxAge integer, specifying maximum possible \"true\" age. SaveFile Directory agemat.exe located ADMB intermediate output files located. AdmbFile specified agemat.exe copied directory SaveFile. PlotType string specifying type saved plots desire. default save .png files via argument \"PNG\". option save .pdf files via \"PDF\". subplot Vector integers specifying plots create. default create three plots. ReaderNames Vector names reader, defaults \"Reader 1\", \"Reader 2\", etc. ... Additional arguments passed ageing_comparison().","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/PlotOutputFn.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Plot output — PlotOutputFn","text":"Returns AIC, AICc, BIC fitted model.","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/PlotOutputFn.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Plot output — PlotOutputFn","text":"Error bias reader/lab: panel graph provided panel shows expected standard deviation age reads reader/lab. displayed scatter plot read estimated ages otolith read reader/lab. Proportion--age histogram: estimated proportion age can plotted histogram displayed observed distribution read ages. useful determine hte estimated proportion age generally plausible, e.g., whether many ages estimated proportion age approaches zero, unlikely composite sample moderate effective sample sizes. plot can also used diagnostic confirm AIC selected reasonable values MinusAge PlusAge parameters. function read XXX.rep XXX.par files located SaveFile.","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/PlotOutputFn.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Plot output — PlotOutputFn","text":"Punt, .E., Smith, D.C., KrusicGolub, K., Robertson, S. 2008. Quantifying age-reading error use fisheries stock assessments, application species Australias southern eastern scalefish shark fishery. Can. J. Fish. Aquat. Sci. 65: 1991-2005.","code":""},{"path":[]},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/PlotOutputFn.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Plot output — PlotOutputFn","text":"James T. Thorson, Ian G. Taylor","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/ProcessResults.html","id":null,"dir":"Reference","previous_headings":"","what":"Process results of the ageing error estimation — ProcessResults","title":"Process results of the ageing error estimation — ProcessResults","text":"Process results ageing error estimation","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/ProcessResults.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Process results of the ageing error estimation — ProcessResults","text":"","code":"ProcessResults( Species = \"AgeingError\", SaveDir = getwd(), CalcEff = FALSE, verbose = FALSE )"},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/ProcessResults.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Process results of the ageing error estimation — ProcessResults","text":"Species string used create file names. Typically, users use common name species interest, especially saving files multiple species single directory. Though, default \"AgeingError\". SaveDir path, relative absolute, directory results saved. directory need exist currently created dynamically. CalcEff Calculate effective sample sizes (TRUE/FALSE) verbose logical specifying messages printed. default print, .e., verbose = FALSE.","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/ProcessResults.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Process results of the ageing error estimation — ProcessResults","text":"Andre E. Punt","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/RunFn.html","id":null,"dir":"Reference","previous_headings":"","what":"Run ageing error model — RunFn","title":"Run ageing error model — RunFn","text":"Run Punt et al. (2008) ADMB-based ageing error model within R.","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/RunFn.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Run ageing error model — RunFn","text":"","code":"RunFn( Data, SigOpt, KnotAges, BiasOpt, NDataSets = 1, MinAge, MaxAge, RefAge, MinusAge, PlusAge, MaxSd, MaxExpectedAge, SaveFile, EffSampleSize = 0, Intern = TRUE, AdmbFile = NULL, JustWrite = FALSE, CallType = \"system\", ExtraArgs = \" -est\", verbose = TRUE )"},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/RunFn.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Run ageing error model — RunFn","text":"Data data set first column integer providing number otoliths included row subsequent columns reader lab estimated ag,e reader/lab unique reading error bias. modeling framework allows , , 15 readers, .e., 16 columns. identical rows data frame otoliths exact read every reader/lab combined single row count first column. failed combine identical rows prior running model, alerted error XXX.rep file properly formatted data can ' cut-pasted XXX.dat file use. Missing reads given reader/lab entered -999. Order reader/lab columns similar readers/labs located next one another columns right can mirror columns immediate left terms parameter estimates. SigOpt vector one entry reader (.e., length(SigOpt) == NCOL(Data) -1). entry specifies functional form reading error function true age. Possible entries include following: -0-9+ Mirror standard deviation another reader, negative integer corresponds column reader/lab mirrored minus one, e.g., -1 causes mirror reader/lab 1, data stored second column Data. number must lower -1 times current position vector. 0 error. , potential bias. 1 Constant coefficient variation, .e., 1-parameter linear relationship standard deviation true age. 2 Curvilinear standard deviation, .e., 3-parameter Hollings-form relationship standard deviation true age. 3 Curvilinear coefficient variation, .e., 3-parameter Hollings-form relationship coefficient variation true age. 5 Spline estimated slope beginning end number parameters 2 + number knots. 6 Linear interpolation first knot 1 last knot maximum age, .e., MaxAge. KnotAges Ages associated knot. necessary input SigOpt = 5 SigOpt = 6. BiasOpt vector one entry reader/lab specifying type bias specific reader. Positive values lead estimated parameters negative values used shared parameters readers, just like SigOpt. Parameter sharing common one reader lab working together refine methods matching techniques. Possible entries include following: -0-9+ Mirror bias another reader, negative integer corresponds column reader/lab mirrored minus one, e.g., -1 causes mirror reader/lab 1, data stored second column Data. number must lower -1 times current position vector. 0 Unbiased, least one reader unbiased. 1 Constant coefficient variation, .e., 1-parameter linear relationship bias true age. 2 Curvilinear, .e., 2-parameter Hollings-form relationship bias true age. example entry situation seven readers assume first reader unbiased, readers 2-7 curvilinear bias, reader 3 shares parameters reader 2, reader 5 shares parameters reader 4, reader 7 shares parameters reader 6 look like c(0, 2, -2, 2, -4, 2, -6). NDataSets generally 1 values implemented. MinAge integer, specifying minimum possible \"true\" age. MaxAge integer, specifying maximum possible \"true\" age. RefAge arbitrarily chosen age \"true\" age-composition fixed-effects calculated offset. effect answer potentially effect estimation speed. MinusAge minimum age age-specific age-composition estimated. Ages MinusAge \"true\" proportion--age (\\(P_{}\\)) estimated $$P_a = P_{MinusAge}*exp^{(\\beta*(MinusAge - ))}$$, beta estimated log-linear trend \"true\" proportion--age. MinusAge = MinAge, beta estimated. PlusAge Identical MinusAge except defining age age-specific age composition estimated. MaxSd upper bound possible values standard deviation reading error. MaxExpectedAge Set MaxAge. SaveFile Directory agemat.exe located ADMB intermediate output files located. AdmbFile specified agemat.exe copied directory SaveFile. EffSampleSize Indicating whether effective sample size calculated. Missing values data matrix cause ineffective, case set 0. Intern logical input controls amount output displayed, TRUE indicates ADMB output displayed R FALSE leads suppression information. AdmbFile optional character entry specifies directory agemat.exe copied SaveFile. JustWrite logical input allows just data files written without running ADMB executable. CallType Either \"system\" \"shell\" depending Operating System R run. default \"system\". ExtraArgs string characters providing extra arguments passed ADMB. default \" -est\". verbose logical input controls amount feedback users receive program. default provide output possible verbose = TRUE.","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/RunFn.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Run ageing error model — RunFn","text":"premise Punt et al. (2008) calculate likelihood model parameters given observed data set otolith age reads multiple age readers. reader/lab, two parameters defined, one standard deviation one bias. model calculates expected age read standard deviation normally distributed reading error given true age otolith. relationships can linear curvilinear. true age obviously unobserved process can considered random effect. Thus, software computes likelihood summing across possible discrete values true age otolith. true age requires hyperdistribution represents prior probability otolith given age. hyperdistribution controlled set hyperparameters parameters govern standard deviation bias age reader/lab. Specifically, one hyperparameter estimated every age including MinusAge PlusAge. Ages outside range prior proportion age defined loglinear deviation proportion age extreme ages, .e., MinusAge PlusAge. slope loglinear deviations thus constitutes additional 1 2 fixed effect parameters. true proportion age calculated fixed effects loglinear slope parameters normalizing resulting distribution sums one.","code":""},{"path":[]},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/RunFn.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Run ageing error model — RunFn","text":"James T. Thorson, Ian J. Stewart, Andre E. Punt, Ian G. Taylor","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/RunFn.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Run ageing error model — RunFn","text":"","code":"example(SimulatorFn) #> #> SmltrF> # Parameters for generating data #> SmltrF> # This represents 2 unique readers #> SmltrF> # Row 1 -- Otoliths read only once by reader #> SmltrF> # Row 2 -- Otoliths read twice by reader 1 #> SmltrF> # Row 2 -- Otoliths read only once by reader 2 #> SmltrF> # Row 4 -- Otoliths read twice by reader 2 #> SmltrF> # Row 5 -- Otoliths read once by reader 1 and once by reader 2 #> SmltrF> ReadsMat <- structure(matrix(nrow = 5, ncol = 5, #> SmltrF+ c(rep(25, 5), #> SmltrF+ 1, 1, 0, 0, 1, #> SmltrF+ 0, 1, 0, 0, 0, #> SmltrF+ 0, 0, 1, 1, 1, #> SmltrF+ 0, 0, 0, 1, 0) #> SmltrF+ ), dimnames = list( #> SmltrF+ c(\"Reader1_Only\", \"Reader1_DoubleReads\", #> SmltrF+ \"Reader2_Only\", \"Reader2_DoubleReads\", #> SmltrF+ \"Reader1_&_Reader2\" #> SmltrF+ ), #> SmltrF+ c(\"NumberOfReads\", #> SmltrF+ \"Reader1\", \"Reader1_DoubleReads\", #> SmltrF+ \"Reader2\", \"Reader2_DoubleReads\" #> SmltrF+ )) #> SmltrF+ ) #> #> SmltrF> # Generate data #> SmltrF> set.seed(2) #> #> SmltrF> AgeReads <- SimulatorFn(Nreaders = 4, M = 0.2, #> SmltrF+ SelexForm = \"Logistic\", #> SmltrF+ SelexParams = c(5, 0.2), BiasParams = c(1, 1, 1.1, 1.1), #> SmltrF+ ErrorParams = c(0.2, 0.2, 0.2, 0.2), ReadsMat = ReadsMat, #> SmltrF+ RecCv = 0.6, RecAr1 = 0.8, Amax = 100) if (FALSE) { utils::write.csv(AgeReads, file = file.path(getwd(), \"Simulated_data_example.csv\")) } ##### Format data Nreaders <- ncol(AgeReads) # Change NA to -999 (which the Punt software considers missing data) AgeReads <- ifelse(is.na(AgeReads), -999, AgeReads) # Potentially eliminate rows that are only read once # These rows have no information about reading error, but are potentially # informative about latent age-structure. It is unknown whether eliminating # these rows degrades estimation of error and bias, and is currently # recommended to speed up computation if (FALSE) { KeepRow <- ifelse( rowSums(ifelse(AgeReads == -999, 0, 1), na.rm = TRUE) <= 1, FALSE, TRUE ) AgeReads <- AgeReads[KeepRow, ] } # AgeReads2 is the correctly formatted data object AgeReads2 <- rMx(c(1, AgeReads[1, ])) # Combine duplicate rows for (RowI in 2:nrow(AgeReads)) { DupRow <- NA for (PreviousRowJ in 1:nrow(AgeReads2)) { if (all( AgeReads[RowI,1:Nreaders] == AgeReads2[PreviousRowJ,1:Nreaders+1] )) { DupRow <- PreviousRowJ } } if (is.na(DupRow)) {# Add new row to AgeReads2 AgeReads2 <- rbind(AgeReads2, c(1, AgeReads[RowI, ])) } if(!is.na(DupRow)){# Increment number of samples for previous duplicate AgeReads2[DupRow,1] <- AgeReads2[DupRow,1] + 1 } } ######## Determine settings for ADMB # Define minimum and maximum ages for integral across unobserved ages MinAge <- 1 MaxAge <- ceiling(max(AgeReads2[,-1])/10)*10 BiasOpt <- c(0, -1, 0, -3) SigOpt <- c(1, -1, 6, -3) # Necessary for SigOpt option 5 or 6 KnotAges <- list(NA, NA, c(1, 10, 20, MaxAge), NA) ##### Run the model (MAY TAKE 5-10 MINUTES) if (FALSE) { fileloc <- file.path(tempdir(), \"age\") dir.create(fileloc, showWarnings = FALSE) RunFn(Data = AgeReads2, SigOpt = SigOpt, KnotAges = KnotAges, BiasOpt = BiasOpt, NDataSets = 1, MinAge = MinAge, MaxAge = MaxAge, RefAge = 10, MinusAge = 1, PlusAge = 30, SaveFile = fileloc, AdmbFile = file.path(system.file(\"executables\", package = \"nwfscAgeingError\"), .Platform$file.sep), EffSampleSize = 0, Intern = FALSE, JustWrite = FALSE, CallType = \"shell\" ) }"},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/SimulatorFn.html","id":null,"dir":"Reference","previous_headings":"","what":"Simulate double reading data — SimulatorFn","title":"Simulate double reading data — SimulatorFn","text":"function generate simulated double reading data given properties","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/SimulatorFn.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Simulate double reading data — SimulatorFn","text":"","code":"SimulatorFn( Nreaders, M, SelexForm, ErrorParams, BiasParams, SelexParams, ReadsMat, RecCv = 0.6, RecAr1 = 0.8, Amax = 100 )"},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/SimulatorFn.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Simulate double reading data — SimulatorFn","text":"Nreaders number ageing readers M True natural mortality SelexForm Form selectivity--age (logistic selex--age one implemented). ErrorParams Error type CV following equation: VarAgeRead = (CV*TrueAge)^2 BiasParams Bias type b following equation: EAgeRead = b*TrueAge SelexParams Selectivity parameters, standard logistic equation. ReadsMat Matrix describing number reads per reader combination. row specifies many reads (first column) particular pattern double reads (second Nreaders+1 columns). RecCv CV recruitment, shoudl noted recruitment assumed stationary time. RecAr1 First-order autoregressive coefficient recruitment Amax True maximum age","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/SimulatorFn.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Simulate double reading data — SimulatorFn","text":"Returns simulated double read matrix","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/SimulatorFn.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Simulate double reading data — SimulatorFn","text":"Punt, .E., Smith, D.C., KrusicGolub, K., Robertson, S. 2008. Quantifying age-reading error use fisheries stock assessments, application species Australias southern eastern scalefish shark fishery. Can. J. Fish. Aquat. Sci. 65: 1991-2005.","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/SimulatorFn.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Simulate double reading data — SimulatorFn","text":"James T. Thorson","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/SimulatorFn.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Simulate double reading data — SimulatorFn","text":"","code":"# Parameters for generating data # This represents 2 unique readers # Row 1 -- Otoliths read only once by reader # Row 2 -- Otoliths read twice by reader 1 # Row 2 -- Otoliths read only once by reader 2 # Row 4 -- Otoliths read twice by reader 2 # Row 5 -- Otoliths read once by reader 1 and once by reader 2 ReadsMat <- structure(matrix(nrow = 5, ncol = 5, c(rep(25, 5), 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0) ), dimnames = list( c(\"Reader1_Only\", \"Reader1_DoubleReads\", \"Reader2_Only\", \"Reader2_DoubleReads\", \"Reader1_&_Reader2\" ), c(\"NumberOfReads\", \"Reader1\", \"Reader1_DoubleReads\", \"Reader2\", \"Reader2_DoubleReads\" )) ) # Generate data set.seed(2) AgeReads <- SimulatorFn(Nreaders = 4, M = 0.2, SelexForm = \"Logistic\", SelexParams = c(5, 0.2), BiasParams = c(1, 1, 1.1, 1.1), ErrorParams = c(0.2, 0.2, 0.2, 0.2), ReadsMat = ReadsMat, RecCv = 0.6, RecAr1 = 0.8, Amax = 100)"},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/StepwiseFn.html","id":null,"dir":"Reference","previous_headings":"","what":"Step-wise model selection — StepwiseFn","title":"Step-wise model selection — StepwiseFn","text":"Run step-wise model selection facilitate exploration several modelling configurations using Akaike information criterion (AIC).","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/StepwiseFn.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Step-wise model selection — StepwiseFn","text":"","code":"StepwiseFn( SearchMat, Data, NDataSets, KnotAges, MinAge, MaxAge, RefAge, MaxSd, MaxExpectedAge, SaveFile, EffSampleSize = 0, Intern = TRUE, InformationCriterion = c(\"AIC\", \"AICc\", \"BIC\"), SelectAges = TRUE )"},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/StepwiseFn.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Step-wise model selection — StepwiseFn","text":"SearchMat matrix explaining stepwise model selection options. One row readers error one row readers bias + 2 rows, one MinusAge, .e., age proportion age begins decrease exponentially decreasing age, one PlusAge, .e., age proportion--age begins decrease exponentially increasing age. element given row possible value search across reader. , number columns SearchMat maximum number options want include. Think several vectors stacked row-wise shorter rows filled NA values. reader two two options analyst wants search remainder columns filled NA values row. Data data set first column integer providing number otoliths included row subsequent columns reader lab estimated ag,e reader/lab unique reading error bias. modeling framework allows , , 15 readers, .e., 16 columns. identical rows data frame otoliths exact read every reader/lab combined single row count first column. failed combine identical rows prior running model, alerted error XXX.rep file properly formatted data can ' cut-pasted XXX.dat file use. Missing reads given reader/lab entered -999. Order reader/lab columns similar readers/labs located next one another columns right can mirror columns immediate left terms parameter estimates. NDataSets generally 1 values implemented. KnotAges Ages associated knot. necessary input SigOpt = 5 SigOpt = 6. MinAge integer, specifying minimum possible \"true\" age. MaxAge integer, specifying maximum possible \"true\" age. RefAge arbitrarily chosen age \"true\" age-composition fixed-effects calculated offset. effect answer potentially effect estimation speed. MaxSd upper bound possible values standard deviation reading error. MaxExpectedAge Set MaxAge. SaveFile Directory agemat.exe located ADMB intermediate output files located. AdmbFile specified agemat.exe copied directory SaveFile. EffSampleSize Indicating whether effective sample size calculated. Missing values data matrix cause ineffective, case set 0. Intern logical input controls amount output displayed, TRUE indicates ADMB output displayed R FALSE leads suppression information. InformationCriterion string specifying type information criterion used choose best model. default use AIC, though AIC corrected small sample sizes BIC also available. SelectAges logical input specifying boundaries based MinusAge PlusAge. default TRUE.","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/StepwiseFn.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Step-wise model selection — StepwiseFn","text":"AIC seems like appropriate method select among possible values PlusAge, .e., last row SearchMat, PlusAge determines number estimated fixed-effect hyperparameters used define true proportion--age hyperdistribution. hyperdistribution turn used prior integrating across true age associated otolith. true age, latent effect, can interpreted random effect one observation. , use AIC select among parameterizations fixed effects defining hyperdistribution customary (Pinheiro Bates, 2009). tested sablefish, AIC lead true proportion age biologically plausible.","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/StepwiseFn.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Step-wise model selection — StepwiseFn","text":"Punt, .E., Smith, D.C., KrusicGolub, K., Robertson, S. 2008. Quantifying age-reading error use fisheries stock assessments, application species Australia's southern eastern scalefish shark fishery. Can. J. Fish. Aquat. Sci. 65: 1991-2005. Pinheiro, J.C., Bates, D. 2009. Mixed-Effects Models S S-PLUS. Springer, Germany.","code":""},{"path":[]},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/StepwiseFn.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Step-wise model selection — StepwiseFn","text":"James T. Thorson","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/StepwiseFn.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Step-wise model selection — StepwiseFn","text":"","code":"example(RunFn) #> #> RunFn> example(SimulatorFn) #> #> SmltrF> # Parameters for generating data #> SmltrF> # This represents 2 unique readers #> SmltrF> # Row 1 -- Otoliths read only once by reader #> SmltrF> # Row 2 -- Otoliths read twice by reader 1 #> SmltrF> # Row 2 -- Otoliths read only once by reader 2 #> SmltrF> # Row 4 -- Otoliths read twice by reader 2 #> SmltrF> # Row 5 -- Otoliths read once by reader 1 and once by reader 2 #> SmltrF> ReadsMat <- structure(matrix(nrow = 5, ncol = 5, #> SmltrF+ c(rep(25, 5), #> SmltrF+ 1, 1, 0, 0, 1, #> SmltrF+ 0, 1, 0, 0, 0, #> SmltrF+ 0, 0, 1, 1, 1, #> SmltrF+ 0, 0, 0, 1, 0) #> SmltrF+ ), dimnames = list( #> SmltrF+ c(\"Reader1_Only\", \"Reader1_DoubleReads\", #> SmltrF+ \"Reader2_Only\", \"Reader2_DoubleReads\", #> SmltrF+ \"Reader1_&_Reader2\" #> SmltrF+ ), #> SmltrF+ c(\"NumberOfReads\", #> SmltrF+ \"Reader1\", \"Reader1_DoubleReads\", #> SmltrF+ \"Reader2\", \"Reader2_DoubleReads\" #> SmltrF+ )) #> SmltrF+ ) #> #> SmltrF> # Generate data #> SmltrF> set.seed(2) #> #> SmltrF> AgeReads <- SimulatorFn(Nreaders = 4, M = 0.2, #> SmltrF+ SelexForm = \"Logistic\", #> SmltrF+ SelexParams = c(5, 0.2), BiasParams = c(1, 1, 1.1, 1.1), #> SmltrF+ ErrorParams = c(0.2, 0.2, 0.2, 0.2), ReadsMat = ReadsMat, #> SmltrF+ RecCv = 0.6, RecAr1 = 0.8, Amax = 100) #> #> RunFn> ## Not run: #> RunFn> ##D utils::write.csv(AgeReads, #> RunFn> ##D file = file.path(getwd(), \"Simulated_data_example.csv\")) #> RunFn> ## End(Not run) #> RunFn> #> RunFn> ##### Format data #> RunFn> Nreaders <- ncol(AgeReads) #> #> RunFn> # Change NA to -999 (which the Punt software considers missing data) #> RunFn> AgeReads <- ifelse(is.na(AgeReads), -999, AgeReads) #> #> RunFn> # Potentially eliminate rows that are only read once #> RunFn> # These rows have no information about reading error, but are potentially #> RunFn> # informative about latent age-structure. It is unknown whether eliminating #> RunFn> # these rows degrades estimation of error and bias, and is currently #> RunFn> # recommended to speed up computation #> RunFn> if (FALSE) { #> RunFn+ KeepRow <- ifelse( #> RunFn+ rowSums(ifelse(AgeReads == -999, 0, 1), na.rm = TRUE) <= 1, #> RunFn+ FALSE, TRUE #> RunFn+ ) #> RunFn+ AgeReads <- AgeReads[KeepRow, ] #> RunFn+ } #> #> RunFn> # AgeReads2 is the correctly formatted data object #> RunFn> AgeReads2 <- rMx(c(1, AgeReads[1, ])) #> #> RunFn> # Combine duplicate rows #> RunFn> for (RowI in 2:nrow(AgeReads)) { #> RunFn+ DupRow <- NA #> RunFn+ for (PreviousRowJ in 1:nrow(AgeReads2)) { #> RunFn+ if (all( #> RunFn+ AgeReads[RowI,1:Nreaders] == AgeReads2[PreviousRowJ,1:Nreaders+1] #> RunFn+ )) { #> RunFn+ DupRow <- PreviousRowJ #> RunFn+ } #> RunFn+ } #> RunFn+ if (is.na(DupRow)) {# Add new row to AgeReads2 #> RunFn+ AgeReads2 <- rbind(AgeReads2, c(1, AgeReads[RowI, ])) #> RunFn+ } #> RunFn+ if(!is.na(DupRow)){# Increment number of samples for previous duplicate #> RunFn+ AgeReads2[DupRow,1] <- AgeReads2[DupRow,1] + 1 #> RunFn+ } #> RunFn+ } #> #> RunFn> ######## Determine settings for ADMB #> RunFn> # Define minimum and maximum ages for integral across unobserved ages #> RunFn> MinAge <- 1 #> #> RunFn> MaxAge <- ceiling(max(AgeReads2[,-1])/10)*10 #> #> RunFn> BiasOpt <- c(0, -1, 0, -3) #> #> RunFn> SigOpt <- c(1, -1, 6, -3) #> #> RunFn> # Necessary for SigOpt option 5 or 6 #> RunFn> KnotAges <- list(NA, NA, c(1, 10, 20, MaxAge), NA) #> #> RunFn> ##### Run the model (MAY TAKE 5-10 MINUTES) #> RunFn> ## Not run: #> RunFn> ##D fileloc <- file.path(tempdir(), \"age\") #> RunFn> ##D dir.create(fileloc, showWarnings = FALSE) #> RunFn> ##D RunFn(Data = AgeReads2, SigOpt = SigOpt, KnotAges = KnotAges, #> RunFn> ##D BiasOpt = BiasOpt, #> RunFn> ##D NDataSets = 1, MinAge = MinAge, MaxAge = MaxAge, RefAge = 10, #> RunFn> ##D MinusAge = 1, PlusAge = 30, SaveFile = fileloc, #> RunFn> ##D AdmbFile = file.path(system.file(\"executables\", #> RunFn> ##D package = \"nwfscAgeingError\"), .Platform$file.sep), #> RunFn> ##D EffSampleSize = 0, Intern = FALSE, JustWrite = FALSE, CallType = \"shell\" #> RunFn> ##D ) #> RunFn> ## End(Not run) #> RunFn> #> RunFn> #> RunFn> if (FALSE) { ##### Run the model (MAY TAKE 5-10 MINUTES) fileloc <- file.path(tempdir(), \"age\") dir.create(fileloc, showWarnings = FALSE) RunFn(Data = AgeReads2, SigOpt = SigOpt, KnotAges = KnotAges, BiasOpt = BiasOpt, NDataSets = 1, MinAge = MinAge, MaxAge = MaxAge, RefAge = 10, MinusAge = 1, PlusAge = 30, SaveFile = fileloc, AdmbFile = file.path(system.file(\"executables\", package = \"nwfscAgeingError\"), .Platform$file.sep), EffSampleSize = 0, Intern = FALSE, JustWrite = FALSE, CallType = \"shell\" ) # Plot output PlotOutputFn(Data = AgeReads2, MaxAge = MaxAge, SaveFile = fileloc, PlotType = \"PDF\" ) } ##### Stepwise selection # Parameters MaxAge <- ceiling(max(AgeReads2) / 10) * 10 MinAge <- 1 ##### Stepwise selection StartMinusAge <- 1 StartPlusAge <- 30 # Define matrix explaining stepwise model selection options # One row for each reader + 2 rows for # PlusAge (age where the proportion-at-age begins to # decrease exponentially with increasing age) and # MinusAge (the age where the proportion-at-age begins to # decrease exponentially with decreasing age) # Each element of a given row is a possible value to search # across for that reader SearchMat <- array(NA, dim = c(Nreaders * 2 + 2, 7), dimnames = list(c(paste(\"Error_Reader\", 1:Nreaders), paste(\"Bias_Reader\", 1:Nreaders), \"MinusAge\", \"PlusAge\"), paste(\"Option\", 1:7)) ) # Readers 1 and 3 search across options 1-3 for ERROR SearchMat[c(1, 3), 1:3] <- rep(1, 2) %o% c(1, 2, 3) # Reader 2 mirrors reader 1 SearchMat[2, 1] <- -1 # Reader 4 mirrors reader 3 SearchMat[4, 1] <- -3 # Reader 1 has no BIAS SearchMat[5, 1] <- 0 # Reader 2 mirrors reader 1 SearchMat[6, 1] <- -1 # Reader 3 search across options 0-2 for BIAS SearchMat[7, 1:3] <- c(1, 2, 0) # Reader 4 mirrors reader 3 SearchMat[8, 1] <- -3 # MinusAge searches with a search kernal of -10,-4,-1,+0,+1,+4,+10 SearchMat[9, 1:7] <- c( StartMinusAge, StartMinusAge - 10, StartMinusAge - 4, StartMinusAge - 1, StartMinusAge + 1, StartMinusAge + 4, StartMinusAge + 10 ) SearchMat[9, 1:7] <- ifelse(SearchMat[9,1:7] < MinAge, NA, SearchMat[9, 1:7] ) # PlusAge searches with a search kernal of -10,-4,-1,+0,+1,+4,+10 SearchMat[10, 1:7] <- c( StartPlusAge, StartPlusAge - 10, StartPlusAge - 4, StartPlusAge - 1, StartPlusAge + 1, StartPlusAge + 4, StartPlusAge + 10 ) SearchMat[10,1:7] <- ifelse(SearchMat[10, 1:7] > MaxAge, NA, SearchMat[10, 1:7]) # Run model selection # This outputs a series of files # 1. \"Stepwise - Model loop X.txt\" -- # Shows the AIC/BIC/AICc value for all different combinations # of parameters arising from changing one parameter at a time # according to SearchMat during loop X # 2. \"Stepwise - Record.txt\" -- # The Xth row of IcRecord shows the record of the # Information Criterion for all trials in loop X, # while the Xth row of StateRecord shows the current selected values # for all parameters at the end of loop X # 3. Standard plots for each loop # WARNING: One run of this stepwise model building example can take # 8+ hours, and should be run overnight if (FALSE) { StepwiseFn(SearchMat = SearchMat, Data = AgeReads2, NDataSets = 1, MinAge = MinAge, MaxAge = MaxAge, RefAge = 10, MaxSd = 40, MaxExpectedAge = MaxAge + 10, SaveFile = fileloc, InformationCriterion = c(\"AIC\", \"AICc\", \"BIC\")[3] ) }"},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/ageing_comparison.html","id":null,"dir":"Reference","previous_headings":"","what":"Plot comparison of double age readings — ageing_comparison","title":"Plot comparison of double age readings — ageing_comparison","text":"Plot circles proportional many double readings fell pair coordinates","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/ageing_comparison.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Plot comparison of double age readings — ageing_comparison","text":"","code":"ageing_comparison( xvec, yvec, scale.pts = 2, col.pts = grDevices::grey(0.1, alpha = 0.5), col.hist = grDevices::rgb(0, 0, 0.5, alpha = 0.7), counts = TRUE, maxage = NULL, hist = TRUE, hist.frac = 0.1, xlab = \"Age reader A\", ylab = \"Age reader B\", title = NULL, png = FALSE, filename = \"ageing_comparison.png\", SaveFile = NULL, verbose = TRUE )"},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/ageing_comparison.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Plot comparison of double age readings — ageing_comparison","text":"xvec vector values reader yvec vector values reader B scale.pts Documentation needed. col.pts color points col.hist color histograms counts include text within bubble showing count values? maxage maximum age include plot (yet work well) hist include histogram along axis? hist.frac maximum value histograms fraction maxage xlab label xvec ylab label yvec title Optional title add top plot png Save plot PNG file? filename File name PNG file. SaveFile directory plot saved. NULL value make go working directory. verbose Report messages function runs.","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/ageing_comparison.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Plot comparison of double age readings — ageing_comparison","text":"Ian G. Taylor","code":""},{"path":[]},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/cMx.html","id":"the-function-is-currently-defined-as","dir":"Reference","previous_headings":"","what":"The function is currently defined as","title":"Make a column matrix — cMx","text":"function (Input) .matrix(Input)","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/cMx.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Make a column matrix — cMx","text":"","code":"cMx(Input)"},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/cMx.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Make a column matrix — cMx","text":"Input input converted matrix","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/cMx.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Make a column matrix — cMx","text":"James T. Thorson","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/determine_n_sets.html","id":null,"dir":"Reference","previous_headings":"","what":"Determine the number of data sets in a data file — determine_n_sets","title":"Determine the number of data sets in a data file — determine_n_sets","text":"Determine number data sets data file","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/determine_n_sets.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Determine the number of data sets in a data file — determine_n_sets","text":"","code":"determine_n_sets(file)"},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/determine_n_sets.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Determine the number of data sets in a data file — determine_n_sets","text":"file file path data file.","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/determine_n_sets.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Determine the number of data sets in a data file — determine_n_sets","text":"integer giving number data sets file.","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/determine_n_sets.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Determine the number of data sets in a data file — determine_n_sets","text":"Kelli F. Johnson","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/estgrowth.vb.html","id":null,"dir":"Reference","previous_headings":"","what":"Calculate von Bertanlaffy Growth Parameters from Lengths and Ages — estgrowth.vb","title":"Calculate von Bertanlaffy Growth Parameters from Lengths and Ages — estgrowth.vb","text":"Calculate von Bertanlaffy growth parameters length age data predicted lengths given ages input parameters.","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/estgrowth.vb.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Calculate von Bertanlaffy Growth Parameters from Lengths and Ages — estgrowth.vb","text":"","code":"estgrowth.vb(Par, Ages, Lengths, ReturnType = c(\"NLL\", \"Pred\"), sdFactor = 1)"},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/estgrowth.vb.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Calculate von Bertanlaffy Growth Parameters from Lengths and Ages — estgrowth.vb","text":"Par list von Bertanlaffy growth parameters log space ordered follows: K, Linf, L0, CV0, CV1. Names assigned provided. Ages vector ages years. Values NA accepted. Lengths vector Lengths cm. Lengths can NULL ReturnType == \"Pred\" predicting using ages, lengths just needed estimation purpopses. NULL, ensure one length measurement every age measurement. Values NA accepted. ReturnType single character value \"NLL\" default, leads negative log-likelihood value returned. \"Pred\", three values returned combination length age, low, prediction, high based input parameters standard deviation factor, .e., sdFactor. sdFactor number standard deviations include low high calculations. default 1.0.","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/estgrowth.vb.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Calculate von Bertanlaffy Growth Parameters from Lengths and Ages — estgrowth.vb","text":"Depending ReturnType, either negative log likelihood returned based fits data matrix three columns low, predicted, high values combination length age. Distance low high predicted value depends sdFactor, allowing confidence intervals based normal theory theories created.","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/estgrowth.vb.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Calculate von Bertanlaffy Growth Parameters from Lengths and Ages — estgrowth.vb","text":"","code":"if (FALSE) { bio_dat <- data.frame(Age = rep(0:30, each = 20), Length_cm = rnorm(n = 31 * 20, mean = 50, sd = 5)) pars_in <- lapply(FUN = log, X = list( \"K\" = 0.13, \"Linf\" = 55, \"L0\" = 5, \"CV0\" = 0.1, \"CV1\" = 0.1)) solve <- optim(fn = estgrowth.vb, par = unlist(pars_in), hessian = FALSE, Ages = bio_dat[, \"Age\"], Lengths = bio_dat[, \"Length_cm\"]) predictions <- estgrowth.vb(Par = solve$par, ReturnType = \"Pred\", sdFactor = 1, Ages = bio_dat[, \"Age\"], Lengths = bio_dat[, \"Length_cm\"]) plot(bio_dat$Age, predictions[, \"Lhat_pred\"], xlab = \"Age (years)\", ylab = \"Predicted length (cm)\") exp(solve$par) }"},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/fit.html","id":null,"dir":"Reference","previous_headings":"","what":"Fit an ageing error model using TMB — fit","title":"Fit an ageing error model using TMB — fit","text":"Fit ageing error model using TMB","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/fit.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Fit an ageing error model using TMB — fit","text":"","code":"fit()"},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/fit.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Fit an ageing error model using TMB — fit","text":"Kelli F. Johnson","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/minimizer.html","id":null,"dir":"Reference","previous_headings":"","what":"Minimize the negative log likelihood — minimizer","title":"Minimize the negative log likelihood — minimizer","text":"Minimize negative log likelihood using \"nlmimb\" /\"optim\".","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/minimizer.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Minimize the negative log likelihood — minimizer","text":"","code":"minimizer( model, method = c(\"optim\", \"nlmimb\", \"both\"), lower, upper, verbose = FALSE )"},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/minimizer.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Minimize the negative log likelihood — minimizer","text":"model model optimized. method string specifying desired method used optimization routine. options listed function call, default use \"optim\". Using routines option, via \"\", lead first optimizing model using \"nlminb\" re-optimization model \"optim\". Note using stats::optim(), \"L-BFGS-B\" method used rather default method \"Nelder-Mead\". lower, upper Vectors parameter bounds length number parameters model. verbose logical specifying messages printed. default print, .e., verbose = FALSE.","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/minimizer.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Minimize the negative log likelihood — minimizer","text":"Andre E. Punt","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/plot_output.html","id":null,"dir":"Reference","previous_headings":"","what":"Plot output — plot_output","title":"Plot output — plot_output","text":"Plots age comparisons results fitted Ageing Error model","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/plot_output.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Plot output — plot_output","text":"","code":"plot_output( Data, IDataSet, MaxAge, Report, subplot = 1:3, Nparameters = 0, LogLike = 0, ReaderNames = NULL, Species = \"AgeingError\", SaveDir = getwd(), verbose = FALSE, ... )"},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/plot_output.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Plot output — plot_output","text":"Data Input data matrix IDataSet Index data set used creating filename MaxAge Maximum estimated age Report Results fitting model subplot Vector plots create. Nparameters Number parameters LogLike Negative log likelihood fitting model ReaderNames Vector names reader, defaults 'Reader1', 'Reader2', etc. left default argument NULL. pass vector strings, vector must length NCOL(Data) - 1. Species String used beginning output files SaveDir Directory fitted model verbose Report messages function runs. ... Additional arguments passed ageing_comparison().","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/plot_output.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Plot output — plot_output","text":"Returns AIC, AICc, BIC fitted model.","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/plot_output.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Plot output — plot_output","text":"Punt, .E., Smith, D.C., KrusicGolub, K., Robertson, S. 2008. Quantifying age-reading error use fisheries stock assessments, application species Australias southern eastern scalefish shark fishery. Can. J. Fish. Aquat. Sci. 65: 1991-2005.","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/plot_output.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Plot output — plot_output","text":"James T. Thorson, Ian G. Taylor","code":""},{"path":[]},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/rMx.html","id":"the-function-is-currently-defined-as","dir":"Reference","previous_headings":"","what":"The function is currently defined as","title":"Make a row matrix — rMx","text":"function (Input) (.vector(Input)) Output <- t(.matrix(Input))(!.vector(Input)) Output <- .matrix(Input)Output","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/rMx.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Make a row matrix — rMx","text":"","code":"rMx(Input)"},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/rMx.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Make a row matrix — rMx","text":"Input input converted row matrix","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/rMx.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Make a row matrix — rMx","text":"James T. Thorson","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/run.html","id":null,"dir":"Reference","previous_headings":"","what":"Run ageing error routine — run","title":"Run ageing error routine — run","text":"wrapper running TMB model estimate ageing error given data set specification file.","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/run.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Run ageing error routine — run","text":"","code":"run(file_data, file_specs, directory)"},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/run.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Run ageing error routine — run","text":"file_data string specifying file path data file. file_specs string specifying file path specifications file. directory string specifying file path directory like save results.","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/run.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Run ageing error routine — run","text":"Invisibly return model output.","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/reference/run.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Run ageing error routine — run","text":"Kelli F. Johnson","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/news/index.html","id":"ageingerror-202","dir":"Changelog","previous_headings":"","what":"AgeingError 2.0.2","title":"AgeingError 2.0.2","text":"Switched new TMB version package main branch Renamed github repository nwfscAgeingError AgeingError Adding vignette documenting TMB version Paul Burch Cleared , , files associated ADMB version","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/news/index.html","id":"ageingerror-200","dir":"Changelog","previous_headings":"","what":"AgeingError 2.0.0","title":"AgeingError 2.0.0","text":"Changed package name AgeingError Added TMB code pre-compiled package Added run() wrapper code provided @puntae Increased number examples present package","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/news/index.html","id":"nwfscageingerror-133","dir":"Changelog","previous_headings":"","what":"nwfscAgeingError 1.3.3","title":"nwfscAgeingError 1.3.3","text":"Added NEWS.md file track changes package. Included TMB agemat2.cpp source code . E. Punt","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/news/index.html","id":"nwfscageingerror-132","dir":"Changelog","previous_headings":"","what":"nwfscAgeingError 1.3.2","title":"nwfscAgeingError 1.3.2","text":"version contains updates . E. Punt work CSIRO.","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/news/index.html","id":"nwfscageingerror-131","dir":"Changelog","previous_headings":"","what":"nwfscAgeingError 1.3.1","title":"nwfscAgeingError 1.3.1","text":"Archive 16th November 2021.","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/news/index.html","id":"nwfscageingerror-101","dir":"Changelog","previous_headings":"","what":"nwfscAgeingError 1.0.1","title":"nwfscAgeingError 1.0.1","text":"version used 2017 assessment cycle.","code":""},{"path":"http://pfmc-assessments.github.io/nwfscAgeingError/news/index.html","id":"nwfscageingerror-100","dir":"Changelog","previous_headings":"","what":"nwfscAgeingError 1.0.0","title":"nwfscAgeingError 1.0.0","text":"version used 2013 assessment cycle. Though repository tagged 2015. Melissa Haltuch noted 2014 code updated summary updates provided . Splines, requires new argument defining knots. Linear interpolation knots, requires new argument defines knots. Changes calculation best true age previous way led strange plots. Improvement effective sample size calculation. Read one data set missing entries, double reads. 2011-based code allowed reading multiple data sets. Increased estimation speed missing values treated. Includes code simulate data. Includes function format input data csv readers columns double reads rows. Plot standardized outputs output file. figures still use development. Ability step multiple runs catalog output using new StepwiseFn() function.","code":""}]