diff --git a/articles/fims-demo.html b/articles/fims-demo.html index 3713e6fd3..529de0597 100644 --- a/articles/fims-demo.html +++ b/articles/fims-demo.html @@ -246,7 +246,7 @@

Fleet Data
 show(Index)
-
## C++ class 'Index' <0x55687bb954a0>
+
## C++ class 'Index' <0x560c5ba8e000>
 ## Constructors:
 ##     Index(int)
 ## 
@@ -258,7 +258,7 @@ 

Fleet Data##

 show(AgeComp)
-
## C++ class 'AgeComp' <0x55687bb95340>
+
## C++ class 'AgeComp' <0x560c5ba8dea0>
 ## Constructors:
 ##     AgeComp(int, int)
 ## 
@@ -298,7 +298,7 @@ 

Fleet Selectivity
 methods::show(LogisticSelectivity)
-
## C++ class 'LogisticSelectivity' <0x55687c546a60>
+
## C++ class 'LogisticSelectivity' <0x560c5bd3f210>
 ## Constructors:
 ##     LogisticSelectivity()
 ## 
@@ -328,7 +328,7 @@ 

Creating the Fleet Object
 show(Fleet)
-
## C++ class 'Fleet' <0x55687bb951e0>
+
## C++ class 'Fleet' <0x560c5ba8dd40>
 ## Constructors:
 ##     Fleet()
 ## 
@@ -388,7 +388,7 @@ 

Creating the Fleet Objectfishing_fleet$log_q <- log(1.0) fishing_fleet$estimate_q <- FALSE fishing_fleet$random_q <- FALSE -fishing_fleet$log_obs_error <- rep(log(sqrt(log(0.01^2 + 1))),nyears) +fishing_fleet$log_obs_error <- rep(log(sqrt(log(0.01^2 + 1))), nyears) fishing_fleet$estimate_obs_error <- FALSE # Next two lines not currently used by FIMS fishing_fleet$SetAgeCompLikelihood(1) @@ -443,7 +443,7 @@

Creating the Survey Objectsurvey_fleet$estimate_q <- TRUE survey_fleet$random_q <- FALSE # sd = sqrt(log(cv^2 + 1)), sd is log transformed -survey_fleet$log_obs_error <- rep(log(sqrt(log(0.2^2 + 1))),nyears) +survey_fleet$log_obs_error <- rep(log(sqrt(log(0.2^2 + 1))), nyears) survey_fleet$estimate_obs_error <- FALSE survey_fleet$SetAgeCompLikelihood(1) survey_fleet$SetIndexLikelihood(1) @@ -470,7 +470,7 @@

Recruitment# Recruitment recruitment <- methods::new(BevertonHoltRecruitment) methods::show(BevertonHoltRecruitment)

-
## C++ class 'BevertonHoltRecruitment' <0x55687bb95080>
+
## C++ class 'BevertonHoltRecruitment' <0x560c5ba8dbe0>
 ## Constructors:
 ##     BevertonHoltRecruitment()
 ## 
@@ -506,13 +506,13 @@ 

Recruitment
 recruitment$estimate_log_devs <- FALSE
 recruitment$log_devs <- c(
-  0.08904850,  0.43787763, -0.13299042, -0.43251973,
-  0.64861200,  0.50640852, -0.06958319,  0.30246260,
-  -0.08257384,  0.20740372,  0.15289604, -0.21709207,       
-  -0.13320626,  0.11225374, -0.10650836,  0.26877132,
-  0.24094126, -0.54480751, -0.23680557, -0.58483386,  
-  0.30122785,  0.21930545, -0.22281699, -0.51358369,       
-  0.15740234, -0.53988240, -0.19556523,  0.20094360,  
+  0.08904850, 0.43787763, -0.13299042, -0.43251973,
+  0.64861200, 0.50640852, -0.06958319, 0.30246260,
+  -0.08257384, 0.20740372, 0.15289604, -0.21709207,
+  -0.13320626, 0.11225374, -0.10650836, 0.26877132,
+  0.24094126, -0.54480751, -0.23680557, -0.58483386,
+  0.30122785, 0.21930545, -0.22281699, -0.51358369,
+  0.15740234, -0.53988240, -0.19556523, 0.20094360,
   0.37248740, -0.07163145
 )
diff --git a/pkgdown.yml b/pkgdown.yml index d46779420..9bdda527e 100644 --- a/pkgdown.yml +++ b/pkgdown.yml @@ -4,7 +4,7 @@ pkgdown_sha: ~ articles: fims-demo: fims-demo.html fims-path-maturity: fims-path-maturity.html -last_built: 2023-12-14T17:14Z +last_built: 2023-12-14T17:44Z urls: reference: https://NOAA-FIMS.github.io/FIMS/reference article: https://NOAA-FIMS.github.io/FIMS/articles diff --git a/search.json b/search.json index b4c044698..52f62f22c 100644 --- a/search.json +++ b/search.json @@ -1 +1 @@ -[{"path":"https://NOAA-FIMS.github.io/FIMS/CONTRIBUTING.html","id":null,"dir":"","previous_headings":"","what":"Contributing to the NOAA Fisheries Integrated Modeling System","title":"Contributing to the NOAA Fisheries Integrated Modeling System","text":"comprehensive set guidelines contributing NOAA’s Fisheries Integrated Modeling System can found NMFS Fish Tools Organization GitHub. mostly guidelines, rules. Use best judgment, feel free propose changes document pull request collaborative workflow document.","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/CONTRIBUTING.html","id":"code-of-conduct","dir":"","previous_headings":"","what":"Code of Conduct","title":"Contributing to the NOAA Fisheries Integrated Modeling System","text":"project everyone participating governed Code Conduct. participating, expected uphold code. Please report unacceptable behavior fims.conduct@noaa.gov.","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/CONTRIBUTING.html","id":"i-dont-want-to-read-this-whole-thing-i-just-have-a-question","dir":"","previous_headings":"","what":"I don’t want to read this whole thing I just have a question!!!","title":"Contributing to the NOAA Fisheries Integrated Modeling System","text":"Note: Please don’t file issue ask question. ’ll get faster results using resources . Please email FIMS maintainer christine.stawitz@noaa.gov question.","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/CONTRIBUTING.html","id":"i-want-to-file-a-bug-or-feature-request","dir":"","previous_headings":"","what":"I want to file a bug or feature request","title":"Contributing to the NOAA Fisheries Integrated Modeling System","text":"Please use issue templates submit Bug Report, Feature Request, Refactor.","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/CONTRIBUTING.html","id":"how-can-i-contribute","dir":"","previous_headings":"","what":"How can I contribute?","title":"Contributing to the NOAA Fisheries Integrated Modeling System","text":"contributions code! Writing documentation, teaching, activities also key parts contributing software, guidelines covered collaborative workflow book. information open source contributions, see Open Source Guide’s Contribute page.","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/articles/fims-demo.html","id":"fisheries-integrated-modeling-system","dir":"Articles","previous_headings":"","what":"Fisheries Integrated Modeling System","title":"Introducing the Fisheries Integrated Modeling System (FIMS)","text":"NOAA Fisheries Integrated Modeling System (FIMS) new modeling framework fisheries modeling. FIMS software system designed architected support next-generation fisheries stock assessment, ecosystem, socioeconomic modeling. ’s important note FIMS model, rather framework creating models. framework made many modules come together create “best model” suites needs end-user. follows demo creating catch--age assessment model using FIMS.","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/articles/fims-demo.html","id":"creating-models-in-fims","dir":"Articles","previous_headings":"","what":"Creating Models in FIMS","title":"Introducing the Fisheries Integrated Modeling System (FIMS)","text":"begin, import FIMS TMB libraries. Calling library(FIMS) automatically loads Rcpp functions modules R environment. function call, clear(), ensures C++ memory previous fims model run cleared .","code":"# automatically loads fims Rcpp module library(FIMS) library(TMB) # clear memory clear()"},{"path":"https://NOAA-FIMS.github.io/FIMS/articles/fims-demo.html","id":"setting-up-data","dir":"Articles","previous_headings":"","what":"Setting up Data","title":"Introducing the Fisheries Integrated Modeling System (FIMS)","text":"Data variable values taken Li et. al. Model Comparison project (github site). See R/data_mile1.R tests/testthat/test-fims-estimation.R details data variable values read FIMS Model Comparison project. First let’s set dimensions model based Model Comparison project:","code":"nyears <- 30 # the number of years which we have data for. nseasons <- 1 # the number of seasons in each year. FIMS currently defaults to 1 ages <- c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12) # age vector. nages <- 12 # the number of age groups."},{"path":"https://NOAA-FIMS.github.io/FIMS/articles/fims-demo.html","id":"preparing-data-using-fimsframe","dir":"Articles","previous_headings":"Setting up Data","what":"Preparing Data using FIMSFrame","title":"Introducing the Fisheries Integrated Modeling System (FIMS)","text":"reading data model using FIMSFrame FIMSFrameAge S4 R classes set R/fimsframe.R fims_frame object contains @data slot holds long data frame catch data fishery index data survey: Using data frame, start setting FIMS data objects. example Model Comparison project sets single fishery fleet age composition catch data single survey age composition data index. Data read FIMS long vectors, regardless original dimension, hence motivation behind long data frames created fimsframe S4 classes.","code":"# use FIMS data frame data(package = \"FIMS\") fims_frame <- FIMSFrame(data_mile1) str(fims_frame) ## Formal class 'FIMSFrame' [package \"FIMS\"] with 5 slots ## ..@ data :'data.frame': 1140 obs. of 8 variables: ## .. ..$ type : chr [1:1140] \"landings\" \"landings\" \"landings\" \"landings\" ... ## .. ..$ name : chr [1:1140] \"fleet1\" \"fleet1\" \"fleet1\" \"fleet1\" ... ## .. ..$ age : int [1:1140] NA NA NA NA NA NA NA NA NA NA ... ## .. ..$ datestart : chr [1:1140] \"0001-01-01\" \"0002-01-01\" \"0003-01-01\" \"0004-01-01\" ... ## .. ..$ dateend : chr [1:1140] \"0001-12-31\" \"0002-12-31\" \"0003-12-31\" \"0004-12-31\" ... ## .. ..$ value : num [1:1140] 160 461 752 997 770 ... ## .. ..$ unit : chr [1:1140] \"mt\" \"mt\" \"mt\" \"mt\" ... ## .. ..$ uncertainty: num [1:1140] 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 ... ## ..@ fleets : num 1 ## ..@ nyrs : int 30 ## ..@ start_year: int 1 ## ..@ end_year : int 30 fims_frame@data %>% dplyr::filter(type == \"landings\") %>% head() ## type name age datestart dateend value unit uncertainty ## 1 landings fleet1 NA 0001-01-01 0001-12-31 160.2363 mt 0.01 ## 2 landings fleet1 NA 0002-01-01 0002-12-31 460.6336 mt 0.01 ## 3 landings fleet1 NA 0003-01-01 0003-12-31 752.1299 mt 0.01 ## 4 landings fleet1 NA 0004-01-01 0004-12-31 996.9872 mt 0.01 ## 5 landings fleet1 NA 0005-01-01 0005-12-31 769.6972 mt 0.01 ## 6 landings fleet1 NA 0006-01-01 0006-12-31 1352.7309 mt 0.01 fims_frame@data %>% dplyr::filter(type == \"index\") %>% head() ## type name age datestart dateend value unit uncertainty ## 1 index survey1 NA 0001-01-01 0001-01-01 0.006795379 0.2 ## 2 index survey1 NA 0002-01-01 0002-01-01 0.006170738 0.2 ## 3 index survey1 NA 0003-01-01 0003-01-01 0.005977854 0.2 ## 4 index survey1 NA 0004-01-01 0004-01-01 0.005907966 0.2 ## 5 index survey1 NA 0005-01-01 0005-01-01 0.007211237 0.2 ## 6 index survey1 NA 0006-01-01 0006-01-01 0.006867264 0.2 age_frame <- FIMS::FIMSFrameAge(data_mile1) # fishery data # This does the same thing as the one line below only # using fims_frame rather than age_frame # fishery_catch <- fims_frame@data %>% # dplyr::filter(type == \"landings\") %>% # .$value fishery_catch <- FIMS::m_landings(age_frame) # This does the same thing as the two lines below only # using fims_frame rather than age_frame # fishery_agecomp <- fims_frame@data %>% # dplyr::filter(type == \"age\") %>% # dplyr::filter(name == \"fleet1\") %>% # .$value fishery_agecomp <- FIMS::m_agecomp(age_frame, \"fleet1\") # survey data survey_index <- FIMS::m_index(age_frame, \"survey1\") # survey agecomp not set up in fimsframe yet survey_agecomp <- FIMS::m_agecomp(age_frame, \"survey1\")"},{"path":"https://NOAA-FIMS.github.io/FIMS/articles/fims-demo.html","id":"creating-modules-in-fims","dir":"Articles","previous_headings":"","what":"Creating Modules in FIMS","title":"Introducing the Fisheries Integrated Modeling System (FIMS)","text":"Now ’ve prepared data, let’s pass FIMS. module FIMS-R interface made S4 objects. S4 objects serve interface R underlining C++ code defines FIMS. Modules instantiated using methods::new() function. can use methods::show() view fields (.e. variables) methods (.e. functions) available given module.","code":""},{"path":[]},{"path":"https://NOAA-FIMS.github.io/FIMS/articles/fims-demo.html","id":"fleet-data","dir":"Articles","previous_headings":"Creating Modules in FIMS > The Fleet Module","what":"Fleet Data","title":"Introducing the Fisheries Integrated Modeling System (FIMS)","text":"fleet required data order evaluate objective function. Currently FIMS fleet module used set fleets surveys. FIMS contains Index module AgeComp module pass data objects fleet module. data modules require dimension added indicate dimensions raw data (e.g. nyears x nages matrix). Given information, FIMS able correctly apply dimension folding model output. Using methods::show() function, can see Index module vector field named index_data AgeComp module vector field names age_comp_data. ’ll create index age composition modules fleet using methods::new() function pass data defined Model Comparison project.","code":"show(Index) ## C++ class 'Index' <0x55687bb954a0> ## Constructors: ## Index(int) ## ## Fields: ## Rcpp::Vector<14, Rcpp::PreserveStorage> index_data ## ## Methods: ## unsigned int get_id() ## show(AgeComp) ## C++ class 'AgeComp' <0x55687bb95340> ## Constructors: ## AgeComp(int, int) ## ## Fields: ## Rcpp::Vector<14, Rcpp::PreserveStorage> age_comp_data ## ## Methods: ## unsigned int get_id() ## # fleet index data fishing_fleet_index <- methods::new(Index, nyears) # fleet age composition data fishing_fleet_age_comp <- methods::new(AgeComp, nyears, nages) fishing_fleet_index$index_data <- fishery_catch # Effective sampling size is 200 fishing_fleet_age_comp$age_comp_data <- fishery_agecomp * 200"},{"path":"https://NOAA-FIMS.github.io/FIMS/articles/fims-demo.html","id":"fleet-selectivity","dir":"Articles","previous_headings":"Creating Modules in FIMS > The Fleet Module","what":"Fleet Selectivity","title":"Introducing the Fisheries Integrated Modeling System (FIMS)","text":"Now ’ve passed data fishing fleet, need set selectivity module. set selectivity function using LogisticSelectivity module. Themethods::show() function indicates module two parameter fields: inflection_point slope, evaluate() get_id() function. variable Parameter class three additional fields: value, is_random_effect, estimated. Currently, FIMS set run random effects. default value field estimate field currently set FALSE. can use value field input variables defined Model Comparison project.","code":"methods::show(LogisticSelectivity) ## C++ class 'LogisticSelectivity' <0x55687c546a60> ## Constructors: ## LogisticSelectivity() ## ## Fields: ## Parameter inflection_point ## Parameter slope ## ## Methods: ## double evaluate(double) ## ## unsigned int get_id() ## fishing_fleet_selectivity <- methods::new(LogisticSelectivity) fishing_fleet_selectivity$inflection_point$value <- 2.0 fishing_fleet_selectivity$inflection_point$is_random_effect <- FALSE fishing_fleet_selectivity$inflection_point$estimated <- TRUE fishing_fleet_selectivity$slope$value <- 1.0 fishing_fleet_selectivity$slope$is_random_effect <- FALSE fishing_fleet_selectivity$slope$estimated <- TRUE"},{"path":"https://NOAA-FIMS.github.io/FIMS/articles/fims-demo.html","id":"creating-the-fleet-object","dir":"Articles","previous_headings":"Creating Modules in FIMS > The Fleet Module","what":"Creating the Fleet Object","title":"Introducing the Fisheries Integrated Modeling System (FIMS)","text":"Now ’ve created everything fleet needs, lets create actual fleet object. First let’s run methods::show(Fleet) see fields methods available R. can see five boolean flags: estimate_F, estimate_q, is_survey, random_F, random_q. two vectors, log_Fmort log_obs_error, double, log_q. two integer fields number ages years. Additionally, five Methods: SetAgeCompLikelihood, SetIndexLikelihood, SetObservedAgeCompData, SetObservedIndexData, setSelectivity. last three used link AgeComp, Index, Selectivity modules defined fleet module defined .","code":"show(Fleet) ## C++ class 'Fleet' <0x55687bb951e0> ## Constructors: ## Fleet() ## ## Fields: ## bool estimate_F ## bool estimate_obs_error ## bool estimate_q ## bool is_survey ## Rcpp::Vector<14, Rcpp::PreserveStorage> log_Fmort ## Rcpp::Vector<14, Rcpp::PreserveStorage> log_obs_error ## double log_q ## int nages ## int nyears ## bool random_F ## bool random_q ## ## Methods: ## void SetAgeCompLikelihood(int) ## ## void SetIndexLikelihood(int) ## ## void SetObservedAgeCompData(int) ## ## void SetObservedIndexData(int) ## ## void SetSelectivity(int) ## # Create fleet module fishing_fleet <- methods::new(Fleet) # Set nyears and nages fishing_fleet$nages <- nages fishing_fleet$nyears <- nyears # Set values for log_Fmort fishing_fleet$log_Fmort <- log(c( 0.009459165, 0.02728886, 0.04506364, 0.06101782, 0.04860075, 0.08742055, 0.0884472, 0.1866079, 0.109009, 0.1327043, 0.1506155, 0.161243, 0.1166402, 0.1693461, 0.1801919, 0.1612405, 0.3145732, 0.2572476, 0.2548873, 0.2514621, 0.3491014, 0.2541077, 0.4184781, 0.3457212, 0.3436855, 0.3141712, 0.3080268, 0.4317453, 0.3280309, 0.4996754 )) # Turn on estimation for F fishing_fleet$estimate_F <- TRUE fishing_fleet$random_F <- FALSE # Set value for log_q fishing_fleet$log_q <- log(1.0) fishing_fleet$estimate_q <- FALSE fishing_fleet$random_q <- FALSE fishing_fleet$log_obs_error <- rep(log(sqrt(log(0.01^2 + 1))),nyears) fishing_fleet$estimate_obs_error <- FALSE # Next two lines not currently used by FIMS fishing_fleet$SetAgeCompLikelihood(1) fishing_fleet$SetIndexLikelihood(1) # Set Index, AgeComp, and Selectivity using the IDs from the modules defined above fishing_fleet$SetObservedIndexData(fishing_fleet_index$get_id()) fishing_fleet$SetObservedAgeCompData(fishing_fleet_age_comp$get_id()) fishing_fleet$SetSelectivity(fishing_fleet_selectivity$get_id())"},{"path":"https://NOAA-FIMS.github.io/FIMS/articles/fims-demo.html","id":"the-survey-module","dir":"Articles","previous_headings":"Creating Modules in FIMS","what":"The Survey Module","title":"Introducing the Fisheries Integrated Modeling System (FIMS)","text":"now repeat steps Fleet set Survey. survey object essentially fleet object catchability (q) variable.","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/articles/fims-demo.html","id":"survey-data","dir":"Articles","previous_headings":"Creating Modules in FIMS > The Survey Module","what":"Survey Data","title":"Introducing the Fisheries Integrated Modeling System (FIMS)","text":"","code":"# fleet index data survey_fleet_index <- methods::new(Index, nyears) # survey age composition data survey_fleet_age_comp <- methods::new(AgeComp, nyears, nages) survey_fleet_index$index_data <- survey_index # Effective sampling size is 200 survey_fleet_age_comp$age_comp_data <- survey_agecomp * 200"},{"path":"https://NOAA-FIMS.github.io/FIMS/articles/fims-demo.html","id":"survey-selectivity","dir":"Articles","previous_headings":"Creating Modules in FIMS > The Survey Module","what":"Survey Selectivity","title":"Introducing the Fisheries Integrated Modeling System (FIMS)","text":"","code":"survey_fleet_selectivity <- new(LogisticSelectivity) survey_fleet_selectivity$inflection_point$value <- 1.5 survey_fleet_selectivity$inflection_point$is_random_effect <- FALSE survey_fleet_selectivity$inflection_point$estimated <- TRUE survey_fleet_selectivity$slope$value <- 2.0 survey_fleet_selectivity$slope$is_random_effect <- FALSE survey_fleet_selectivity$slope$estimated <- TRUE"},{"path":"https://NOAA-FIMS.github.io/FIMS/articles/fims-demo.html","id":"creating-the-survey-object","dir":"Articles","previous_headings":"Creating Modules in FIMS > The Survey Module","what":"Creating the Survey Object","title":"Introducing the Fisheries Integrated Modeling System (FIMS)","text":"","code":"survey_fleet <- methods::new(Fleet) survey_fleet$is_survey <- TRUE survey_fleet$nages <- nages survey_fleet$nyears <- nyears survey_fleet$estimate_F <- FALSE survey_fleet$random_F <- FALSE survey_fleet$log_q <- log(3.315143e-07) survey_fleet$estimate_q <- TRUE survey_fleet$random_q <- FALSE # sd = sqrt(log(cv^2 + 1)), sd is log transformed survey_fleet$log_obs_error <- rep(log(sqrt(log(0.2^2 + 1))),nyears) survey_fleet$estimate_obs_error <- FALSE survey_fleet$SetAgeCompLikelihood(1) survey_fleet$SetIndexLikelihood(1) survey_fleet$SetSelectivity(survey_fleet_selectivity$get_id()) survey_fleet$SetObservedIndexData(survey_fleet_index$get_id()) survey_fleet$SetObservedAgeCompData(survey_fleet_age_comp$get_id())"},{"path":"https://NOAA-FIMS.github.io/FIMS/articles/fims-demo.html","id":"creating-a-population","dir":"Articles","previous_headings":"Creating Modules in FIMS","what":"Creating a Population","title":"Introducing the Fisheries Integrated Modeling System (FIMS)","text":"final step set population module. , first need set component population (e.g. recruitment, growth, etc.).","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/articles/fims-demo.html","id":"recruitment","dir":"Articles","previous_headings":"Creating Modules in FIMS > Creating a Population","what":"Recruitment","title":"Introducing the Fisheries Integrated Modeling System (FIMS)","text":"’ll use Beverton Holt recruitment module. first instantiate module using methods::new() function. can use methods::show() view fields (.e. variables) methods (.e. functions) available BevertonHoltRecruitment module. three parameters need set-: log_sigma_recruit, log_rzero, logit_steep. also need set log recruitment deviations. FIMS recruitment modules boolean, estimate_log_devs specify whether log deviations estimated; vector, log_devs set log deviation values.","code":"# Recruitment recruitment <- methods::new(BevertonHoltRecruitment) methods::show(BevertonHoltRecruitment) ## C++ class 'BevertonHoltRecruitment' <0x55687bb95080> ## Constructors: ## BevertonHoltRecruitment() ## ## Fields: ## bool estimate_log_devs ## Rcpp::Vector<14, Rcpp::PreserveStorage> log_devs ## Parameter log_rzero ## Parameter log_sigma_recruit ## Parameter logit_steep ## ## Methods: ## double evaluate(double, double) ## ## double evaluate_nll() ## ## unsigned int get_id() ## recruitment$log_sigma_recruit$value <- log(0.4) recruitment$log_rzero$value <- log(1e+06) recruitment$log_rzero$is_random_effect <- FALSE recruitment$log_rzero$estimated <- TRUE recruitment$logit_steep$value <- -log(1.0 - 0.75) + log(0.75 - 0.2) recruitment$logit_steep$is_random_effect <- FALSE recruitment$logit_steep$estimated <- FALSE recruitment$estimate_log_devs <- FALSE recruitment$log_devs <- c( 0.08904850, 0.43787763, -0.13299042, -0.43251973, 0.64861200, 0.50640852, -0.06958319, 0.30246260, -0.08257384, 0.20740372, 0.15289604, -0.21709207, -0.13320626, 0.11225374, -0.10650836, 0.26877132, 0.24094126, -0.54480751, -0.23680557, -0.58483386, 0.30122785, 0.21930545, -0.22281699, -0.51358369, 0.15740234, -0.53988240, -0.19556523, 0.20094360, 0.37248740, -0.07163145 )"},{"path":"https://NOAA-FIMS.github.io/FIMS/articles/fims-demo.html","id":"growth","dir":"Articles","previous_headings":"Creating Modules in FIMS > Creating a Population","what":"Growth","title":"Introducing the Fisheries Integrated Modeling System (FIMS)","text":"Now, ’ll define growth module population using empirical weight age model.","code":"# Growth ewaa_growth <- methods::new(EWAAgrowth) ewaa_growth$ages <- ages ewaa_growth$weights <- c( 0.0005306555, 0.0011963283, 0.0020582654, 0.0030349873, 0.0040552124, 0.0050646975, 0.0060262262, 0.0069169206, 0.0077248909, 0.0084461128, 0.0090818532, 0.0096366950 )"},{"path":"https://NOAA-FIMS.github.io/FIMS/articles/fims-demo.html","id":"maturity","dir":"Articles","previous_headings":"Creating Modules in FIMS > Creating a Population","what":"Maturity","title":"Introducing the Fisheries Integrated Modeling System (FIMS)","text":"population also need maturity model. define logistic maturity model. Now life history sub-models defined, lets define actual population. Now need link recruitment, growth, maturity modules set new population module. calling get_id() respective module passing unique ID respective Set function population.","code":"# Maturity maturity <- new(LogisticMaturity) maturity$inflection_point$value <- 2.25 maturity$inflection_point$is_random_effect <- FALSE maturity$inflection_point$estimated <- FALSE maturity$slope$value <- 3 maturity$slope$is_random_effect <- FALSE maturity$slope$estimated <- FALSE # Population population <- new(Population) population$log_M <- rep(log(0.2), nyears * nages) population$estimate_M <- FALSE population$log_init_naa <- log(c( 993947.5, 811707.8, 661434.4, 537804.8, 436664.0, 354303.4, 287397.0, 233100.2, 189054.0, 153328.4, 124353.2, 533681.3 )) population$estimate_init_naa <- TRUE population$nages <- nages population$ages <- ages population$nfleets <- 2 # 1 fleet and 1 survey population$nseasons <- nseasons population$nyears <- nyears population$SetMaturity(maturity$get_id()) population$SetGrowth(ewaa_growth$get_id()) population$SetRecruitment(recruitment$get_id())"},{"path":[]},{"path":"https://NOAA-FIMS.github.io/FIMS/articles/fims-demo.html","id":"creating-the-fims-model-and-making-the-tmb-function","dir":"Articles","previous_headings":"Putting It All Together","what":"Creating the FIMS Model and Making the TMB Function","title":"Introducing the Fisheries Integrated Modeling System (FIMS)","text":"","code":"sucess <- CreateTMBModel() parameters <- list(p = get_fixed()) obj <- MakeADFun(data = list(), parameters, DLL = \"FIMS\", silent = TRUE)"},{"path":"https://NOAA-FIMS.github.io/FIMS/articles/fims-demo.html","id":"fitting-the-model","dir":"Articles","previous_headings":"","what":"Fitting the Model","title":"Introducing the Fisheries Integrated Modeling System (FIMS)","text":"","code":"opt <- nlminb(obj$par, obj$fn, obj$gr, control = list(eval.max = 800, iter.max = 800) ) # , method = \"BFGS\", # control = list(maxit=1000000, reltol = 1e-15)) print(opt) ## $par ## p p p p p p ## 1.9456129 1.0764466 -4.6411971 -3.5795404 -3.0704163 -2.7617492 ## p p p p p p ## -2.9960582 -2.3981740 -2.3821374 -1.6271687 -2.1804423 -1.9816417 ## p p p p p p ## -1.8755261 -1.8164944 -2.1337980 -1.7742776 -1.7263032 -1.8263013 ## p p p p p p ## -1.1621941 -1.3539843 -1.3713984 -1.4168990 -1.1117784 -1.4087689 ## p p p p p p ## -0.8779831 -1.0650765 -1.0952198 -1.2164856 -1.2289848 -0.8988722 ## p p p p p p ## -1.1404625 -0.6719076 1.4735198 1.9285393 -14.8994794 13.8145611 ## p p p p p p ## 13.6979439 13.6164047 13.4500426 13.1536667 12.9040692 12.6810089 ## p p p p p p ## 12.6197621 12.2562556 12.2909497 11.7643992 11.9287247 13.0970927 ## ## $objective ## [1] 2549.36 ## ## $convergence ## [1] 0 ## ## $iterations ## [1] 288 ## ## $evaluations ## function gradient ## 430 289 ## ## $message ## [1] \"relative convergence (4)\""},{"path":"https://NOAA-FIMS.github.io/FIMS/articles/fims-demo.html","id":"tmb-reporting","dir":"Articles","previous_headings":"Fitting the Model","what":"TMB Reporting","title":"Introducing the Fisheries Integrated Modeling System (FIMS)","text":"","code":"sdr <- TMB::sdreport(obj) sdr_fixed <- summary(sdr, \"fixed\") report <- obj$report() print(sdr_fixed) ## Estimate Std. Error ## p 1.9456129 0.071966634 ## p 1.0764466 0.069197682 ## p -4.6411971 0.038909771 ## p -3.5795404 0.036845719 ## p -3.0704163 0.035250950 ## p -2.7617492 0.033941502 ## p -2.9960582 0.032200700 ## p -2.3981740 0.030170559 ## p -2.3821374 0.028825986 ## p -1.6271687 0.028535969 ## p -2.1804423 0.027910999 ## p -1.9816417 0.026371300 ## p -1.8755261 0.025391268 ## p -1.8164944 0.024857446 ## p -2.1337980 0.024389822 ## p -1.7742776 0.023760514 ## p -1.7263032 0.023576285 ## p -1.8263013 0.023767094 ## p -1.1621941 0.024809809 ## p -1.3539843 0.026966929 ## p -1.3713984 0.028532076 ## p -1.4168990 0.029257526 ## p -1.1117784 0.030581337 ## p -1.4087689 0.033023134 ## p -0.8779831 0.037061824 ## p -1.0650765 0.042655996 ## p -1.0952198 0.046308769 ## p -1.2164856 0.049976933 ## p -1.2289848 0.054372837 ## p -0.8988722 0.061786784 ## p -1.1404625 0.070406295 ## p -0.6719076 0.081806816 ## p 1.4735198 0.045085492 ## p 1.9285393 0.137977965 ## p -14.8994794 0.043505494 ## p 13.8145611 0.008160616 ## p 13.6979439 0.061661386 ## p 13.6164047 0.060381361 ## p 13.4500426 0.064298057 ## p 13.1536667 0.073968712 ## p 12.9040692 0.084172554 ## p 12.6810089 0.095329204 ## p 12.6197621 0.100862827 ## p 12.2562556 0.126933234 ## p 12.2909497 0.134810441 ## p 11.7643992 0.205483476 ## p 11.9287247 0.238296215 ## p 13.0970927 0.103888032"},{"path":"https://NOAA-FIMS.github.io/FIMS/articles/fims-demo.html","id":"plotting-results","dir":"Articles","previous_headings":"","what":"Plotting Results","title":"Introducing the Fisheries Integrated Modeling System (FIMS)","text":"","code":"library(ggplot2) index_results <- data.frame( observed = survey_fleet_index$index_data, expected = report$exp_index[[2]] ) print(index_results) ## observed expected ## 1 0.006795379 0.006473109 ## 2 0.006170738 0.006483166 ## 3 0.005977854 0.006421357 ## 4 0.005907966 0.006343226 ## 5 0.007211237 0.006153200 ## 6 0.006867264 0.006013449 ## 7 0.006329387 0.005818650 ## 8 0.006137000 0.005766681 ## 9 0.005279601 0.005207606 ## 10 0.005666829 0.005067875 ## 11 0.004806935 0.004812707 ## 12 0.004374876 0.004529218 ## 13 0.003992211 0.004255846 ## 14 0.004188884 0.004129084 ## 15 0.003711145 0.003811198 ## 16 0.003818704 0.003537988 ## 17 0.002878658 0.003383185 ## 18 0.002936660 0.002920954 ## 19 0.002972886 0.002722717 ## 20 0.002484963 0.002508789 ## 21 0.001983795 0.002289329 ## 22 0.001738507 0.001953053 ## 23 0.002122178 0.001907207 ## 24 0.001617189 0.001707296 ## 25 0.001745169 0.001606312 ## 26 0.001414111 0.001487141 ## 27 0.001350571 0.001444139 ## 28 0.001323396 0.001395934 ## 29 0.001069791 0.001241003 ## 30 0.001459411 0.001271027 ggplot(index_results, aes(x = 1:nyears, y = observed)) + geom_point() + xlab(\"Year\") + ylab(\"Index\") + geom_line(aes(x = 1:nyears, y = expected), color = \"blue\") + theme_bw() catch_results <- data.frame( observed = fishing_fleet_index$index_data, expected = report$exp_index[[1]] ) print(catch_results) ## observed expected ## 1 160.2363 160.1976 ## 2 460.6336 460.4676 ## 3 752.1299 751.8077 ## 4 996.9872 996.9747 ## 5 769.6972 769.4465 ## 6 1352.7309 1351.2565 ## 7 1317.7236 1316.7295 ## 8 2626.0240 2621.9449 ## 9 1415.1162 1414.7087 ## 10 1666.0168 1665.1475 ## 11 1751.8060 1750.4163 ## 12 1739.5435 1738.9201 ## 13 1208.5391 1208.8006 ## 14 1647.6643 1647.3999 ## 15 1593.6254 1593.8703 ## 16 1343.2277 1342.6976 ## 17 2337.0098 2330.7339 ## 18 1685.7172 1685.4265 ## 19 1529.8325 1530.5588 ## 20 1359.5044 1363.3007 ## 21 1637.5099 1638.6243 ## 22 1081.9126 1080.3953 ## 23 1648.7687 1646.4232 ## 24 1230.1199 1233.1485 ## 25 1133.8784 1133.5282 ## 26 956.5872 958.0254 ## 27 911.0781 913.1839 ## 28 1172.4887 1174.4841 ## 29 852.1934 852.0467 ## 30 1278.3228 1278.1371 ggplot(catch_results, aes(x = 1:nyears, y = observed)) + geom_point() + xlab(\"Year\") + ylab(\"Index\") + geom_line(aes(x = 1:nyears, y = expected), color = \"blue\") + theme_bw()"},{"path":"https://NOAA-FIMS.github.io/FIMS/articles/fims-demo.html","id":"clear-c-objects-from-memory","dir":"Articles","previous_headings":"","what":"Clear C++ objects from memory","title":"Introducing the Fisheries Integrated Modeling System (FIMS)","text":"","code":"clear()"},{"path":"https://NOAA-FIMS.github.io/FIMS/articles/fims-path-maturity.html","id":"setting-up-a-module-in-r","dir":"Articles","previous_headings":"","what":"Setting up a module in R","title":"FIMS Path: Maturity","text":"’ll start R. first step retrieve FIMS module, create new maturity module inside FIMS, populate maturity module parameter values. , need create set population link maturity module population: FIMS sets objects stored memory, simply running rm(Fims), won’t free memory back . function can run clear memory: Also restarting closing R session free memory.","code":"# load FIMS library(FIMS) # Create a new maturity model maturity <- new(LogisticMaturity) # Populate the maturity module with parameter values. maturity$inflection_point$value <- 10 maturity$inflection_point$is_random_effect <- FALSE maturity$inflection_point$estimated <- FALSE maturity$slope$value <- 0.2 maturity$slope$is_random_effect <- FALSE maturity$slope$estimated <- FALSE population <- new(Population) # set up population specific parameters (other modules) # ... # set maturity for the population - will throw error until PR #363 is merged into main population$SetMaturity(maturity$get_id()) # Clear C++ memory clear() # Clear R memory rm(Fims) rm(maturity) rm(population)"},{"path":"https://NOAA-FIMS.github.io/FIMS/articles/fims-path-maturity.html","id":"the-rcpp-interface","dir":"Articles","previous_headings":"","what":"The Rcpp Interface","title":"FIMS Path: Maturity","text":"fields specific maturity module accessible R defined rcpp_interface.hpp file directory inst/include/interface/rcpp: code shows two maturity module-specific fields (.e., parameters), inflection_point slope, two maturity module-specific methods (.e., functions), get_id evaluate. Defined methods functions can called R. can access fields methods R using show(Fims) function. maturity module’s get_id method returns unique ID specific module. creating new module R, users can access module using name quotes Rcpp::class, LogisticMaturity module references maturity rcpp class, LogisticMaturityInterface defined rcpp_maturity.hpp directory inst/include/interface/rcpp/rcpp_objects. rcpp_maturity.hpp file consists MaturityInterfaceBase class LogisticMaturityInterface class, former parent class latter child class: typically reference child class R specify formulation maturity wish use specific model run FIMS. particular example, using logistic form maturity. Rcpp interface classes FIMS define parameters (e.g., inflection_point, slope) using Parameter class defined rcpp_interface_base.hpp directory inst/include/interface/rcpp/rcpp_objects: fields Parameter class accessible R defined rcpp_interface.hpp file directory inst/include/interface/rcpp: field (.e., parameter) maturity (.e., maturity module defined R) therefore inherit five fields defined Parameter class: value, min, max, is_random_effect, estimated.","code":"Rcpp::class_(\"LogisticMaturity\") .constructor() .field(\"inflection_point\", &LogisticMaturityInterface::inflection_point) .field(\"slope\", &LogisticMaturityInterface::slope) .method(\"get_id\", &LogisticMaturityInterface::get_id) .method(\"evaluate\", &LogisticMaturityInterface::evaluate); maturity <- new(LogisticMaturity) class MaturityInterfaceBase : public FIMSRcppInterfaceBase { public: static uint32_t id_g; /**< static id of the recruitment interface base*/ uint32_t id; /**< id of the recruitment interface base */ ... } class LogisticMaturityInterface : public MaturityInterfaceBase { public: Parameter inflection_point; /**< the index value at which the response reaches .5 */ Parameter slope; /**< the width of the curve at the inflection_point */ ... } class Parameter { public: double value; /**< initial value of the parameter*/ //std::numeric_limits::min() returns a very large negative number double min = std::numeric_limits::min(); /**< min value of the parameter*/ //std::numeric_limits::max() returns a very large positive number double max = std::numeric_limits::max(); /**< max value of the parameter*/ bool is_random_effect = false; /**< Is the parameter a random effect parameter? Default value is false.*/ bool estimated = false; /**< Is the parameter estimated? Default value is false.*/ ... } Rcpp::class_(\"Parameter\") .constructor() .constructor() .constructor() .field(\"value\", &Parameter::value) .field(\"min\", &Parameter::min) .field(\"max\", &Parameter::max) .field(\"is_random_effect\", &Parameter::is_random_effect) .field(\"estimated\", &Parameter::estimated);"},{"path":[]},{"path":"https://NOAA-FIMS.github.io/FIMS/articles/fims-path-maturity.html","id":"what-is-the-fims-namespace","dir":"Articles","previous_headings":"Linking the Rcpp interface to the fims namespace.","what":"What is the fims namespace?","title":"FIMS Path: Maturity","text":"namespace C++ similar library R. core FIMS within fims namespace convenient way differentiate part C++ code base portable, .e., independent statistical platform, part codebase depends platforms outside base C++ (e.g., Rcpp, R, TMB). code written within: considered part fims namespace. C++ classes written within fims namespace can accessed within C++ code base using fims_popdy::. exceptions TMB specific code referenced within fims namespace. cases, code written within #ifdef TMB_MODEL wrapper, means code defined TMB used. Given addition new platform, eg. stan, new wrapper added define platform specific code sections. example, definition data types interface.hpp directory inst/include/interface always platform dependent platform specific requirements data types defined. Whenever new platform added FIMS, need set platform specific data type definitions:","code":"namespace fims{ } namespace fims { #ifdef TMB_MODEL /** * @brief fims::ModelTraits class that contains the DataVector * and ParameterVector types. */ template struct fims::ModelTraits { typedef typename CppAD::vector DataVector; /**< This is a vector of the data that is differentiable */ typedef typename CppAD::vector ParameterVector; /**< This is a vector of the parameters that is differentiable */ typedef typename tmbutils::vector EigenVector; /**< This is a vector as defined in TMB's namespace Eigen */ }; #endif /* TMB_MODEL */ } // namespace fims //not developed yet #ifdef STAN_MODEL //stan specific definitions go here #endif"},{"path":"https://NOAA-FIMS.github.io/FIMS/articles/fims-path-maturity.html","id":"getting-back-to-the-maturity-example","dir":"Articles","previous_headings":"Linking the Rcpp interface to the fims namespace.","what":"Getting back to the maturity example…","title":"FIMS Path: Maturity","text":"Rcpp interface object includes add_to_fims_tmb() function. two shared pointers set within function, one link Rcpp interface object (e.g., LogisticMaturityInterface) Information class fims namespace defined information.hpp directory inst/include/common one link matching class fims namespace. maturity example, LogisticMaturity class fims namespace defined logistic.hpp directory inst/include/population_dynamics/maturity/functors. Within rcpp_maturity.hpp file, can link fims_info::Information class order register maturity parameters specify whether random effects. setting two pointers interface: d0 points information, lm0, points logistic maturity module. Linking fims_popdy::LogisticMaturity class allows us link values input R values used model calculation: can also link two pointers together fims_info::Information class links fims_popdy::LogisticMaturity, details later. \\(\\color{#c55a11}{\\text{`add_to_fims_tmb()`}}\\) function repeats code four times track estimated value parameters along first, second, third derivatives.","code":"//file: rcpp_maturity.hpp //d0 is a shared pointer that points to fims_info::Information std::shared_ptr > d0 = fims_info::Information::GetInstance(); if (this->inflection_point.estimated) { if (this->inflection_point.is_random_effect) { /* if inflection_point is estimated and a random effect, the inflection_point value from LogisticMaturityInterface (lm0->inflection_point) is passed to the Information member function RegisterRandomEffect */ d0->RegisterRandomEffect(lm0->inflection_point); } else { /* if inflection_point is estimated and not a random effect, the inflection_point value from LogisticMaturityInterface (lm0->inflection_point) is passed to the Information member function RegisterParameter */ d0->RegisterParameter(lm0->inflection_point); } } //file: rcpp_maturity.hpp //lm0 is a shared pointer that points to fims_popdy::LogisticMaturity std::shared_ptr > lm0 = std::make_shared >(); /* the inflection_point value from LogisticMaturity (lm0->inflection_point) equals the inflection_point value from LogisticMaturityInterface (this->inflection_point.value) */ lm0->inflection_point = this->inflection_point.value; //file: rcpp_maturity.hpp /* the maturity_models pointer from Information that matches the id of the fims_popdy::LogisticMaturity class is equal to the pointer to fims_popdy::LogisticMaturity */ d0->maturity_models[lm0->id] = lm0;"},{"path":"https://NOAA-FIMS.github.io/FIMS/articles/fims-path-maturity.html","id":"inside-the-fims_popdylogisticmaturity-class","dir":"Articles","previous_headings":"","what":"Inside the fims_popdy::LogisticMaturity class","title":"FIMS Path: Maturity","text":"LogisticMaturity class fims namespace defined logistic.hpp directory inst/include/population_dynamics/maturity/functors evaluate method (.e., function) takes input, x returns output logistic function (defined fims_math.hpp directory inst/include/common) using class member inflection_point slope values.","code":"namespace fims_popdy { /** * @brief LogisticMaturity class that returns the logistic function value * from fims_math. */ template struct LogisticMaturity : public MaturityBase { Type inflection_point; /**< 50% quantile of the value of the quantity of interest (x); e.g., age at which 50% of the fish are mature */ Type slope; /**() {} /** * @brief Method of the logistic maturity class that implements the * logistic function from FIMS math. * * @param x The independent variable in the logistic function (e.g., age or * size at maturity). */ virtual const Type evaluate(const Type& x) { return fims_math::logistic(inflection_point, slope, x); } }; } // namespace fims"},{"path":"https://NOAA-FIMS.github.io/FIMS/articles/fims-path-maturity.html","id":"calling-maturity-from-population","dir":"Articles","previous_headings":"","what":"Calling maturity from population","title":"FIMS Path: Maturity","text":"Population class defined population.hpp directory inst/include/population_dynamics/population biological calculations happen, producing expected values used likelihood equations derived values important management (e.g., spawning biomass). evaluate maturity within Population class, first need set shared pointer, linking maturity module population. maturity_id set R using SetMaturity() method PopulationInterface class: Notice population default declares pointer type MaturityBase (parent class), specific maturity class using example, LogisticMaturity (child class). MaturityBase evaluate method input arguments match inputs child class: evaluate function virtual C++ function, means function can overwritten functions name child class. structure keeps maturity module population generic. don’t need conditional statements loop possible maturity formulations within population. need add new child maturity class Rcpp interface can automatically call population. trade-. creating nested hierarchical structure makes code base harder read. exchange, ’re creating code lower cyclomatic complexity, ever one independent path user maturity->evaluate() call population, regardless many maturity functions added FIMS. Code lower cyclomatic complexity easier test, maintain, extend. ’ve set shared pointer, can access maturity within population:","code":"//file: inst/include/population_dynamics/population/population.hpp // maturity is a shared pointer to MaturityBase int maturity_id = -999; /**< id of maturity model object*/ std::shared_ptr> maturity; /**< shared pointer to maturity module */ population$SetMaturity(maturity$get_id()) //file: inst/include/population_dynamics/maturity/functors/maturity_base.hpp namespace fims_popdy { /** @brief Base class for all maturity functors. * * @tparam TypeThe type of the maturity functor. */ template struct MaturityBase : public fims_model_object::FIMSObject { // id_g is the ID of the instance of the MaturityBase class. // this is like a memory tracker. // Assigning each one its own ID is a way to keep track of // all the instances of the MaturityBase class. static uint32_t id_g; /**< The ID of the instance of the MaturityBase class */ /** @brief Constructor. */ MaturityBase() { // increment id of the singleton maturity class this->id = MaturityBase::id_g++; } /** * @brief Calculates the maturity. * @param x The independent variable in the maturity function (e.g., logistic * maturity at age or size). */ virtual const Type evaluate(const Type& x) = 0; }; //file: inst/include/population_dynamics/population/population.hpp /** * @brief Calculates expected proportion of individuals mature at a selected * age * * @param i_age_year dimension folded index for age and year * @param age the age of maturity */ void CalculateMaturityAA(size_t i_age_year, size_t age) { // this->maturity is pointing to the maturity module, which has // an evaluate function. -> can be nested. this->proportion_mature_at_age[i_age_year] = this->maturity->evaluate(ages[age]); }"},{"path":"https://NOAA-FIMS.github.io/FIMS/articles/fims-path-maturity.html","id":"linking-everything-together","dir":"Articles","previous_headings":"","what":"Linking everything together","title":"FIMS Path: Maturity","text":"material demonstrates values passed R get propagated population.hpp, used biologically relevant calculations. , however, relies population referencing correct child class (eg. LogisticMaturity) even though calls parent class (MaturityBase). defined maturity_id population specific logistic maturity module wanted use, population$SetMaturity(maturity$get_id()), still need connect ID actual module memory. information managed FIMS Information class information.hpp directory inst/include/common. Information class sets number C++ maps (container key value mapped value - think named lists R) key unique ID module mapped value shared pointer module. C++ std::maps iterator member stepping elements map. iterator also declared Information class can loop unique maturity modules called FIMS. currently one, FIMS gets extended include multiple populations, unique maturity module population subset populations. Next, let’s revisit line code written Rcpp LogisticMaturityInterface class rcpp_maturity.hpp directory inst/include/interface/rcpp/rcpp_objects , setting maturity_models pointer Information equal lm0 pointer LogisticMaturity module Now need pass pointer maturity pointer population population->maturity points LogisticMaturity module instead MaturityBase. First set map Information points Population. loop populations create new shared pointer, p, reference individual population interest. code chunk, (*) refers single population populations map. second element map pointer, p = (*).second means setting pointer single population equal pointer populations map. Within population loop, link maturity pointer population equal maturity pointer information, passing information want use LogisticMaturity class: , (*) referring maturity_models map information (*).second refers second element map, pointer maturity module.","code":"//file: inst/include/common/information.hpp /* uint32_t is an unsigned integer (always positive) The first component of the map is a uint32_t which will be used to hold the ID. The second component of the map is the shared pointer, maturity_models, that points to fims_popdy::MaturityBase */ std::map > > maturity_models; /** > >::iterator maturity_models_iterator; //file: rcpp_maturity.hpp /* the maturity_models pointer from Information that matches the id of the fims_popdy::LogisticMaturity class is equal to the pointer to fims_popdy::LogisticMaturity */ d0->maturity_models[lm0->id] = lm0; //file: inst/include/common/information.hpp std::map > > populations; /** > >::iterator population_iterator; /**< iterator for population objects>*/ //file: inst/include/common/information.hpp for (population_iterator it = this->populations.begin(); it != this->populations.end(); ++it) { std::shared_ptr > p = (*it).second; ... //file: inst/include/common/information.hpp // set maturity if (p->maturity_id != -999) { uint32_t maturity_uint = static_cast(p->maturity_id); maturity_models_iterator it = this->maturity_models.find( maturity_uint); // >maturity_models is specified in // information.hpp and used in rcpp if (it != this->maturity_models.end()) { //p->maturity is the maturity pointer in population p->maturity = //(*it).second is the maturity pointer in information (*it).second; // >maturity defined in population.hpp }"},{"path":"https://NOAA-FIMS.github.io/FIMS/articles/fims-path-maturity.html","id":"conceptualizing-this-path-with-r","dir":"Articles","previous_headings":"","what":"Conceptualizing this path with R","title":"FIMS Path: Maturity","text":"optional exercise benefit thinking structure C++ code seeing corollary R. Let’s think writing something similar R using lists three populations two maturity functions. R code section corresponds C++ code taken FIMS. FIMS sections commented help distinguish two code sets. idea link happening FIMS language ’re bit familiar . Example Case: Let’s set 3 populations first two mirrored logistic maturity function third different maturity function. third function different function together logistic function different parameter set. example, ’ll use logistic function different parameter set. can think population_modules maturity_modules instantiated C++ classes stored computer’s memory. R code chunk comparable following FIMS, sets modules R: Next assign maturity used population using IDs R code chunk comparable following FIMS, sets IDs R: Now let’s review happening Information. ’ll start setting empty list R. FIMS, Information class objects, population maturity, C++ maps. first element map ID, second element map pointer Population Maturity class: can link pointers information respective module: FIMS, definitions happen passing information rcpp interface FIMS Information. can loop population module defined information set maturity ’re getting user specified Rcpp interface back Population class used run calculations model. line code following chunk, corresponding C++ code FIMS directly commented . R, code sets intermediate value, p. update maturity p equal correct maturity module, p$pointer$maturity <- information$maturity[[newit]][[2]], code passes back population_modules, population_modules[[]][2]$maturity <- p$pointer$maturity. context, population_modules population class held memory used run calculations. deeper level abstraction happening C++ FIMS, p population module stored memory. equivalent line code population_modules[[]][2]$maturity <- p$pointer$maturity isn’t needed FIMS update p, also updating population class held memory used run calculations.","code":"# For the population module, there are additional parameters # we are going to ignore here population_modules <- list( \"Pop 1\" = list( id = 1, maturity = \"MaturityBase\" ), \"Pop 2\" = list( id = 2, maturity = \"MaturityBase\" ), \"Pop 3\" = list( id = 3, maturity = \"MaturityBase\" ) ) maturity_modules <- list( \"Logistic Maturity\" = list(id = 1, inflection_point = 10, slope = 0.2), \"Some Other Maturity\" = list(id = 2, inflection_point = 8, slope = 0.3) ) # maturity1 <- new(LogisticMaturity) # maturity1$inflection_point$value <- 10 # maturity1$slope$value <- 0.2 # maturity2 <- new(LogisticMaturity) # maturity2$inflection_point$value <- 8 # maturity2$slope$value <- 0.3 # population1 <- new(Population) # population2 <- new(Population) # population3 <- new(Population) population_modules[[1]]$maturity_id <- maturity_modules[[1]]$id population_modules[[2]]$maturity_id <- maturity_modules[[1]]$id population_modules[[3]]$maturity_id <- maturity_modules[[2]]$id # population1$SetMaturity(maturity1$get_id()) # population2$SetMaturity(maturity1$get_id()) # population3$SetMaturity(maturity2$get_id()) information <- list( populations = list(id = NULL, pointer = \"Population\"), maturity = list(id = NULL, pointer = \"MaturityBase\") ) # std::map > > maturity_models; # std::map > > populations; information$populations[[1]] <- list(id = 1, pointer = population_modules[[1]]) information$populations[[2]] <- list(id = 2, pointer = population_modules[[2]]) information$populations[[3]] <- list(id = 3, pointer = population_modules[[3]]) information$maturity[[1]] <- list(id = 1, pointer = maturity_modules[[1]]) information$maturity[[2]] <- list(id = 2, pointer = maturity_modules[[2]]) ## //file: rcpp_maturity.hpp ## d0 is the pointer to information ## lm0 is the pointer to a specific maturity module ## (e.g., lm0 = maturity_modules[[1]]) # d0->maturity_models[lm0->id] = lm0; for (it in 1:length(population_modules)) { # for (population_iterator it = this->populations.begin(); # it != this->populations.end(); ++it) { p <- information$populations[[it]][2] # std::shared_ptr > p = (*it).second; maturity_uint <- p$pointer$maturity_id # uint32_t maturity_uint = static_cast(p->maturity_id); newit <- which(sapply(information$maturity, function(x) x$id) == maturity_uint) # maturity_models_iterator it = this->maturity_models.find(maturity_uint) p$pointer$maturity # MaturityBase p$pointer$maturity <- information$maturity[[newit]][[2]] p$pointer$maturity # LogisticMaturity1 # p->maturity = (*it).second; population_modules[[it]][2]$maturity <- p$pointer$maturity } sapply(population_modules, function(x) x[2]$maturity) #> Pop 1 Pop 2 Pop 3 #> id 1 1 2 #> inflection_point 10 10 8 #> slope 0.2 0.2 0.3"},{"path":"https://NOAA-FIMS.github.io/FIMS/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Christine Stawitz. Author, maintainer. Nathan Vaughan. Author. Howard Townsend. Author. Ian G. Taylor. Author. Matthew Supernaw. Author. Jane Sullivan. Author. Kyle Shertzer. Author. Megumi Oshima. Author. Cole C. Monnahan. Author. Timothy J. Miller. Author. Richard Methot. Author. Patrick Lynch. Author. Bai Li. Author. Huihua Lee. Author. Christopher M. Legault. Author. Kelli F. Johnson. Author. James N. Ianelli. Author. Alan Haynie. Author. Andrea M. Havron. Author. Kathryn L. Doering. Author. Edward J. Dick. Author. Jon Brodziak. Author. Kristan Blackhart. Author. Peter Kuriyama. Author.","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"FIMS Implementation Team. 2022. NOAA-FIMS: NOAA Fisheries Integrated Modeling System. R package version 0.0.0.9000. https://github.com/NOAA-FIMS/FIMS","code":"@Manual{, title = {{NOAA-FIMS}: The NOAA Fisheries Integrated Modeling System}, author = {FIMS Implementation Team}, year = {2022}, url = {https://github.com/NOAA-FIMS/FIMS}, }"},{"path":"https://NOAA-FIMS.github.io/FIMS/index.html","id":"overview","dir":"","previous_headings":"","what":"Fisheries Integrated Modeling System (FIMS)","title":"Fisheries Integrated Modeling System (FIMS)","text":"repository development FIMS. NOAA Fisheries Integrated Modeling System software system designed architected support next-generation fisheries stock assessment, ecosystem, socioeconomic modeling. team experts within NOAA Fisheries designing developing system, advised FIMS Council includes academic, industry, international partners. roles internal external collaborators outlined governance section developer guide. plan operational software system released public 2023. meantime, users developers welcome submit feedback using Github issues. Please use issues collaborative workflow make suggestions developer guide issues FIMS software repo software design development feedback. can follow team discussion .","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"Fisheries Integrated Modeling System (FIMS)","text":"following software required: R version 4.0.0 newer (RStudio version 1.2.5042 newer) remotes R package TMB version 1.8.0 newer (install instructions .)","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/index.html","id":"windows-users","dir":"","previous_headings":"Installation","what":"Windows Users","title":"Fisheries Integrated Modeling System (FIMS)","text":"Rtools4 (available )","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/index.html","id":"fixing-fatal-error","dir":"","previous_headings":"Installation > Windows Users","what":"Fixing Fatal Error","title":"Fisheries Integrated Modeling System (FIMS)","text":"Windows users can expect see derivative following error message R session yet set flags using {withr}. can easily fix running following line local R session. Note call need repeated time open new session. fix work devtools::test() called FIMS re-compiled. call devtools::test() case overwrites local options set withr. Compile FIMS first using devtools::load_all() prior running devtools::test(). fix removes debugger flag -O0 -g automatically inserted certain devtools calls (e.g. devtools::load_all()). Windows developers wanting compile FIMS debugger turned need run script addition manually modifying call PKG_CXXFLAGS Makevars.win file src directory following: turn debugger flag, remove -O1 -g flag:","code":"Fatal error: can't write bytes to section .text of FIMS.o: 'file too big withr::local_options(pkg.build_extra_flags = FALSE) PKG_CXXFLAGS = -DTMB_MODEL -DTMB_EIGEN_DISABLE_WARNINGS -O1 -g PKG_CXXFLAGS = -DTMB_MODEL -DTMB_EIGEN_DISABLE_WARNINGS"},{"path":"https://NOAA-FIMS.github.io/FIMS/index.html","id":"installing-from-r","dir":"","previous_headings":"Installation","what":"Installing from R","title":"Fisheries Integrated Modeling System (FIMS)","text":"","code":"remotes::install_github(\"NOAA-FIMS/FIMS\") library(FIMS)"},{"path":"https://NOAA-FIMS.github.io/FIMS/index.html","id":"getting-help","dir":"","previous_headings":"","what":"Getting Help","title":"Fisheries Integrated Modeling System (FIMS)","text":"Please report bugs along minimal reproducible example github issues","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/index.html","id":"code-of-conduct","dir":"","previous_headings":"","what":"Code of Conduct","title":"Fisheries Integrated Modeling System (FIMS)","text":"contributors participating contributing FIMS project expected adhere FIMS Code Conduct","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/index.html","id":"noaa-disclaimer","dir":"","previous_headings":"","what":"NOAA Disclaimer","title":"Fisheries Integrated Modeling System (FIMS)","text":"repository scientific product official communication National Oceanic Atmospheric Administration, United States Department Commerce. NOAA GitHub project code provided ‘’ basis user assumes responsibility use. claims Department Commerce Department Commerce bureaus stemming use GitHub project governed applicable Federal law. reference specific commercial products, processes, services service mark, trademark, manufacturer, otherwise, constitute imply endorsement, recommendation favoring Department Commerce. Department Commerce seal logo, seal logo DOC bureau, shall used manner imply endorsement commercial product activity DOC United States Government. Software code created U.S. Government employees subject copyright United States (17 U.S.C. §105). United States/Department Commerce reserve rights seek obtain copyright protection countries United States Software authored entirety Department Commerce. end, Department Commerce hereby grants Recipient royalty-free, nonexclusive license use, copy, create derivative works Software outside United States. U.S. Department Commerce | National Oceanographic Atmospheric Administration | NOAA Fisheries","code":""},{"path":[]},{"path":[]},{"path":[]},{"path":[]},{"path":"https://NOAA-FIMS.github.io/FIMS/pull_request_template.html","id":"developer-pre-pr-checklist","dir":"","previous_headings":"","what":"Developer pre-PR checklist","title":"What is the feature?","text":"relied GitHub actions 🧪 things sat 🛋️.","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/FIMSFrame.html","id":null,"dir":"Reference","previous_headings":"","what":"Class constructors for FIMSFrame and associated child classes — FIMSFrame","title":"Class constructors for FIMSFrame and associated child classes — FIMSFrame","text":"constructor functions take single input build object specific needs model type within FIMS. FIMSFrame parent class associated child classes additional slots needed model type.","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/FIMSFrame.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Class constructors for FIMSFrame and associated child classes — FIMSFrame","text":"","code":"FIMSFrame(data) FIMSFrameAge(data)"},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/FIMSFrame.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Class constructors for FIMSFrame and associated child classes — FIMSFrame","text":"data data.frame contains necessary columns construct data frame given FIMSFrame-class.","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/FIMSFrame.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Class constructors for FIMSFrame and associated child classes — FIMSFrame","text":"object S4 class FIMSFrame one child classes validated returned. objects minimum slot called data store input data frame. Additional slots dependent child class. Use showClass() see available slots.","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/create_fims_rcpp_interface.html","id":null,"dir":"Reference","previous_headings":"","what":"Function to create the Rcpp interface classes\nfor FIMS model objects. — create_fims_rcpp_interface","title":"Function to create the Rcpp interface classes\nfor FIMS model objects. — create_fims_rcpp_interface","text":"Function create Rcpp interface classes FIMS model objects.","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/create_fims_rcpp_interface.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Function to create the Rcpp interface classes\nfor FIMS model objects. — create_fims_rcpp_interface","text":"","code":"create_fims_rcpp_interface( interface_name = character(), model = character(), base_class = character(), container = character(), parameters = vector(), evaluate_parameter = vector(), evaluate_parameter_type = vector() )"},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/create_fims_rcpp_interface.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Function to create the Rcpp interface classes\nfor FIMS model objects. — create_fims_rcpp_interface","text":"interface_name class name model fims model (.e. LogisticSelectivity) without \"fims\" namespace base_class interface base class container information model container parameters parameters model object evaluate_parameter parameter evaluate method evaluate_parameter_type type parameter evaluate method","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/create_fims_rcpp_interface.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Function to create the Rcpp interface classes\nfor FIMS model objects. — create_fims_rcpp_interface","text":"Text string code new Rcpp interface class","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/create_fims_rcpp_interface.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Function to create the Rcpp interface classes\nfor FIMS model objects. — create_fims_rcpp_interface","text":"","code":"create_fims_rcpp_interface( interface_name = \"DnormDistributionsInterface\", model = \"Dnorm\", base_class = \"DistributionsInterfaceBase\", container = \"distribution_models\", parameters = c(\"x\", \"mean\", \"sd\"), evaluate_parameter = \"do_log\", evaluate_parameter_type = \"bool\" ) #> class DnormDistributionsInterface : public DistributionsInterfaceBase { #> public: #> #> Parameter x; #> Parameter mean; #> Parameter sd; #> #> #> DnormDistributionsInterface() : DistributionsInterfaceBase() {} #> #> virtual ~DnormDistributionsInterface() {} #> #> #> virtual uint32_t get_id() { return this->id; } #> #> #> virtual double evaluate(bool do_log) { #> fims_popdy::Dnorm object; #> object.x = this->x.value; #> object.mean = this->mean.value; #> object.sd = this->sd.value; #> return object.evaluate(bool); #> } #> #> #> virtual bool add_to_fims_tmb(){ #> std::shared_ptr > d0 = #> fims_info::Information::GetInstance(); #> #> std::shared_ptr > model0 = #> std::make_shared >(); #> #> #> model0->id = this->id; #> model0->x= this->x.value; #> if (this->x.estimated) { #> if (this->x.is_random_effect) { #> d0->RegisterRandomEffect(model0->x); #> } else { #> d0->RegisterParameter(model0->x); #> } #> } #> model0->mean= this->mean.value; #> if (this->mean.estimated) { #> if (this->mean.is_random_effect) { #> d0->RegisterRandomEffect(model0->mean); #> } else { #> d0->RegisterParameter(model0->mean); #> } #> } #> model0->sd= this->sd.value; #> if (this->sd.estimated) { #> if (this->sd.is_random_effect) { #> d0->RegisterRandomEffect(model0->sd); #> } else { #> d0->RegisterParameter(model0->sd); #> } #> } #> d0->distribution_models[model0->id]=model0; #> #> #> std::shared_ptr > d1 = #> fims_info::Information::GetInstance(); #> #> std::shared_ptr > model1 = #> std::make_shared >(); #> #> #> model1->id = this->id; #> model1->x= this->x.value; #> if (this->x.estimated) { #> if (this->x.is_random_effect) { #> d1->RegisterRandomEffect(model1->x); #> } else { #> d1->RegisterParameter(model1->x); #> } #> } #> model1->mean= this->mean.value; #> if (this->mean.estimated) { #> if (this->mean.is_random_effect) { #> d1->RegisterRandomEffect(model1->mean); #> } else { #> d1->RegisterParameter(model1->mean); #> } #> } #> model1->sd= this->sd.value; #> if (this->sd.estimated) { #> if (this->sd.is_random_effect) { #> d1->RegisterRandomEffect(model1->sd); #> } else { #> d1->RegisterParameter(model1->sd); #> } #> } #> d1->distribution_models[model1->id]=model1; #> #> #> std::shared_ptr > d2 = #> fims_info::Information::GetInstance(); #> #> std::shared_ptr > model2 = #> std::make_shared >(); #> #> #> model2->id = this->id; #> model2->x= this->x.value; #> if (this->x.estimated) { #> if (this->x.is_random_effect) { #> d2->RegisterRandomEffect(model2->x); #> } else { #> d2->RegisterParameter(model2->x); #> } #> } #> model2->mean= this->mean.value; #> if (this->mean.estimated) { #> if (this->mean.is_random_effect) { #> d2->RegisterRandomEffect(model2->mean); #> } else { #> d2->RegisterParameter(model2->mean); #> } #> } #> model2->sd= this->sd.value; #> if (this->sd.estimated) { #> if (this->sd.is_random_effect) { #> d2->RegisterRandomEffect(model2->sd); #> } else { #> d2->RegisterParameter(model2->sd); #> } #> } #> d2->distribution_models[model2->id]=model2; #> #> #> std::shared_ptr > d3 = #> fims_info::Information::GetInstance(); #> #> std::shared_ptr > model3 = #> std::make_shared >(); #> #> #> model3->id = this->id; #> model3->x= this->x.value; #> if (this->x.estimated) { #> if (this->x.is_random_effect) { #> d3->RegisterRandomEffect(model3->x); #> } else { #> d3->RegisterParameter(model3->x); #> } #> } #> model3->mean= this->mean.value; #> if (this->mean.estimated) { #> if (this->mean.is_random_effect) { #> d3->RegisterRandomEffect(model3->mean); #> } else { #> d3->RegisterParameter(model3->mean); #> } #> } #> model3->sd= this->sd.value; #> if (this->sd.estimated) { #> if (this->sd.is_random_effect) { #> d3->RegisterRandomEffect(model3->sd); #> } else { #> d3->RegisterParameter(model3->sd); #> } #> } #> d3->distribution_models[model3->id]=model3; #> #> #> return true; #> #> #> } #> #> }; #> #> //Add the following to the RCpp module definition: rcpp_interface.hpp #> #> Rcpp::class_(\"DnormDistributions\") #> .constructor() #> .method(\"get_id\", &DnormDistributionsInterface::get_id) #> .method(\"evaluate\", & DnormDistributionsInterface ::evaluate) #> .field(\"x\", &DnormDistributionsInterface::x) #> .field(\"mean\", &DnormDistributionsInterface::mean) #> .field(\"sd\", &DnormDistributionsInterface::sd); create_fims_rcpp_interface( interface_name = \"LogisticSelectivityInterface\", model = \"LogisticSelectivity\", base_class = \"SelectivityInterfaceBase\", container = \"selectivity_models\", parameters = c(\"slope\", \"inflection_point\"), evaluate_parameter = \"x\", evaluate_parameter_type = \"double\" ) #> class LogisticSelectivityInterface : public SelectivityInterfaceBase { #> public: #> #> Parameter slope; #> Parameter inflection_point; #> #> #> LogisticSelectivityInterface() : SelectivityInterfaceBase() {} #> #> virtual ~LogisticSelectivityInterface() {} #> #> #> virtual uint32_t get_id() { return this->id; } #> #> #> virtual double evaluate(double x) { #> fims_popdy::LogisticSelectivity object; #> object.slope = this->slope.value; #> object.inflection_point = this->inflection_point.value; #> return object.evaluate(double); #> } #> #> #> virtual bool add_to_fims_tmb(){ #> std::shared_ptr > d0 = #> fims_info::Information::GetInstance(); #> #> std::shared_ptr > model0 = #> std::make_shared >(); #> #> #> model0->id = this->id; #> model0->slope= this->slope.value; #> if (this->slope.estimated) { #> if (this->slope.is_random_effect) { #> d0->RegisterRandomEffect(model0->slope); #> } else { #> d0->RegisterParameter(model0->slope); #> } #> } #> model0->inflection_point= this->inflection_point.value; #> if (this->inflection_point.estimated) { #> if (this->inflection_point.is_random_effect) { #> d0->RegisterRandomEffect(model0->inflection_point); #> } else { #> d0->RegisterParameter(model0->inflection_point); #> } #> } #> d0->selectivity_models[model0->id]=model0; #> #> #> std::shared_ptr > d1 = #> fims_info::Information::GetInstance(); #> #> std::shared_ptr > model1 = #> std::make_shared >(); #> #> #> model1->id = this->id; #> model1->slope= this->slope.value; #> if (this->slope.estimated) { #> if (this->slope.is_random_effect) { #> d1->RegisterRandomEffect(model1->slope); #> } else { #> d1->RegisterParameter(model1->slope); #> } #> } #> model1->inflection_point= this->inflection_point.value; #> if (this->inflection_point.estimated) { #> if (this->inflection_point.is_random_effect) { #> d1->RegisterRandomEffect(model1->inflection_point); #> } else { #> d1->RegisterParameter(model1->inflection_point); #> } #> } #> d1->selectivity_models[model1->id]=model1; #> #> #> std::shared_ptr > d2 = #> fims_info::Information::GetInstance(); #> #> std::shared_ptr > model2 = #> std::make_shared >(); #> #> #> model2->id = this->id; #> model2->slope= this->slope.value; #> if (this->slope.estimated) { #> if (this->slope.is_random_effect) { #> d2->RegisterRandomEffect(model2->slope); #> } else { #> d2->RegisterParameter(model2->slope); #> } #> } #> model2->inflection_point= this->inflection_point.value; #> if (this->inflection_point.estimated) { #> if (this->inflection_point.is_random_effect) { #> d2->RegisterRandomEffect(model2->inflection_point); #> } else { #> d2->RegisterParameter(model2->inflection_point); #> } #> } #> d2->selectivity_models[model2->id]=model2; #> #> #> std::shared_ptr > d3 = #> fims_info::Information::GetInstance(); #> #> std::shared_ptr > model3 = #> std::make_shared >(); #> #> #> model3->id = this->id; #> model3->slope= this->slope.value; #> if (this->slope.estimated) { #> if (this->slope.is_random_effect) { #> d3->RegisterRandomEffect(model3->slope); #> } else { #> d3->RegisterParameter(model3->slope); #> } #> } #> model3->inflection_point= this->inflection_point.value; #> if (this->inflection_point.estimated) { #> if (this->inflection_point.is_random_effect) { #> d3->RegisterRandomEffect(model3->inflection_point); #> } else { #> d3->RegisterParameter(model3->inflection_point); #> } #> } #> d3->selectivity_models[model3->id]=model3; #> #> #> return true; #> #> #> } #> #> }; #> #> //Add the following to the RCpp module definition: rcpp_interface.hpp #> #> Rcpp::class_(\"LogisticSelectivity\") #> .constructor() #> .method(\"get_id\", &LogisticSelectivityInterface::get_id) #> .method(\"evaluate\", & LogisticSelectivityInterface ::evaluate) #> .field(\"slope\", &LogisticSelectivityInterface::slope) #> .field(\"inflection_point\", &LogisticSelectivityInterface::inflection_point);"},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/data_mile1.html","id":null,"dir":"Reference","previous_headings":"","what":"FIMS input data frame for milestone 1 — data_mile1","title":"FIMS input data frame for milestone 1 — data_mile1","text":"dataset containing information necessary run age-structured stock assessment model FIMS milestone 1. data generated using ASSAMC package written model comparison project.","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/data_mile1.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"FIMS input data frame for milestone 1 — data_mile1","text":"","code":"data_mile1"},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/data_mile1.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"FIMS input data frame for milestone 1 — data_mile1","text":"data frame 1140 observations 8 variables: type type data row contains. name character string providing name information source data collected , e.g., \"Trawl fishery\" age integer age. Entry can NA information pertains multiple ages, e.g., total catch rather catch age-4 fish. datestart,dateend Start end dates data collection period. Format dates using yyyy-mm-dd, can accommodate fake years 0001-01-01. value measurement interest. unit character string specifying units value. uncertainty real value providing measurement uncertainty value.","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/data_mile1.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"FIMS input data frame for milestone 1 — data_mile1","text":"www.github.com/Bai-Li-NOAA/Age_Structured_Stock_Assessment_Model_Comparison","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/m_agecomp-FIMSFrameAge-method.html","id":null,"dir":"Reference","previous_headings":"","what":"For FIMSFrameAge, Get the agecomp data to be used in the model — m_agecomp,FIMSFrameAge-method","title":"For FIMSFrameAge, Get the agecomp data to be used in the model — m_agecomp,FIMSFrameAge-method","text":"FIMSFrameAge, Get agecomp data used model","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/m_agecomp-FIMSFrameAge-method.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"For FIMSFrameAge, Get the agecomp data to be used in the model — m_agecomp,FIMSFrameAge-method","text":"","code":"# S4 method for FIMSFrameAge m_agecomp(x, fleet_name)"},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/m_agecomp-FIMSFrameAge-method.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"For FIMSFrameAge, Get the agecomp data to be used in the model — m_agecomp,FIMSFrameAge-method","text":"x FIMSFrameAge containing agecomp fleet_name name fleet agecomp data","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/m_agecomp.html","id":null,"dir":"Reference","previous_headings":"","what":"Get the agecomp data to be used in the model — m_agecomp","title":"Get the agecomp data to be used in the model — m_agecomp","text":"Get agecomp data used model","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/m_agecomp.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get the agecomp data to be used in the model — m_agecomp","text":"","code":"m_agecomp(x, fleet_name)"},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/m_agecomp.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get the agecomp data to be used in the model — m_agecomp","text":"x object containing agecomp fleet_name name fleet agecomp data","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/m_index-FIMSFrameAge-method.html","id":null,"dir":"Reference","previous_headings":"","what":"Get the index data to be used in the model — m_index,FIMSFrameAge-method","title":"Get the index data to be used in the model — m_index,FIMSFrameAge-method","text":"Get index data used model","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/m_index-FIMSFrameAge-method.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get the index data to be used in the model — m_index,FIMSFrameAge-method","text":"","code":"# S4 method for FIMSFrameAge m_index(x, fleet_name)"},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/m_index-FIMSFrameAge-method.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get the index data to be used in the model — m_index,FIMSFrameAge-method","text":"x FIMSFrameAge object containing index fleet_name name fleet index data","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/m_index.html","id":null,"dir":"Reference","previous_headings":"","what":"Get the index data to be used in the model — m_index","title":"Get the index data to be used in the model — m_index","text":"Get index data used model","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/m_index.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get the index data to be used in the model — m_index","text":"","code":"m_index(x, fleet_name)"},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/m_index.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get the index data to be used in the model — m_index","text":"x object containing index fleet_name name fleet index data","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/m_landings-FIMSFrameAge-method.html","id":null,"dir":"Reference","previous_headings":"","what":"Get the landings data to be used in the model — m_landings,FIMSFrameAge-method","title":"Get the landings data to be used in the model — m_landings,FIMSFrameAge-method","text":"Get landings data used model","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/m_landings-FIMSFrameAge-method.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get the landings data to be used in the model — m_landings,FIMSFrameAge-method","text":"","code":"# S4 method for FIMSFrameAge m_landings(x)"},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/m_landings-FIMSFrameAge-method.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get the landings data to be used in the model — m_landings,FIMSFrameAge-method","text":"x FIMSFrameAge object containing landings","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/m_landings.html","id":null,"dir":"Reference","previous_headings":"","what":"Get the landings data to be used in the model — m_landings","title":"Get the landings data to be used in the model — m_landings","text":"Get landings data used model","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/m_landings.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get the landings data to be used in the model — m_landings","text":"","code":"m_landings(x)"},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/m_landings.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get the landings data to be used in the model — m_landings","text":"x object containing landings","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/mkObj.html","id":null,"dir":"Reference","previous_headings":"","what":"fit: example function demonstrating TMB specific Roxygen comments — mkObj","title":"fit: example function demonstrating TMB specific Roxygen comments — mkObj","text":"fit: example function demonstrating TMB specific Roxygen comments","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/mkObj.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"fit: example function demonstrating TMB specific Roxygen comments — mkObj","text":"","code":"mkObj()"},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/mkObj.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"fit: example function demonstrating TMB specific Roxygen comments — mkObj","text":"TMB object","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/mkObj.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"fit: example function demonstrating TMB specific Roxygen comments — mkObj","text":"","code":"if (FALSE) { mkObj() }"},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/pipe.html","id":null,"dir":"Reference","previous_headings":"","what":"Pipe operator — %>%","title":"Pipe operator — %>%","text":"See magrittr::%>% details.","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/pipe.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Pipe operator — %>%","text":"","code":"lhs %>% rhs"},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/pipe.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Pipe operator — %>%","text":"lhs value magrittr placeholder. rhs function call using magrittr semantics.","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/pipe.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Pipe operator — %>%","text":"result calling rhs(lhs).","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/run_gtest.html","id":null,"dir":"Reference","previous_headings":"","what":"run google test suite — run_gtest","title":"run google test suite — run_gtest","text":"Developer function running google test suite R","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/run_gtest.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"run google test suite — run_gtest","text":"","code":"run_gtest(...)"},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/run_gtest.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"run google test suite — run_gtest","text":"... additional arguments ctest --test-dir build \"--rerun-failed --output--failure\"","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/setup_and_run_gtest.html","id":null,"dir":"Reference","previous_headings":"","what":"setup and run google test suite — setup_and_run_gtest","title":"setup and run google test suite — setup_and_run_gtest","text":"Developer function setup running google test suite R","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/setup_and_run_gtest.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"setup and run google test suite — setup_and_run_gtest","text":"","code":"setup_and_run_gtest(...)"},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/setup_and_run_gtest.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"setup and run google test suite — setup_and_run_gtest","text":"... additional arguments ctest --test-dir build \"--rerun-failed --output--failure\"","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/setup_gtest.html","id":null,"dir":"Reference","previous_headings":"","what":"function for setting up your local environment to run the gtest\nintegration test locally. Intended for developers. — setup_gtest","title":"function for setting up your local environment to run the gtest\nintegration test locally. Intended for developers. — setup_gtest","text":"function setting local environment run gtest integration test locally. Intended developers.","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/setup_gtest.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"function for setting up your local environment to run the gtest\nintegration test locally. Intended for developers. — setup_gtest","text":"","code":"setup_gtest()"},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/setup_gtest.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"function for setting up your local environment to run the gtest\nintegration test locally. Intended for developers. — setup_gtest","text":"","code":"if (FALSE) { setup_gtest() }"},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/use_module.html","id":null,"dir":"Reference","previous_headings":"","what":"use_module — use_module","title":"use_module — use_module","text":"function generate necessary files add new module FIMS system. now, works modules population_dynamics folder FIMS.","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/use_module.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"use_module — use_module","text":"","code":"use_module( path = file.path(\"inst\", \"include\", \"population_dynamics\"), module_name, module_type )"},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/use_module.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"use_module — use_module","text":"path path FIMS project directory inst folder. module_name name module. creates subfolder inst/include name folders functors module_name.hpp. module_type folder inst/include/population_dynamics put files ","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/use_module.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"use_module — use_module","text":"TRUE","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/use_module.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"use_module — use_module","text":"","code":"if (FALSE) { # create a new empirical weight-at-age module (EWAA) under growth use_module(file.path(\"inst\", \"include\", \"population_dynamics\"), module_name = \"ewaa\", module_type = \"growth\" ) }"}] +[{"path":"https://NOAA-FIMS.github.io/FIMS/CONTRIBUTING.html","id":null,"dir":"","previous_headings":"","what":"Contributing to the NOAA Fisheries Integrated Modeling System","title":"Contributing to the NOAA Fisheries Integrated Modeling System","text":"comprehensive set guidelines contributing NOAA’s Fisheries Integrated Modeling System can found NMFS Fish Tools Organization GitHub. mostly guidelines, rules. Use best judgment, feel free propose changes document pull request collaborative workflow document.","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/CONTRIBUTING.html","id":"code-of-conduct","dir":"","previous_headings":"","what":"Code of Conduct","title":"Contributing to the NOAA Fisheries Integrated Modeling System","text":"project everyone participating governed Code Conduct. participating, expected uphold code. Please report unacceptable behavior fims.conduct@noaa.gov.","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/CONTRIBUTING.html","id":"i-dont-want-to-read-this-whole-thing-i-just-have-a-question","dir":"","previous_headings":"","what":"I don’t want to read this whole thing I just have a question!!!","title":"Contributing to the NOAA Fisheries Integrated Modeling System","text":"Note: Please don’t file issue ask question. ’ll get faster results using resources . Please email FIMS maintainer christine.stawitz@noaa.gov question.","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/CONTRIBUTING.html","id":"i-want-to-file-a-bug-or-feature-request","dir":"","previous_headings":"","what":"I want to file a bug or feature request","title":"Contributing to the NOAA Fisheries Integrated Modeling System","text":"Please use issue templates submit Bug Report, Feature Request, Refactor.","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/CONTRIBUTING.html","id":"how-can-i-contribute","dir":"","previous_headings":"","what":"How can I contribute?","title":"Contributing to the NOAA Fisheries Integrated Modeling System","text":"contributions code! Writing documentation, teaching, activities also key parts contributing software, guidelines covered collaborative workflow book. information open source contributions, see Open Source Guide’s Contribute page.","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/articles/fims-demo.html","id":"fisheries-integrated-modeling-system","dir":"Articles","previous_headings":"","what":"Fisheries Integrated Modeling System","title":"Introducing the Fisheries Integrated Modeling System (FIMS)","text":"NOAA Fisheries Integrated Modeling System (FIMS) new modeling framework fisheries modeling. FIMS software system designed architected support next-generation fisheries stock assessment, ecosystem, socioeconomic modeling. ’s important note FIMS model, rather framework creating models. framework made many modules come together create “best model” suites needs end-user. follows demo creating catch--age assessment model using FIMS.","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/articles/fims-demo.html","id":"creating-models-in-fims","dir":"Articles","previous_headings":"","what":"Creating Models in FIMS","title":"Introducing the Fisheries Integrated Modeling System (FIMS)","text":"begin, import FIMS TMB libraries. Calling library(FIMS) automatically loads Rcpp functions modules R environment. function call, clear(), ensures C++ memory previous fims model run cleared .","code":"# automatically loads fims Rcpp module library(FIMS) library(TMB) # clear memory clear()"},{"path":"https://NOAA-FIMS.github.io/FIMS/articles/fims-demo.html","id":"setting-up-data","dir":"Articles","previous_headings":"","what":"Setting up Data","title":"Introducing the Fisheries Integrated Modeling System (FIMS)","text":"Data variable values taken Li et. al. Model Comparison project (github site). See R/data_mile1.R tests/testthat/test-fims-estimation.R details data variable values read FIMS Model Comparison project. First let’s set dimensions model based Model Comparison project:","code":"nyears <- 30 # the number of years which we have data for. nseasons <- 1 # the number of seasons in each year. FIMS currently defaults to 1 ages <- c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12) # age vector. nages <- 12 # the number of age groups."},{"path":"https://NOAA-FIMS.github.io/FIMS/articles/fims-demo.html","id":"preparing-data-using-fimsframe","dir":"Articles","previous_headings":"Setting up Data","what":"Preparing Data using FIMSFrame","title":"Introducing the Fisheries Integrated Modeling System (FIMS)","text":"reading data model using FIMSFrame FIMSFrameAge S4 R classes set R/fimsframe.R fims_frame object contains @data slot holds long data frame catch data fishery index data survey: Using data frame, start setting FIMS data objects. example Model Comparison project sets single fishery fleet age composition catch data single survey age composition data index. Data read FIMS long vectors, regardless original dimension, hence motivation behind long data frames created fimsframe S4 classes.","code":"# use FIMS data frame data(package = \"FIMS\") fims_frame <- FIMSFrame(data_mile1) str(fims_frame) ## Formal class 'FIMSFrame' [package \"FIMS\"] with 5 slots ## ..@ data :'data.frame': 1140 obs. of 8 variables: ## .. ..$ type : chr [1:1140] \"landings\" \"landings\" \"landings\" \"landings\" ... ## .. ..$ name : chr [1:1140] \"fleet1\" \"fleet1\" \"fleet1\" \"fleet1\" ... ## .. ..$ age : int [1:1140] NA NA NA NA NA NA NA NA NA NA ... ## .. ..$ datestart : chr [1:1140] \"0001-01-01\" \"0002-01-01\" \"0003-01-01\" \"0004-01-01\" ... ## .. ..$ dateend : chr [1:1140] \"0001-12-31\" \"0002-12-31\" \"0003-12-31\" \"0004-12-31\" ... ## .. ..$ value : num [1:1140] 160 461 752 997 770 ... ## .. ..$ unit : chr [1:1140] \"mt\" \"mt\" \"mt\" \"mt\" ... ## .. ..$ uncertainty: num [1:1140] 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 ... ## ..@ fleets : num 1 ## ..@ nyrs : int 30 ## ..@ start_year: int 1 ## ..@ end_year : int 30 fims_frame@data %>% dplyr::filter(type == \"landings\") %>% head() ## type name age datestart dateend value unit uncertainty ## 1 landings fleet1 NA 0001-01-01 0001-12-31 160.2363 mt 0.01 ## 2 landings fleet1 NA 0002-01-01 0002-12-31 460.6336 mt 0.01 ## 3 landings fleet1 NA 0003-01-01 0003-12-31 752.1299 mt 0.01 ## 4 landings fleet1 NA 0004-01-01 0004-12-31 996.9872 mt 0.01 ## 5 landings fleet1 NA 0005-01-01 0005-12-31 769.6972 mt 0.01 ## 6 landings fleet1 NA 0006-01-01 0006-12-31 1352.7309 mt 0.01 fims_frame@data %>% dplyr::filter(type == \"index\") %>% head() ## type name age datestart dateend value unit uncertainty ## 1 index survey1 NA 0001-01-01 0001-01-01 0.006795379 0.2 ## 2 index survey1 NA 0002-01-01 0002-01-01 0.006170738 0.2 ## 3 index survey1 NA 0003-01-01 0003-01-01 0.005977854 0.2 ## 4 index survey1 NA 0004-01-01 0004-01-01 0.005907966 0.2 ## 5 index survey1 NA 0005-01-01 0005-01-01 0.007211237 0.2 ## 6 index survey1 NA 0006-01-01 0006-01-01 0.006867264 0.2 age_frame <- FIMS::FIMSFrameAge(data_mile1) # fishery data # This does the same thing as the one line below only # using fims_frame rather than age_frame # fishery_catch <- fims_frame@data %>% # dplyr::filter(type == \"landings\") %>% # .$value fishery_catch <- FIMS::m_landings(age_frame) # This does the same thing as the two lines below only # using fims_frame rather than age_frame # fishery_agecomp <- fims_frame@data %>% # dplyr::filter(type == \"age\") %>% # dplyr::filter(name == \"fleet1\") %>% # .$value fishery_agecomp <- FIMS::m_agecomp(age_frame, \"fleet1\") # survey data survey_index <- FIMS::m_index(age_frame, \"survey1\") # survey agecomp not set up in fimsframe yet survey_agecomp <- FIMS::m_agecomp(age_frame, \"survey1\")"},{"path":"https://NOAA-FIMS.github.io/FIMS/articles/fims-demo.html","id":"creating-modules-in-fims","dir":"Articles","previous_headings":"","what":"Creating Modules in FIMS","title":"Introducing the Fisheries Integrated Modeling System (FIMS)","text":"Now ’ve prepared data, let’s pass FIMS. module FIMS-R interface made S4 objects. S4 objects serve interface R underlining C++ code defines FIMS. Modules instantiated using methods::new() function. can use methods::show() view fields (.e. variables) methods (.e. functions) available given module.","code":""},{"path":[]},{"path":"https://NOAA-FIMS.github.io/FIMS/articles/fims-demo.html","id":"fleet-data","dir":"Articles","previous_headings":"Creating Modules in FIMS > The Fleet Module","what":"Fleet Data","title":"Introducing the Fisheries Integrated Modeling System (FIMS)","text":"fleet required data order evaluate objective function. Currently FIMS fleet module used set fleets surveys. FIMS contains Index module AgeComp module pass data objects fleet module. data modules require dimension added indicate dimensions raw data (e.g. nyears x nages matrix). Given information, FIMS able correctly apply dimension folding model output. Using methods::show() function, can see Index module vector field named index_data AgeComp module vector field names age_comp_data. ’ll create index age composition modules fleet using methods::new() function pass data defined Model Comparison project.","code":"show(Index) ## C++ class 'Index' <0x560c5ba8e000> ## Constructors: ## Index(int) ## ## Fields: ## Rcpp::Vector<14, Rcpp::PreserveStorage> index_data ## ## Methods: ## unsigned int get_id() ## show(AgeComp) ## C++ class 'AgeComp' <0x560c5ba8dea0> ## Constructors: ## AgeComp(int, int) ## ## Fields: ## Rcpp::Vector<14, Rcpp::PreserveStorage> age_comp_data ## ## Methods: ## unsigned int get_id() ## # fleet index data fishing_fleet_index <- methods::new(Index, nyears) # fleet age composition data fishing_fleet_age_comp <- methods::new(AgeComp, nyears, nages) fishing_fleet_index$index_data <- fishery_catch # Effective sampling size is 200 fishing_fleet_age_comp$age_comp_data <- fishery_agecomp * 200"},{"path":"https://NOAA-FIMS.github.io/FIMS/articles/fims-demo.html","id":"fleet-selectivity","dir":"Articles","previous_headings":"Creating Modules in FIMS > The Fleet Module","what":"Fleet Selectivity","title":"Introducing the Fisheries Integrated Modeling System (FIMS)","text":"Now ’ve passed data fishing fleet, need set selectivity module. set selectivity function using LogisticSelectivity module. Themethods::show() function indicates module two parameter fields: inflection_point slope, evaluate() get_id() function. variable Parameter class three additional fields: value, is_random_effect, estimated. Currently, FIMS set run random effects. default value field estimate field currently set FALSE. can use value field input variables defined Model Comparison project.","code":"methods::show(LogisticSelectivity) ## C++ class 'LogisticSelectivity' <0x560c5bd3f210> ## Constructors: ## LogisticSelectivity() ## ## Fields: ## Parameter inflection_point ## Parameter slope ## ## Methods: ## double evaluate(double) ## ## unsigned int get_id() ## fishing_fleet_selectivity <- methods::new(LogisticSelectivity) fishing_fleet_selectivity$inflection_point$value <- 2.0 fishing_fleet_selectivity$inflection_point$is_random_effect <- FALSE fishing_fleet_selectivity$inflection_point$estimated <- TRUE fishing_fleet_selectivity$slope$value <- 1.0 fishing_fleet_selectivity$slope$is_random_effect <- FALSE fishing_fleet_selectivity$slope$estimated <- TRUE"},{"path":"https://NOAA-FIMS.github.io/FIMS/articles/fims-demo.html","id":"creating-the-fleet-object","dir":"Articles","previous_headings":"Creating Modules in FIMS > The Fleet Module","what":"Creating the Fleet Object","title":"Introducing the Fisheries Integrated Modeling System (FIMS)","text":"Now ’ve created everything fleet needs, lets create actual fleet object. First let’s run methods::show(Fleet) see fields methods available R. can see five boolean flags: estimate_F, estimate_q, is_survey, random_F, random_q. two vectors, log_Fmort log_obs_error, double, log_q. two integer fields number ages years. Additionally, five Methods: SetAgeCompLikelihood, SetIndexLikelihood, SetObservedAgeCompData, SetObservedIndexData, setSelectivity. last three used link AgeComp, Index, Selectivity modules defined fleet module defined .","code":"show(Fleet) ## C++ class 'Fleet' <0x560c5ba8dd40> ## Constructors: ## Fleet() ## ## Fields: ## bool estimate_F ## bool estimate_obs_error ## bool estimate_q ## bool is_survey ## Rcpp::Vector<14, Rcpp::PreserveStorage> log_Fmort ## Rcpp::Vector<14, Rcpp::PreserveStorage> log_obs_error ## double log_q ## int nages ## int nyears ## bool random_F ## bool random_q ## ## Methods: ## void SetAgeCompLikelihood(int) ## ## void SetIndexLikelihood(int) ## ## void SetObservedAgeCompData(int) ## ## void SetObservedIndexData(int) ## ## void SetSelectivity(int) ## # Create fleet module fishing_fleet <- methods::new(Fleet) # Set nyears and nages fishing_fleet$nages <- nages fishing_fleet$nyears <- nyears # Set values for log_Fmort fishing_fleet$log_Fmort <- log(c( 0.009459165, 0.02728886, 0.04506364, 0.06101782, 0.04860075, 0.08742055, 0.0884472, 0.1866079, 0.109009, 0.1327043, 0.1506155, 0.161243, 0.1166402, 0.1693461, 0.1801919, 0.1612405, 0.3145732, 0.2572476, 0.2548873, 0.2514621, 0.3491014, 0.2541077, 0.4184781, 0.3457212, 0.3436855, 0.3141712, 0.3080268, 0.4317453, 0.3280309, 0.4996754 )) # Turn on estimation for F fishing_fleet$estimate_F <- TRUE fishing_fleet$random_F <- FALSE # Set value for log_q fishing_fleet$log_q <- log(1.0) fishing_fleet$estimate_q <- FALSE fishing_fleet$random_q <- FALSE fishing_fleet$log_obs_error <- rep(log(sqrt(log(0.01^2 + 1))), nyears) fishing_fleet$estimate_obs_error <- FALSE # Next two lines not currently used by FIMS fishing_fleet$SetAgeCompLikelihood(1) fishing_fleet$SetIndexLikelihood(1) # Set Index, AgeComp, and Selectivity using the IDs from the modules defined above fishing_fleet$SetObservedIndexData(fishing_fleet_index$get_id()) fishing_fleet$SetObservedAgeCompData(fishing_fleet_age_comp$get_id()) fishing_fleet$SetSelectivity(fishing_fleet_selectivity$get_id())"},{"path":"https://NOAA-FIMS.github.io/FIMS/articles/fims-demo.html","id":"the-survey-module","dir":"Articles","previous_headings":"Creating Modules in FIMS","what":"The Survey Module","title":"Introducing the Fisheries Integrated Modeling System (FIMS)","text":"now repeat steps Fleet set Survey. survey object essentially fleet object catchability (q) variable.","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/articles/fims-demo.html","id":"survey-data","dir":"Articles","previous_headings":"Creating Modules in FIMS > The Survey Module","what":"Survey Data","title":"Introducing the Fisheries Integrated Modeling System (FIMS)","text":"","code":"# fleet index data survey_fleet_index <- methods::new(Index, nyears) # survey age composition data survey_fleet_age_comp <- methods::new(AgeComp, nyears, nages) survey_fleet_index$index_data <- survey_index # Effective sampling size is 200 survey_fleet_age_comp$age_comp_data <- survey_agecomp * 200"},{"path":"https://NOAA-FIMS.github.io/FIMS/articles/fims-demo.html","id":"survey-selectivity","dir":"Articles","previous_headings":"Creating Modules in FIMS > The Survey Module","what":"Survey Selectivity","title":"Introducing the Fisheries Integrated Modeling System (FIMS)","text":"","code":"survey_fleet_selectivity <- new(LogisticSelectivity) survey_fleet_selectivity$inflection_point$value <- 1.5 survey_fleet_selectivity$inflection_point$is_random_effect <- FALSE survey_fleet_selectivity$inflection_point$estimated <- TRUE survey_fleet_selectivity$slope$value <- 2.0 survey_fleet_selectivity$slope$is_random_effect <- FALSE survey_fleet_selectivity$slope$estimated <- TRUE"},{"path":"https://NOAA-FIMS.github.io/FIMS/articles/fims-demo.html","id":"creating-the-survey-object","dir":"Articles","previous_headings":"Creating Modules in FIMS > The Survey Module","what":"Creating the Survey Object","title":"Introducing the Fisheries Integrated Modeling System (FIMS)","text":"","code":"survey_fleet <- methods::new(Fleet) survey_fleet$is_survey <- TRUE survey_fleet$nages <- nages survey_fleet$nyears <- nyears survey_fleet$estimate_F <- FALSE survey_fleet$random_F <- FALSE survey_fleet$log_q <- log(3.315143e-07) survey_fleet$estimate_q <- TRUE survey_fleet$random_q <- FALSE # sd = sqrt(log(cv^2 + 1)), sd is log transformed survey_fleet$log_obs_error <- rep(log(sqrt(log(0.2^2 + 1))), nyears) survey_fleet$estimate_obs_error <- FALSE survey_fleet$SetAgeCompLikelihood(1) survey_fleet$SetIndexLikelihood(1) survey_fleet$SetSelectivity(survey_fleet_selectivity$get_id()) survey_fleet$SetObservedIndexData(survey_fleet_index$get_id()) survey_fleet$SetObservedAgeCompData(survey_fleet_age_comp$get_id())"},{"path":"https://NOAA-FIMS.github.io/FIMS/articles/fims-demo.html","id":"creating-a-population","dir":"Articles","previous_headings":"Creating Modules in FIMS","what":"Creating a Population","title":"Introducing the Fisheries Integrated Modeling System (FIMS)","text":"final step set population module. , first need set component population (e.g. recruitment, growth, etc.).","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/articles/fims-demo.html","id":"recruitment","dir":"Articles","previous_headings":"Creating Modules in FIMS > Creating a Population","what":"Recruitment","title":"Introducing the Fisheries Integrated Modeling System (FIMS)","text":"’ll use Beverton Holt recruitment module. first instantiate module using methods::new() function. can use methods::show() view fields (.e. variables) methods (.e. functions) available BevertonHoltRecruitment module. three parameters need set-: log_sigma_recruit, log_rzero, logit_steep. also need set log recruitment deviations. FIMS recruitment modules boolean, estimate_log_devs specify whether log deviations estimated; vector, log_devs set log deviation values.","code":"# Recruitment recruitment <- methods::new(BevertonHoltRecruitment) methods::show(BevertonHoltRecruitment) ## C++ class 'BevertonHoltRecruitment' <0x560c5ba8dbe0> ## Constructors: ## BevertonHoltRecruitment() ## ## Fields: ## bool estimate_log_devs ## Rcpp::Vector<14, Rcpp::PreserveStorage> log_devs ## Parameter log_rzero ## Parameter log_sigma_recruit ## Parameter logit_steep ## ## Methods: ## double evaluate(double, double) ## ## double evaluate_nll() ## ## unsigned int get_id() ## recruitment$log_sigma_recruit$value <- log(0.4) recruitment$log_rzero$value <- log(1e+06) recruitment$log_rzero$is_random_effect <- FALSE recruitment$log_rzero$estimated <- TRUE recruitment$logit_steep$value <- -log(1.0 - 0.75) + log(0.75 - 0.2) recruitment$logit_steep$is_random_effect <- FALSE recruitment$logit_steep$estimated <- FALSE recruitment$estimate_log_devs <- FALSE recruitment$log_devs <- c( 0.08904850, 0.43787763, -0.13299042, -0.43251973, 0.64861200, 0.50640852, -0.06958319, 0.30246260, -0.08257384, 0.20740372, 0.15289604, -0.21709207, -0.13320626, 0.11225374, -0.10650836, 0.26877132, 0.24094126, -0.54480751, -0.23680557, -0.58483386, 0.30122785, 0.21930545, -0.22281699, -0.51358369, 0.15740234, -0.53988240, -0.19556523, 0.20094360, 0.37248740, -0.07163145 )"},{"path":"https://NOAA-FIMS.github.io/FIMS/articles/fims-demo.html","id":"growth","dir":"Articles","previous_headings":"Creating Modules in FIMS > Creating a Population","what":"Growth","title":"Introducing the Fisheries Integrated Modeling System (FIMS)","text":"Now, ’ll define growth module population using empirical weight age model.","code":"# Growth ewaa_growth <- methods::new(EWAAgrowth) ewaa_growth$ages <- ages ewaa_growth$weights <- c( 0.0005306555, 0.0011963283, 0.0020582654, 0.0030349873, 0.0040552124, 0.0050646975, 0.0060262262, 0.0069169206, 0.0077248909, 0.0084461128, 0.0090818532, 0.0096366950 )"},{"path":"https://NOAA-FIMS.github.io/FIMS/articles/fims-demo.html","id":"maturity","dir":"Articles","previous_headings":"Creating Modules in FIMS > Creating a Population","what":"Maturity","title":"Introducing the Fisheries Integrated Modeling System (FIMS)","text":"population also need maturity model. define logistic maturity model. Now life history sub-models defined, lets define actual population. Now need link recruitment, growth, maturity modules set new population module. calling get_id() respective module passing unique ID respective Set function population.","code":"# Maturity maturity <- new(LogisticMaturity) maturity$inflection_point$value <- 2.25 maturity$inflection_point$is_random_effect <- FALSE maturity$inflection_point$estimated <- FALSE maturity$slope$value <- 3 maturity$slope$is_random_effect <- FALSE maturity$slope$estimated <- FALSE # Population population <- new(Population) population$log_M <- rep(log(0.2), nyears * nages) population$estimate_M <- FALSE population$log_init_naa <- log(c( 993947.5, 811707.8, 661434.4, 537804.8, 436664.0, 354303.4, 287397.0, 233100.2, 189054.0, 153328.4, 124353.2, 533681.3 )) population$estimate_init_naa <- TRUE population$nages <- nages population$ages <- ages population$nfleets <- 2 # 1 fleet and 1 survey population$nseasons <- nseasons population$nyears <- nyears population$SetMaturity(maturity$get_id()) population$SetGrowth(ewaa_growth$get_id()) population$SetRecruitment(recruitment$get_id())"},{"path":[]},{"path":"https://NOAA-FIMS.github.io/FIMS/articles/fims-demo.html","id":"creating-the-fims-model-and-making-the-tmb-function","dir":"Articles","previous_headings":"Putting It All Together","what":"Creating the FIMS Model and Making the TMB Function","title":"Introducing the Fisheries Integrated Modeling System (FIMS)","text":"","code":"sucess <- CreateTMBModel() parameters <- list(p = get_fixed()) obj <- MakeADFun(data = list(), parameters, DLL = \"FIMS\", silent = TRUE)"},{"path":"https://NOAA-FIMS.github.io/FIMS/articles/fims-demo.html","id":"fitting-the-model","dir":"Articles","previous_headings":"","what":"Fitting the Model","title":"Introducing the Fisheries Integrated Modeling System (FIMS)","text":"","code":"opt <- nlminb(obj$par, obj$fn, obj$gr, control = list(eval.max = 800, iter.max = 800) ) # , method = \"BFGS\", # control = list(maxit=1000000, reltol = 1e-15)) print(opt) ## $par ## p p p p p p ## 1.9456129 1.0764466 -4.6411971 -3.5795404 -3.0704163 -2.7617492 ## p p p p p p ## -2.9960582 -2.3981740 -2.3821374 -1.6271687 -2.1804423 -1.9816417 ## p p p p p p ## -1.8755261 -1.8164944 -2.1337980 -1.7742776 -1.7263032 -1.8263013 ## p p p p p p ## -1.1621941 -1.3539843 -1.3713984 -1.4168990 -1.1117784 -1.4087689 ## p p p p p p ## -0.8779831 -1.0650765 -1.0952198 -1.2164856 -1.2289848 -0.8988722 ## p p p p p p ## -1.1404625 -0.6719076 1.4735198 1.9285393 -14.8994794 13.8145611 ## p p p p p p ## 13.6979439 13.6164047 13.4500426 13.1536667 12.9040692 12.6810089 ## p p p p p p ## 12.6197621 12.2562556 12.2909497 11.7643992 11.9287247 13.0970927 ## ## $objective ## [1] 2549.36 ## ## $convergence ## [1] 0 ## ## $iterations ## [1] 288 ## ## $evaluations ## function gradient ## 430 289 ## ## $message ## [1] \"relative convergence (4)\""},{"path":"https://NOAA-FIMS.github.io/FIMS/articles/fims-demo.html","id":"tmb-reporting","dir":"Articles","previous_headings":"Fitting the Model","what":"TMB Reporting","title":"Introducing the Fisheries Integrated Modeling System (FIMS)","text":"","code":"sdr <- TMB::sdreport(obj) sdr_fixed <- summary(sdr, \"fixed\") report <- obj$report() print(sdr_fixed) ## Estimate Std. Error ## p 1.9456129 0.071966634 ## p 1.0764466 0.069197682 ## p -4.6411971 0.038909771 ## p -3.5795404 0.036845719 ## p -3.0704163 0.035250950 ## p -2.7617492 0.033941502 ## p -2.9960582 0.032200700 ## p -2.3981740 0.030170559 ## p -2.3821374 0.028825986 ## p -1.6271687 0.028535969 ## p -2.1804423 0.027910999 ## p -1.9816417 0.026371300 ## p -1.8755261 0.025391268 ## p -1.8164944 0.024857446 ## p -2.1337980 0.024389822 ## p -1.7742776 0.023760514 ## p -1.7263032 0.023576285 ## p -1.8263013 0.023767094 ## p -1.1621941 0.024809809 ## p -1.3539843 0.026966929 ## p -1.3713984 0.028532076 ## p -1.4168990 0.029257526 ## p -1.1117784 0.030581337 ## p -1.4087689 0.033023134 ## p -0.8779831 0.037061824 ## p -1.0650765 0.042655996 ## p -1.0952198 0.046308769 ## p -1.2164856 0.049976933 ## p -1.2289848 0.054372837 ## p -0.8988722 0.061786784 ## p -1.1404625 0.070406295 ## p -0.6719076 0.081806816 ## p 1.4735198 0.045085492 ## p 1.9285393 0.137977965 ## p -14.8994794 0.043505494 ## p 13.8145611 0.008160616 ## p 13.6979439 0.061661386 ## p 13.6164047 0.060381361 ## p 13.4500426 0.064298057 ## p 13.1536667 0.073968712 ## p 12.9040692 0.084172554 ## p 12.6810089 0.095329204 ## p 12.6197621 0.100862827 ## p 12.2562556 0.126933234 ## p 12.2909497 0.134810441 ## p 11.7643992 0.205483476 ## p 11.9287247 0.238296215 ## p 13.0970927 0.103888032"},{"path":"https://NOAA-FIMS.github.io/FIMS/articles/fims-demo.html","id":"plotting-results","dir":"Articles","previous_headings":"","what":"Plotting Results","title":"Introducing the Fisheries Integrated Modeling System (FIMS)","text":"","code":"library(ggplot2) index_results <- data.frame( observed = survey_fleet_index$index_data, expected = report$exp_index[[2]] ) print(index_results) ## observed expected ## 1 0.006795379 0.006473109 ## 2 0.006170738 0.006483166 ## 3 0.005977854 0.006421357 ## 4 0.005907966 0.006343226 ## 5 0.007211237 0.006153200 ## 6 0.006867264 0.006013449 ## 7 0.006329387 0.005818650 ## 8 0.006137000 0.005766681 ## 9 0.005279601 0.005207606 ## 10 0.005666829 0.005067875 ## 11 0.004806935 0.004812707 ## 12 0.004374876 0.004529218 ## 13 0.003992211 0.004255846 ## 14 0.004188884 0.004129084 ## 15 0.003711145 0.003811198 ## 16 0.003818704 0.003537988 ## 17 0.002878658 0.003383185 ## 18 0.002936660 0.002920954 ## 19 0.002972886 0.002722717 ## 20 0.002484963 0.002508789 ## 21 0.001983795 0.002289329 ## 22 0.001738507 0.001953053 ## 23 0.002122178 0.001907207 ## 24 0.001617189 0.001707296 ## 25 0.001745169 0.001606312 ## 26 0.001414111 0.001487141 ## 27 0.001350571 0.001444139 ## 28 0.001323396 0.001395934 ## 29 0.001069791 0.001241003 ## 30 0.001459411 0.001271027 ggplot(index_results, aes(x = 1:nyears, y = observed)) + geom_point() + xlab(\"Year\") + ylab(\"Index\") + geom_line(aes(x = 1:nyears, y = expected), color = \"blue\") + theme_bw() catch_results <- data.frame( observed = fishing_fleet_index$index_data, expected = report$exp_index[[1]] ) print(catch_results) ## observed expected ## 1 160.2363 160.1976 ## 2 460.6336 460.4676 ## 3 752.1299 751.8077 ## 4 996.9872 996.9747 ## 5 769.6972 769.4465 ## 6 1352.7309 1351.2565 ## 7 1317.7236 1316.7295 ## 8 2626.0240 2621.9449 ## 9 1415.1162 1414.7087 ## 10 1666.0168 1665.1475 ## 11 1751.8060 1750.4163 ## 12 1739.5435 1738.9201 ## 13 1208.5391 1208.8006 ## 14 1647.6643 1647.3999 ## 15 1593.6254 1593.8703 ## 16 1343.2277 1342.6976 ## 17 2337.0098 2330.7339 ## 18 1685.7172 1685.4265 ## 19 1529.8325 1530.5588 ## 20 1359.5044 1363.3007 ## 21 1637.5099 1638.6243 ## 22 1081.9126 1080.3953 ## 23 1648.7687 1646.4232 ## 24 1230.1199 1233.1485 ## 25 1133.8784 1133.5282 ## 26 956.5872 958.0254 ## 27 911.0781 913.1839 ## 28 1172.4887 1174.4841 ## 29 852.1934 852.0467 ## 30 1278.3228 1278.1371 ggplot(catch_results, aes(x = 1:nyears, y = observed)) + geom_point() + xlab(\"Year\") + ylab(\"Index\") + geom_line(aes(x = 1:nyears, y = expected), color = \"blue\") + theme_bw()"},{"path":"https://NOAA-FIMS.github.io/FIMS/articles/fims-demo.html","id":"clear-c-objects-from-memory","dir":"Articles","previous_headings":"","what":"Clear C++ objects from memory","title":"Introducing the Fisheries Integrated Modeling System (FIMS)","text":"","code":"clear()"},{"path":"https://NOAA-FIMS.github.io/FIMS/articles/fims-path-maturity.html","id":"setting-up-a-module-in-r","dir":"Articles","previous_headings":"","what":"Setting up a module in R","title":"FIMS Path: Maturity","text":"’ll start R. first step retrieve FIMS module, create new maturity module inside FIMS, populate maturity module parameter values. , need create set population link maturity module population: FIMS sets objects stored memory, simply running rm(Fims), won’t free memory back . function can run clear memory: Also restarting closing R session free memory.","code":"# load FIMS library(FIMS) # Create a new maturity model maturity <- new(LogisticMaturity) # Populate the maturity module with parameter values. maturity$inflection_point$value <- 10 maturity$inflection_point$is_random_effect <- FALSE maturity$inflection_point$estimated <- FALSE maturity$slope$value <- 0.2 maturity$slope$is_random_effect <- FALSE maturity$slope$estimated <- FALSE population <- new(Population) # set up population specific parameters (other modules) # ... # set maturity for the population - will throw error until PR #363 is merged into main population$SetMaturity(maturity$get_id()) # Clear C++ memory clear() # Clear R memory rm(Fims) rm(maturity) rm(population)"},{"path":"https://NOAA-FIMS.github.io/FIMS/articles/fims-path-maturity.html","id":"the-rcpp-interface","dir":"Articles","previous_headings":"","what":"The Rcpp Interface","title":"FIMS Path: Maturity","text":"fields specific maturity module accessible R defined rcpp_interface.hpp file directory inst/include/interface/rcpp: code shows two maturity module-specific fields (.e., parameters), inflection_point slope, two maturity module-specific methods (.e., functions), get_id evaluate. Defined methods functions can called R. can access fields methods R using show(Fims) function. maturity module’s get_id method returns unique ID specific module. creating new module R, users can access module using name quotes Rcpp::class, LogisticMaturity module references maturity rcpp class, LogisticMaturityInterface defined rcpp_maturity.hpp directory inst/include/interface/rcpp/rcpp_objects. rcpp_maturity.hpp file consists MaturityInterfaceBase class LogisticMaturityInterface class, former parent class latter child class: typically reference child class R specify formulation maturity wish use specific model run FIMS. particular example, using logistic form maturity. Rcpp interface classes FIMS define parameters (e.g., inflection_point, slope) using Parameter class defined rcpp_interface_base.hpp directory inst/include/interface/rcpp/rcpp_objects: fields Parameter class accessible R defined rcpp_interface.hpp file directory inst/include/interface/rcpp: field (.e., parameter) maturity (.e., maturity module defined R) therefore inherit five fields defined Parameter class: value, min, max, is_random_effect, estimated.","code":"Rcpp::class_(\"LogisticMaturity\") .constructor() .field(\"inflection_point\", &LogisticMaturityInterface::inflection_point) .field(\"slope\", &LogisticMaturityInterface::slope) .method(\"get_id\", &LogisticMaturityInterface::get_id) .method(\"evaluate\", &LogisticMaturityInterface::evaluate); maturity <- new(LogisticMaturity) class MaturityInterfaceBase : public FIMSRcppInterfaceBase { public: static uint32_t id_g; /**< static id of the recruitment interface base*/ uint32_t id; /**< id of the recruitment interface base */ ... } class LogisticMaturityInterface : public MaturityInterfaceBase { public: Parameter inflection_point; /**< the index value at which the response reaches .5 */ Parameter slope; /**< the width of the curve at the inflection_point */ ... } class Parameter { public: double value; /**< initial value of the parameter*/ //std::numeric_limits::min() returns a very large negative number double min = std::numeric_limits::min(); /**< min value of the parameter*/ //std::numeric_limits::max() returns a very large positive number double max = std::numeric_limits::max(); /**< max value of the parameter*/ bool is_random_effect = false; /**< Is the parameter a random effect parameter? Default value is false.*/ bool estimated = false; /**< Is the parameter estimated? Default value is false.*/ ... } Rcpp::class_(\"Parameter\") .constructor() .constructor() .constructor() .field(\"value\", &Parameter::value) .field(\"min\", &Parameter::min) .field(\"max\", &Parameter::max) .field(\"is_random_effect\", &Parameter::is_random_effect) .field(\"estimated\", &Parameter::estimated);"},{"path":[]},{"path":"https://NOAA-FIMS.github.io/FIMS/articles/fims-path-maturity.html","id":"what-is-the-fims-namespace","dir":"Articles","previous_headings":"Linking the Rcpp interface to the fims namespace.","what":"What is the fims namespace?","title":"FIMS Path: Maturity","text":"namespace C++ similar library R. core FIMS within fims namespace convenient way differentiate part C++ code base portable, .e., independent statistical platform, part codebase depends platforms outside base C++ (e.g., Rcpp, R, TMB). code written within: considered part fims namespace. C++ classes written within fims namespace can accessed within C++ code base using fims_popdy::. exceptions TMB specific code referenced within fims namespace. cases, code written within #ifdef TMB_MODEL wrapper, means code defined TMB used. Given addition new platform, eg. stan, new wrapper added define platform specific code sections. example, definition data types interface.hpp directory inst/include/interface always platform dependent platform specific requirements data types defined. Whenever new platform added FIMS, need set platform specific data type definitions:","code":"namespace fims{ } namespace fims { #ifdef TMB_MODEL /** * @brief fims::ModelTraits class that contains the DataVector * and ParameterVector types. */ template struct fims::ModelTraits { typedef typename CppAD::vector DataVector; /**< This is a vector of the data that is differentiable */ typedef typename CppAD::vector ParameterVector; /**< This is a vector of the parameters that is differentiable */ typedef typename tmbutils::vector EigenVector; /**< This is a vector as defined in TMB's namespace Eigen */ }; #endif /* TMB_MODEL */ } // namespace fims //not developed yet #ifdef STAN_MODEL //stan specific definitions go here #endif"},{"path":"https://NOAA-FIMS.github.io/FIMS/articles/fims-path-maturity.html","id":"getting-back-to-the-maturity-example","dir":"Articles","previous_headings":"Linking the Rcpp interface to the fims namespace.","what":"Getting back to the maturity example…","title":"FIMS Path: Maturity","text":"Rcpp interface object includes add_to_fims_tmb() function. two shared pointers set within function, one link Rcpp interface object (e.g., LogisticMaturityInterface) Information class fims namespace defined information.hpp directory inst/include/common one link matching class fims namespace. maturity example, LogisticMaturity class fims namespace defined logistic.hpp directory inst/include/population_dynamics/maturity/functors. Within rcpp_maturity.hpp file, can link fims_info::Information class order register maturity parameters specify whether random effects. setting two pointers interface: d0 points information, lm0, points logistic maturity module. Linking fims_popdy::LogisticMaturity class allows us link values input R values used model calculation: can also link two pointers together fims_info::Information class links fims_popdy::LogisticMaturity, details later. \\(\\color{#c55a11}{\\text{`add_to_fims_tmb()`}}\\) function repeats code four times track estimated value parameters along first, second, third derivatives.","code":"//file: rcpp_maturity.hpp //d0 is a shared pointer that points to fims_info::Information std::shared_ptr > d0 = fims_info::Information::GetInstance(); if (this->inflection_point.estimated) { if (this->inflection_point.is_random_effect) { /* if inflection_point is estimated and a random effect, the inflection_point value from LogisticMaturityInterface (lm0->inflection_point) is passed to the Information member function RegisterRandomEffect */ d0->RegisterRandomEffect(lm0->inflection_point); } else { /* if inflection_point is estimated and not a random effect, the inflection_point value from LogisticMaturityInterface (lm0->inflection_point) is passed to the Information member function RegisterParameter */ d0->RegisterParameter(lm0->inflection_point); } } //file: rcpp_maturity.hpp //lm0 is a shared pointer that points to fims_popdy::LogisticMaturity std::shared_ptr > lm0 = std::make_shared >(); /* the inflection_point value from LogisticMaturity (lm0->inflection_point) equals the inflection_point value from LogisticMaturityInterface (this->inflection_point.value) */ lm0->inflection_point = this->inflection_point.value; //file: rcpp_maturity.hpp /* the maturity_models pointer from Information that matches the id of the fims_popdy::LogisticMaturity class is equal to the pointer to fims_popdy::LogisticMaturity */ d0->maturity_models[lm0->id] = lm0;"},{"path":"https://NOAA-FIMS.github.io/FIMS/articles/fims-path-maturity.html","id":"inside-the-fims_popdylogisticmaturity-class","dir":"Articles","previous_headings":"","what":"Inside the fims_popdy::LogisticMaturity class","title":"FIMS Path: Maturity","text":"LogisticMaturity class fims namespace defined logistic.hpp directory inst/include/population_dynamics/maturity/functors evaluate method (.e., function) takes input, x returns output logistic function (defined fims_math.hpp directory inst/include/common) using class member inflection_point slope values.","code":"namespace fims_popdy { /** * @brief LogisticMaturity class that returns the logistic function value * from fims_math. */ template struct LogisticMaturity : public MaturityBase { Type inflection_point; /**< 50% quantile of the value of the quantity of interest (x); e.g., age at which 50% of the fish are mature */ Type slope; /**() {} /** * @brief Method of the logistic maturity class that implements the * logistic function from FIMS math. * * @param x The independent variable in the logistic function (e.g., age or * size at maturity). */ virtual const Type evaluate(const Type& x) { return fims_math::logistic(inflection_point, slope, x); } }; } // namespace fims"},{"path":"https://NOAA-FIMS.github.io/FIMS/articles/fims-path-maturity.html","id":"calling-maturity-from-population","dir":"Articles","previous_headings":"","what":"Calling maturity from population","title":"FIMS Path: Maturity","text":"Population class defined population.hpp directory inst/include/population_dynamics/population biological calculations happen, producing expected values used likelihood equations derived values important management (e.g., spawning biomass). evaluate maturity within Population class, first need set shared pointer, linking maturity module population. maturity_id set R using SetMaturity() method PopulationInterface class: Notice population default declares pointer type MaturityBase (parent class), specific maturity class using example, LogisticMaturity (child class). MaturityBase evaluate method input arguments match inputs child class: evaluate function virtual C++ function, means function can overwritten functions name child class. structure keeps maturity module population generic. don’t need conditional statements loop possible maturity formulations within population. need add new child maturity class Rcpp interface can automatically call population. trade-. creating nested hierarchical structure makes code base harder read. exchange, ’re creating code lower cyclomatic complexity, ever one independent path user maturity->evaluate() call population, regardless many maturity functions added FIMS. Code lower cyclomatic complexity easier test, maintain, extend. ’ve set shared pointer, can access maturity within population:","code":"//file: inst/include/population_dynamics/population/population.hpp // maturity is a shared pointer to MaturityBase int maturity_id = -999; /**< id of maturity model object*/ std::shared_ptr> maturity; /**< shared pointer to maturity module */ population$SetMaturity(maturity$get_id()) //file: inst/include/population_dynamics/maturity/functors/maturity_base.hpp namespace fims_popdy { /** @brief Base class for all maturity functors. * * @tparam TypeThe type of the maturity functor. */ template struct MaturityBase : public fims_model_object::FIMSObject { // id_g is the ID of the instance of the MaturityBase class. // this is like a memory tracker. // Assigning each one its own ID is a way to keep track of // all the instances of the MaturityBase class. static uint32_t id_g; /**< The ID of the instance of the MaturityBase class */ /** @brief Constructor. */ MaturityBase() { // increment id of the singleton maturity class this->id = MaturityBase::id_g++; } /** * @brief Calculates the maturity. * @param x The independent variable in the maturity function (e.g., logistic * maturity at age or size). */ virtual const Type evaluate(const Type& x) = 0; }; //file: inst/include/population_dynamics/population/population.hpp /** * @brief Calculates expected proportion of individuals mature at a selected * age * * @param i_age_year dimension folded index for age and year * @param age the age of maturity */ void CalculateMaturityAA(size_t i_age_year, size_t age) { // this->maturity is pointing to the maturity module, which has // an evaluate function. -> can be nested. this->proportion_mature_at_age[i_age_year] = this->maturity->evaluate(ages[age]); }"},{"path":"https://NOAA-FIMS.github.io/FIMS/articles/fims-path-maturity.html","id":"linking-everything-together","dir":"Articles","previous_headings":"","what":"Linking everything together","title":"FIMS Path: Maturity","text":"material demonstrates values passed R get propagated population.hpp, used biologically relevant calculations. , however, relies population referencing correct child class (eg. LogisticMaturity) even though calls parent class (MaturityBase). defined maturity_id population specific logistic maturity module wanted use, population$SetMaturity(maturity$get_id()), still need connect ID actual module memory. information managed FIMS Information class information.hpp directory inst/include/common. Information class sets number C++ maps (container key value mapped value - think named lists R) key unique ID module mapped value shared pointer module. C++ std::maps iterator member stepping elements map. iterator also declared Information class can loop unique maturity modules called FIMS. currently one, FIMS gets extended include multiple populations, unique maturity module population subset populations. Next, let’s revisit line code written Rcpp LogisticMaturityInterface class rcpp_maturity.hpp directory inst/include/interface/rcpp/rcpp_objects , setting maturity_models pointer Information equal lm0 pointer LogisticMaturity module Now need pass pointer maturity pointer population population->maturity points LogisticMaturity module instead MaturityBase. First set map Information points Population. loop populations create new shared pointer, p, reference individual population interest. code chunk, (*) refers single population populations map. second element map pointer, p = (*).second means setting pointer single population equal pointer populations map. Within population loop, link maturity pointer population equal maturity pointer information, passing information want use LogisticMaturity class: , (*) referring maturity_models map information (*).second refers second element map, pointer maturity module.","code":"//file: inst/include/common/information.hpp /* uint32_t is an unsigned integer (always positive) The first component of the map is a uint32_t which will be used to hold the ID. The second component of the map is the shared pointer, maturity_models, that points to fims_popdy::MaturityBase */ std::map > > maturity_models; /** > >::iterator maturity_models_iterator; //file: rcpp_maturity.hpp /* the maturity_models pointer from Information that matches the id of the fims_popdy::LogisticMaturity class is equal to the pointer to fims_popdy::LogisticMaturity */ d0->maturity_models[lm0->id] = lm0; //file: inst/include/common/information.hpp std::map > > populations; /** > >::iterator population_iterator; /**< iterator for population objects>*/ //file: inst/include/common/information.hpp for (population_iterator it = this->populations.begin(); it != this->populations.end(); ++it) { std::shared_ptr > p = (*it).second; ... //file: inst/include/common/information.hpp // set maturity if (p->maturity_id != -999) { uint32_t maturity_uint = static_cast(p->maturity_id); maturity_models_iterator it = this->maturity_models.find( maturity_uint); // >maturity_models is specified in // information.hpp and used in rcpp if (it != this->maturity_models.end()) { //p->maturity is the maturity pointer in population p->maturity = //(*it).second is the maturity pointer in information (*it).second; // >maturity defined in population.hpp }"},{"path":"https://NOAA-FIMS.github.io/FIMS/articles/fims-path-maturity.html","id":"conceptualizing-this-path-with-r","dir":"Articles","previous_headings":"","what":"Conceptualizing this path with R","title":"FIMS Path: Maturity","text":"optional exercise benefit thinking structure C++ code seeing corollary R. Let’s think writing something similar R using lists three populations two maturity functions. R code section corresponds C++ code taken FIMS. FIMS sections commented help distinguish two code sets. idea link happening FIMS language ’re bit familiar . Example Case: Let’s set 3 populations first two mirrored logistic maturity function third different maturity function. third function different function together logistic function different parameter set. example, ’ll use logistic function different parameter set. can think population_modules maturity_modules instantiated C++ classes stored computer’s memory. R code chunk comparable following FIMS, sets modules R: Next assign maturity used population using IDs R code chunk comparable following FIMS, sets IDs R: Now let’s review happening Information. ’ll start setting empty list R. FIMS, Information class objects, population maturity, C++ maps. first element map ID, second element map pointer Population Maturity class: can link pointers information respective module: FIMS, definitions happen passing information rcpp interface FIMS Information. can loop population module defined information set maturity ’re getting user specified Rcpp interface back Population class used run calculations model. line code following chunk, corresponding C++ code FIMS directly commented . R, code sets intermediate value, p. update maturity p equal correct maturity module, p$pointer$maturity <- information$maturity[[newit]][[2]], code passes back population_modules, population_modules[[]][2]$maturity <- p$pointer$maturity. context, population_modules population class held memory used run calculations. deeper level abstraction happening C++ FIMS, p population module stored memory. equivalent line code population_modules[[]][2]$maturity <- p$pointer$maturity isn’t needed FIMS update p, also updating population class held memory used run calculations.","code":"# For the population module, there are additional parameters # we are going to ignore here population_modules <- list( \"Pop 1\" = list( id = 1, maturity = \"MaturityBase\" ), \"Pop 2\" = list( id = 2, maturity = \"MaturityBase\" ), \"Pop 3\" = list( id = 3, maturity = \"MaturityBase\" ) ) maturity_modules <- list( \"Logistic Maturity\" = list(id = 1, inflection_point = 10, slope = 0.2), \"Some Other Maturity\" = list(id = 2, inflection_point = 8, slope = 0.3) ) # maturity1 <- new(LogisticMaturity) # maturity1$inflection_point$value <- 10 # maturity1$slope$value <- 0.2 # maturity2 <- new(LogisticMaturity) # maturity2$inflection_point$value <- 8 # maturity2$slope$value <- 0.3 # population1 <- new(Population) # population2 <- new(Population) # population3 <- new(Population) population_modules[[1]]$maturity_id <- maturity_modules[[1]]$id population_modules[[2]]$maturity_id <- maturity_modules[[1]]$id population_modules[[3]]$maturity_id <- maturity_modules[[2]]$id # population1$SetMaturity(maturity1$get_id()) # population2$SetMaturity(maturity1$get_id()) # population3$SetMaturity(maturity2$get_id()) information <- list( populations = list(id = NULL, pointer = \"Population\"), maturity = list(id = NULL, pointer = \"MaturityBase\") ) # std::map > > maturity_models; # std::map > > populations; information$populations[[1]] <- list(id = 1, pointer = population_modules[[1]]) information$populations[[2]] <- list(id = 2, pointer = population_modules[[2]]) information$populations[[3]] <- list(id = 3, pointer = population_modules[[3]]) information$maturity[[1]] <- list(id = 1, pointer = maturity_modules[[1]]) information$maturity[[2]] <- list(id = 2, pointer = maturity_modules[[2]]) ## //file: rcpp_maturity.hpp ## d0 is the pointer to information ## lm0 is the pointer to a specific maturity module ## (e.g., lm0 = maturity_modules[[1]]) # d0->maturity_models[lm0->id] = lm0; for (it in 1:length(population_modules)) { # for (population_iterator it = this->populations.begin(); # it != this->populations.end(); ++it) { p <- information$populations[[it]][2] # std::shared_ptr > p = (*it).second; maturity_uint <- p$pointer$maturity_id # uint32_t maturity_uint = static_cast(p->maturity_id); newit <- which(sapply(information$maturity, function(x) x$id) == maturity_uint) # maturity_models_iterator it = this->maturity_models.find(maturity_uint) p$pointer$maturity # MaturityBase p$pointer$maturity <- information$maturity[[newit]][[2]] p$pointer$maturity # LogisticMaturity1 # p->maturity = (*it).second; population_modules[[it]][2]$maturity <- p$pointer$maturity } sapply(population_modules, function(x) x[2]$maturity) #> Pop 1 Pop 2 Pop 3 #> id 1 1 2 #> inflection_point 10 10 8 #> slope 0.2 0.2 0.3"},{"path":"https://NOAA-FIMS.github.io/FIMS/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Christine Stawitz. Author, maintainer. Nathan Vaughan. Author. Howard Townsend. Author. Ian G. Taylor. Author. Matthew Supernaw. Author. Jane Sullivan. Author. Kyle Shertzer. Author. Megumi Oshima. Author. Cole C. Monnahan. Author. Timothy J. Miller. Author. Richard Methot. Author. Patrick Lynch. Author. Bai Li. Author. Huihua Lee. Author. Christopher M. Legault. Author. Kelli F. Johnson. Author. James N. Ianelli. Author. Alan Haynie. Author. Andrea M. Havron. Author. Kathryn L. Doering. Author. Edward J. Dick. Author. Jon Brodziak. Author. Kristan Blackhart. Author. Peter Kuriyama. Author.","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"FIMS Implementation Team. 2022. NOAA-FIMS: NOAA Fisheries Integrated Modeling System. R package version 0.0.0.9000. https://github.com/NOAA-FIMS/FIMS","code":"@Manual{, title = {{NOAA-FIMS}: The NOAA Fisheries Integrated Modeling System}, author = {FIMS Implementation Team}, year = {2022}, url = {https://github.com/NOAA-FIMS/FIMS}, }"},{"path":"https://NOAA-FIMS.github.io/FIMS/index.html","id":"overview","dir":"","previous_headings":"","what":"Fisheries Integrated Modeling System (FIMS)","title":"Fisheries Integrated Modeling System (FIMS)","text":"repository development FIMS. NOAA Fisheries Integrated Modeling System software system designed architected support next-generation fisheries stock assessment, ecosystem, socioeconomic modeling. team experts within NOAA Fisheries designing developing system, advised FIMS Council includes academic, industry, international partners. roles internal external collaborators outlined governance section developer guide. plan operational software system released public 2023. meantime, users developers welcome submit feedback using Github issues. Please use issues collaborative workflow make suggestions developer guide issues FIMS software repo software design development feedback. can follow team discussion .","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"Fisheries Integrated Modeling System (FIMS)","text":"following software required: R version 4.0.0 newer (RStudio version 1.2.5042 newer) remotes R package TMB version 1.8.0 newer (install instructions .)","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/index.html","id":"windows-users","dir":"","previous_headings":"Installation","what":"Windows Users","title":"Fisheries Integrated Modeling System (FIMS)","text":"Rtools4 (available )","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/index.html","id":"fixing-fatal-error","dir":"","previous_headings":"Installation > Windows Users","what":"Fixing Fatal Error","title":"Fisheries Integrated Modeling System (FIMS)","text":"Windows users can expect see derivative following error message R session yet set flags using {withr}. can easily fix running following line local R session. Note call need repeated time open new session. fix work devtools::test() called FIMS re-compiled. call devtools::test() case overwrites local options set withr. Compile FIMS first using devtools::load_all() prior running devtools::test(). fix removes debugger flag -O0 -g automatically inserted certain devtools calls (e.g. devtools::load_all()). Windows developers wanting compile FIMS debugger turned need run script addition manually modifying call PKG_CXXFLAGS Makevars.win file src directory following: turn debugger flag, remove -O1 -g flag:","code":"Fatal error: can't write bytes to section .text of FIMS.o: 'file too big withr::local_options(pkg.build_extra_flags = FALSE) PKG_CXXFLAGS = -DTMB_MODEL -DTMB_EIGEN_DISABLE_WARNINGS -O1 -g PKG_CXXFLAGS = -DTMB_MODEL -DTMB_EIGEN_DISABLE_WARNINGS"},{"path":"https://NOAA-FIMS.github.io/FIMS/index.html","id":"installing-from-r","dir":"","previous_headings":"Installation","what":"Installing from R","title":"Fisheries Integrated Modeling System (FIMS)","text":"","code":"remotes::install_github(\"NOAA-FIMS/FIMS\") library(FIMS)"},{"path":"https://NOAA-FIMS.github.io/FIMS/index.html","id":"getting-help","dir":"","previous_headings":"","what":"Getting Help","title":"Fisheries Integrated Modeling System (FIMS)","text":"Please report bugs along minimal reproducible example github issues","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/index.html","id":"code-of-conduct","dir":"","previous_headings":"","what":"Code of Conduct","title":"Fisheries Integrated Modeling System (FIMS)","text":"contributors participating contributing FIMS project expected adhere FIMS Code Conduct","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/index.html","id":"noaa-disclaimer","dir":"","previous_headings":"","what":"NOAA Disclaimer","title":"Fisheries Integrated Modeling System (FIMS)","text":"repository scientific product official communication National Oceanic Atmospheric Administration, United States Department Commerce. NOAA GitHub project code provided ‘’ basis user assumes responsibility use. claims Department Commerce Department Commerce bureaus stemming use GitHub project governed applicable Federal law. reference specific commercial products, processes, services service mark, trademark, manufacturer, otherwise, constitute imply endorsement, recommendation favoring Department Commerce. Department Commerce seal logo, seal logo DOC bureau, shall used manner imply endorsement commercial product activity DOC United States Government. Software code created U.S. Government employees subject copyright United States (17 U.S.C. §105). United States/Department Commerce reserve rights seek obtain copyright protection countries United States Software authored entirety Department Commerce. end, Department Commerce hereby grants Recipient royalty-free, nonexclusive license use, copy, create derivative works Software outside United States. U.S. Department Commerce | National Oceanographic Atmospheric Administration | NOAA Fisheries","code":""},{"path":[]},{"path":[]},{"path":[]},{"path":[]},{"path":"https://NOAA-FIMS.github.io/FIMS/pull_request_template.html","id":"developer-pre-pr-checklist","dir":"","previous_headings":"","what":"Developer pre-PR checklist","title":"What is the feature?","text":"relied GitHub actions 🧪 things sat 🛋️.","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/FIMSFrame.html","id":null,"dir":"Reference","previous_headings":"","what":"Class constructors for FIMSFrame and associated child classes — FIMSFrame","title":"Class constructors for FIMSFrame and associated child classes — FIMSFrame","text":"constructor functions take single input build object specific needs model type within FIMS. FIMSFrame parent class associated child classes additional slots needed model type.","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/FIMSFrame.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Class constructors for FIMSFrame and associated child classes — FIMSFrame","text":"","code":"FIMSFrame(data) FIMSFrameAge(data)"},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/FIMSFrame.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Class constructors for FIMSFrame and associated child classes — FIMSFrame","text":"data data.frame contains necessary columns construct data frame given FIMSFrame-class.","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/FIMSFrame.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Class constructors for FIMSFrame and associated child classes — FIMSFrame","text":"object S4 class FIMSFrame one child classes validated returned. objects minimum slot called data store input data frame. Additional slots dependent child class. Use showClass() see available slots.","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/create_fims_rcpp_interface.html","id":null,"dir":"Reference","previous_headings":"","what":"Function to create the Rcpp interface classes\nfor FIMS model objects. — create_fims_rcpp_interface","title":"Function to create the Rcpp interface classes\nfor FIMS model objects. — create_fims_rcpp_interface","text":"Function create Rcpp interface classes FIMS model objects.","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/create_fims_rcpp_interface.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Function to create the Rcpp interface classes\nfor FIMS model objects. — create_fims_rcpp_interface","text":"","code":"create_fims_rcpp_interface( interface_name = character(), model = character(), base_class = character(), container = character(), parameters = vector(), evaluate_parameter = vector(), evaluate_parameter_type = vector() )"},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/create_fims_rcpp_interface.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Function to create the Rcpp interface classes\nfor FIMS model objects. — create_fims_rcpp_interface","text":"interface_name class name model fims model (.e. LogisticSelectivity) without \"fims\" namespace base_class interface base class container information model container parameters parameters model object evaluate_parameter parameter evaluate method evaluate_parameter_type type parameter evaluate method","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/create_fims_rcpp_interface.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Function to create the Rcpp interface classes\nfor FIMS model objects. — create_fims_rcpp_interface","text":"Text string code new Rcpp interface class","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/create_fims_rcpp_interface.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Function to create the Rcpp interface classes\nfor FIMS model objects. — create_fims_rcpp_interface","text":"","code":"create_fims_rcpp_interface( interface_name = \"DnormDistributionsInterface\", model = \"Dnorm\", base_class = \"DistributionsInterfaceBase\", container = \"distribution_models\", parameters = c(\"x\", \"mean\", \"sd\"), evaluate_parameter = \"do_log\", evaluate_parameter_type = \"bool\" ) #> class DnormDistributionsInterface : public DistributionsInterfaceBase { #> public: #> #> Parameter x; #> Parameter mean; #> Parameter sd; #> #> #> DnormDistributionsInterface() : DistributionsInterfaceBase() {} #> #> virtual ~DnormDistributionsInterface() {} #> #> #> virtual uint32_t get_id() { return this->id; } #> #> #> virtual double evaluate(bool do_log) { #> fims_popdy::Dnorm object; #> object.x = this->x.value; #> object.mean = this->mean.value; #> object.sd = this->sd.value; #> return object.evaluate(bool); #> } #> #> #> virtual bool add_to_fims_tmb(){ #> std::shared_ptr > d0 = #> fims_info::Information::GetInstance(); #> #> std::shared_ptr > model0 = #> std::make_shared >(); #> #> #> model0->id = this->id; #> model0->x= this->x.value; #> if (this->x.estimated) { #> if (this->x.is_random_effect) { #> d0->RegisterRandomEffect(model0->x); #> } else { #> d0->RegisterParameter(model0->x); #> } #> } #> model0->mean= this->mean.value; #> if (this->mean.estimated) { #> if (this->mean.is_random_effect) { #> d0->RegisterRandomEffect(model0->mean); #> } else { #> d0->RegisterParameter(model0->mean); #> } #> } #> model0->sd= this->sd.value; #> if (this->sd.estimated) { #> if (this->sd.is_random_effect) { #> d0->RegisterRandomEffect(model0->sd); #> } else { #> d0->RegisterParameter(model0->sd); #> } #> } #> d0->distribution_models[model0->id]=model0; #> #> #> std::shared_ptr > d1 = #> fims_info::Information::GetInstance(); #> #> std::shared_ptr > model1 = #> std::make_shared >(); #> #> #> model1->id = this->id; #> model1->x= this->x.value; #> if (this->x.estimated) { #> if (this->x.is_random_effect) { #> d1->RegisterRandomEffect(model1->x); #> } else { #> d1->RegisterParameter(model1->x); #> } #> } #> model1->mean= this->mean.value; #> if (this->mean.estimated) { #> if (this->mean.is_random_effect) { #> d1->RegisterRandomEffect(model1->mean); #> } else { #> d1->RegisterParameter(model1->mean); #> } #> } #> model1->sd= this->sd.value; #> if (this->sd.estimated) { #> if (this->sd.is_random_effect) { #> d1->RegisterRandomEffect(model1->sd); #> } else { #> d1->RegisterParameter(model1->sd); #> } #> } #> d1->distribution_models[model1->id]=model1; #> #> #> std::shared_ptr > d2 = #> fims_info::Information::GetInstance(); #> #> std::shared_ptr > model2 = #> std::make_shared >(); #> #> #> model2->id = this->id; #> model2->x= this->x.value; #> if (this->x.estimated) { #> if (this->x.is_random_effect) { #> d2->RegisterRandomEffect(model2->x); #> } else { #> d2->RegisterParameter(model2->x); #> } #> } #> model2->mean= this->mean.value; #> if (this->mean.estimated) { #> if (this->mean.is_random_effect) { #> d2->RegisterRandomEffect(model2->mean); #> } else { #> d2->RegisterParameter(model2->mean); #> } #> } #> model2->sd= this->sd.value; #> if (this->sd.estimated) { #> if (this->sd.is_random_effect) { #> d2->RegisterRandomEffect(model2->sd); #> } else { #> d2->RegisterParameter(model2->sd); #> } #> } #> d2->distribution_models[model2->id]=model2; #> #> #> std::shared_ptr > d3 = #> fims_info::Information::GetInstance(); #> #> std::shared_ptr > model3 = #> std::make_shared >(); #> #> #> model3->id = this->id; #> model3->x= this->x.value; #> if (this->x.estimated) { #> if (this->x.is_random_effect) { #> d3->RegisterRandomEffect(model3->x); #> } else { #> d3->RegisterParameter(model3->x); #> } #> } #> model3->mean= this->mean.value; #> if (this->mean.estimated) { #> if (this->mean.is_random_effect) { #> d3->RegisterRandomEffect(model3->mean); #> } else { #> d3->RegisterParameter(model3->mean); #> } #> } #> model3->sd= this->sd.value; #> if (this->sd.estimated) { #> if (this->sd.is_random_effect) { #> d3->RegisterRandomEffect(model3->sd); #> } else { #> d3->RegisterParameter(model3->sd); #> } #> } #> d3->distribution_models[model3->id]=model3; #> #> #> return true; #> #> #> } #> #> }; #> #> //Add the following to the RCpp module definition: rcpp_interface.hpp #> #> Rcpp::class_(\"DnormDistributions\") #> .constructor() #> .method(\"get_id\", &DnormDistributionsInterface::get_id) #> .method(\"evaluate\", & DnormDistributionsInterface ::evaluate) #> .field(\"x\", &DnormDistributionsInterface::x) #> .field(\"mean\", &DnormDistributionsInterface::mean) #> .field(\"sd\", &DnormDistributionsInterface::sd); create_fims_rcpp_interface( interface_name = \"LogisticSelectivityInterface\", model = \"LogisticSelectivity\", base_class = \"SelectivityInterfaceBase\", container = \"selectivity_models\", parameters = c(\"slope\", \"inflection_point\"), evaluate_parameter = \"x\", evaluate_parameter_type = \"double\" ) #> class LogisticSelectivityInterface : public SelectivityInterfaceBase { #> public: #> #> Parameter slope; #> Parameter inflection_point; #> #> #> LogisticSelectivityInterface() : SelectivityInterfaceBase() {} #> #> virtual ~LogisticSelectivityInterface() {} #> #> #> virtual uint32_t get_id() { return this->id; } #> #> #> virtual double evaluate(double x) { #> fims_popdy::LogisticSelectivity object; #> object.slope = this->slope.value; #> object.inflection_point = this->inflection_point.value; #> return object.evaluate(double); #> } #> #> #> virtual bool add_to_fims_tmb(){ #> std::shared_ptr > d0 = #> fims_info::Information::GetInstance(); #> #> std::shared_ptr > model0 = #> std::make_shared >(); #> #> #> model0->id = this->id; #> model0->slope= this->slope.value; #> if (this->slope.estimated) { #> if (this->slope.is_random_effect) { #> d0->RegisterRandomEffect(model0->slope); #> } else { #> d0->RegisterParameter(model0->slope); #> } #> } #> model0->inflection_point= this->inflection_point.value; #> if (this->inflection_point.estimated) { #> if (this->inflection_point.is_random_effect) { #> d0->RegisterRandomEffect(model0->inflection_point); #> } else { #> d0->RegisterParameter(model0->inflection_point); #> } #> } #> d0->selectivity_models[model0->id]=model0; #> #> #> std::shared_ptr > d1 = #> fims_info::Information::GetInstance(); #> #> std::shared_ptr > model1 = #> std::make_shared >(); #> #> #> model1->id = this->id; #> model1->slope= this->slope.value; #> if (this->slope.estimated) { #> if (this->slope.is_random_effect) { #> d1->RegisterRandomEffect(model1->slope); #> } else { #> d1->RegisterParameter(model1->slope); #> } #> } #> model1->inflection_point= this->inflection_point.value; #> if (this->inflection_point.estimated) { #> if (this->inflection_point.is_random_effect) { #> d1->RegisterRandomEffect(model1->inflection_point); #> } else { #> d1->RegisterParameter(model1->inflection_point); #> } #> } #> d1->selectivity_models[model1->id]=model1; #> #> #> std::shared_ptr > d2 = #> fims_info::Information::GetInstance(); #> #> std::shared_ptr > model2 = #> std::make_shared >(); #> #> #> model2->id = this->id; #> model2->slope= this->slope.value; #> if (this->slope.estimated) { #> if (this->slope.is_random_effect) { #> d2->RegisterRandomEffect(model2->slope); #> } else { #> d2->RegisterParameter(model2->slope); #> } #> } #> model2->inflection_point= this->inflection_point.value; #> if (this->inflection_point.estimated) { #> if (this->inflection_point.is_random_effect) { #> d2->RegisterRandomEffect(model2->inflection_point); #> } else { #> d2->RegisterParameter(model2->inflection_point); #> } #> } #> d2->selectivity_models[model2->id]=model2; #> #> #> std::shared_ptr > d3 = #> fims_info::Information::GetInstance(); #> #> std::shared_ptr > model3 = #> std::make_shared >(); #> #> #> model3->id = this->id; #> model3->slope= this->slope.value; #> if (this->slope.estimated) { #> if (this->slope.is_random_effect) { #> d3->RegisterRandomEffect(model3->slope); #> } else { #> d3->RegisterParameter(model3->slope); #> } #> } #> model3->inflection_point= this->inflection_point.value; #> if (this->inflection_point.estimated) { #> if (this->inflection_point.is_random_effect) { #> d3->RegisterRandomEffect(model3->inflection_point); #> } else { #> d3->RegisterParameter(model3->inflection_point); #> } #> } #> d3->selectivity_models[model3->id]=model3; #> #> #> return true; #> #> #> } #> #> }; #> #> //Add the following to the RCpp module definition: rcpp_interface.hpp #> #> Rcpp::class_(\"LogisticSelectivity\") #> .constructor() #> .method(\"get_id\", &LogisticSelectivityInterface::get_id) #> .method(\"evaluate\", & LogisticSelectivityInterface ::evaluate) #> .field(\"slope\", &LogisticSelectivityInterface::slope) #> .field(\"inflection_point\", &LogisticSelectivityInterface::inflection_point);"},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/data_mile1.html","id":null,"dir":"Reference","previous_headings":"","what":"FIMS input data frame for milestone 1 — data_mile1","title":"FIMS input data frame for milestone 1 — data_mile1","text":"dataset containing information necessary run age-structured stock assessment model FIMS milestone 1. data generated using ASSAMC package written model comparison project.","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/data_mile1.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"FIMS input data frame for milestone 1 — data_mile1","text":"","code":"data_mile1"},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/data_mile1.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"FIMS input data frame for milestone 1 — data_mile1","text":"data frame 1140 observations 8 variables: type type data row contains. name character string providing name information source data collected , e.g., \"Trawl fishery\" age integer age. Entry can NA information pertains multiple ages, e.g., total catch rather catch age-4 fish. datestart,dateend Start end dates data collection period. Format dates using yyyy-mm-dd, can accommodate fake years 0001-01-01. value measurement interest. unit character string specifying units value. uncertainty real value providing measurement uncertainty value.","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/data_mile1.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"FIMS input data frame for milestone 1 — data_mile1","text":"www.github.com/Bai-Li-NOAA/Age_Structured_Stock_Assessment_Model_Comparison","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/m_agecomp-FIMSFrameAge-method.html","id":null,"dir":"Reference","previous_headings":"","what":"For FIMSFrameAge, Get the agecomp data to be used in the model — m_agecomp,FIMSFrameAge-method","title":"For FIMSFrameAge, Get the agecomp data to be used in the model — m_agecomp,FIMSFrameAge-method","text":"FIMSFrameAge, Get agecomp data used model","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/m_agecomp-FIMSFrameAge-method.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"For FIMSFrameAge, Get the agecomp data to be used in the model — m_agecomp,FIMSFrameAge-method","text":"","code":"# S4 method for FIMSFrameAge m_agecomp(x, fleet_name)"},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/m_agecomp-FIMSFrameAge-method.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"For FIMSFrameAge, Get the agecomp data to be used in the model — m_agecomp,FIMSFrameAge-method","text":"x FIMSFrameAge containing agecomp fleet_name name fleet agecomp data","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/m_agecomp.html","id":null,"dir":"Reference","previous_headings":"","what":"Get the agecomp data to be used in the model — m_agecomp","title":"Get the agecomp data to be used in the model — m_agecomp","text":"Get agecomp data used model","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/m_agecomp.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get the agecomp data to be used in the model — m_agecomp","text":"","code":"m_agecomp(x, fleet_name)"},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/m_agecomp.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get the agecomp data to be used in the model — m_agecomp","text":"x object containing agecomp fleet_name name fleet agecomp data","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/m_index-FIMSFrameAge-method.html","id":null,"dir":"Reference","previous_headings":"","what":"Get the index data to be used in the model — m_index,FIMSFrameAge-method","title":"Get the index data to be used in the model — m_index,FIMSFrameAge-method","text":"Get index data used model","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/m_index-FIMSFrameAge-method.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get the index data to be used in the model — m_index,FIMSFrameAge-method","text":"","code":"# S4 method for FIMSFrameAge m_index(x, fleet_name)"},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/m_index-FIMSFrameAge-method.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get the index data to be used in the model — m_index,FIMSFrameAge-method","text":"x FIMSFrameAge object containing index fleet_name name fleet index data","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/m_index.html","id":null,"dir":"Reference","previous_headings":"","what":"Get the index data to be used in the model — m_index","title":"Get the index data to be used in the model — m_index","text":"Get index data used model","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/m_index.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get the index data to be used in the model — m_index","text":"","code":"m_index(x, fleet_name)"},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/m_index.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get the index data to be used in the model — m_index","text":"x object containing index fleet_name name fleet index data","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/m_landings-FIMSFrameAge-method.html","id":null,"dir":"Reference","previous_headings":"","what":"Get the landings data to be used in the model — m_landings,FIMSFrameAge-method","title":"Get the landings data to be used in the model — m_landings,FIMSFrameAge-method","text":"Get landings data used model","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/m_landings-FIMSFrameAge-method.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get the landings data to be used in the model — m_landings,FIMSFrameAge-method","text":"","code":"# S4 method for FIMSFrameAge m_landings(x)"},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/m_landings-FIMSFrameAge-method.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get the landings data to be used in the model — m_landings,FIMSFrameAge-method","text":"x FIMSFrameAge object containing landings","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/m_landings.html","id":null,"dir":"Reference","previous_headings":"","what":"Get the landings data to be used in the model — m_landings","title":"Get the landings data to be used in the model — m_landings","text":"Get landings data used model","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/m_landings.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get the landings data to be used in the model — m_landings","text":"","code":"m_landings(x)"},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/m_landings.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get the landings data to be used in the model — m_landings","text":"x object containing landings","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/mkObj.html","id":null,"dir":"Reference","previous_headings":"","what":"fit: example function demonstrating TMB specific Roxygen comments — mkObj","title":"fit: example function demonstrating TMB specific Roxygen comments — mkObj","text":"fit: example function demonstrating TMB specific Roxygen comments","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/mkObj.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"fit: example function demonstrating TMB specific Roxygen comments — mkObj","text":"","code":"mkObj()"},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/mkObj.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"fit: example function demonstrating TMB specific Roxygen comments — mkObj","text":"TMB object","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/mkObj.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"fit: example function demonstrating TMB specific Roxygen comments — mkObj","text":"","code":"if (FALSE) { mkObj() }"},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/pipe.html","id":null,"dir":"Reference","previous_headings":"","what":"Pipe operator — %>%","title":"Pipe operator — %>%","text":"See magrittr::%>% details.","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/pipe.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Pipe operator — %>%","text":"","code":"lhs %>% rhs"},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/pipe.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Pipe operator — %>%","text":"lhs value magrittr placeholder. rhs function call using magrittr semantics.","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/pipe.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Pipe operator — %>%","text":"result calling rhs(lhs).","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/run_gtest.html","id":null,"dir":"Reference","previous_headings":"","what":"run google test suite — run_gtest","title":"run google test suite — run_gtest","text":"Developer function running google test suite R","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/run_gtest.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"run google test suite — run_gtest","text":"","code":"run_gtest(...)"},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/run_gtest.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"run google test suite — run_gtest","text":"... additional arguments ctest --test-dir build \"--rerun-failed --output--failure\"","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/setup_and_run_gtest.html","id":null,"dir":"Reference","previous_headings":"","what":"setup and run google test suite — setup_and_run_gtest","title":"setup and run google test suite — setup_and_run_gtest","text":"Developer function setup running google test suite R","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/setup_and_run_gtest.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"setup and run google test suite — setup_and_run_gtest","text":"","code":"setup_and_run_gtest(...)"},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/setup_and_run_gtest.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"setup and run google test suite — setup_and_run_gtest","text":"... additional arguments ctest --test-dir build \"--rerun-failed --output--failure\"","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/setup_gtest.html","id":null,"dir":"Reference","previous_headings":"","what":"function for setting up your local environment to run the gtest\nintegration test locally. Intended for developers. — setup_gtest","title":"function for setting up your local environment to run the gtest\nintegration test locally. Intended for developers. — setup_gtest","text":"function setting local environment run gtest integration test locally. Intended developers.","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/setup_gtest.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"function for setting up your local environment to run the gtest\nintegration test locally. Intended for developers. — setup_gtest","text":"","code":"setup_gtest()"},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/setup_gtest.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"function for setting up your local environment to run the gtest\nintegration test locally. Intended for developers. — setup_gtest","text":"","code":"if (FALSE) { setup_gtest() }"},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/use_module.html","id":null,"dir":"Reference","previous_headings":"","what":"use_module — use_module","title":"use_module — use_module","text":"function generate necessary files add new module FIMS system. now, works modules population_dynamics folder FIMS.","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/use_module.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"use_module — use_module","text":"","code":"use_module( path = file.path(\"inst\", \"include\", \"population_dynamics\"), module_name, module_type )"},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/use_module.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"use_module — use_module","text":"path path FIMS project directory inst folder. module_name name module. creates subfolder inst/include name folders functors module_name.hpp. module_type folder inst/include/population_dynamics put files ","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/use_module.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"use_module — use_module","text":"TRUE","code":""},{"path":"https://NOAA-FIMS.github.io/FIMS/reference/use_module.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"use_module — use_module","text":"","code":"if (FALSE) { # create a new empirical weight-at-age module (EWAA) under growth use_module(file.path(\"inst\", \"include\", \"population_dynamics\"), module_name = \"ewaa\", module_type = \"growth\" ) }"}]