diff --git a/articles/fims-demo.html b/articles/fims-demo.html index a92542d0..ff111734 100644 --- a/articles/fims-demo.html +++ b/articles/fims-demo.html @@ -244,7 +244,7 @@

Fleet Data
 show(Fims$Index)
-
## C++ class 'Index' <0x55f9ad9742e0>
+
## C++ class 'Index' <0x55f12b5dc750>
 ## Constructors:
 ##     Index(int)
 ## 
@@ -256,7 +256,7 @@ 

Fleet Data##

 show(Fims$AgeComp)
-
## C++ class 'AgeComp' <0x55f9af5c7740>
+
## C++ class 'AgeComp' <0x55f12b5dc5f0>
 ## Constructors:
 ##     AgeComp(int, int)
 ## 
@@ -296,7 +296,7 @@ 

Fleet Selectivity
 methods::show(Fims$LogisticSelectivity)
-
## C++ class 'LogisticSelectivity' <0x55f9ad974860>
+
## C++ class 'LogisticSelectivity' <0x55f12b5dccd0>
 ## Constructors:
 ##     LogisticSelectivity()
 ## 
@@ -327,7 +327,7 @@ 

Creating the Fleet Object
 show(Fims$Fleet)
-
## C++ class 'Fleet' <0x55f9af5c75e0>
+
## C++ class 'Fleet' <0x55f12b5dc490>
 ## Constructors:
 ##     Fleet()
 ## 
@@ -469,7 +469,7 @@ 

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

-
## C++ class 'BevertonHoltRecruitment' <0x55f9af5c7480>
+
## C++ class 'BevertonHoltRecruitment' <0x55f12b5dc330>
 ## Constructors:
 ##     BevertonHoltRecruitment()
 ## 
@@ -602,21 +602,21 @@ 

Fitting the Modelprint(opt)

## $par
 ##           p           p           p           p           p           p 
-##   1.9784124   1.0550686  -4.6296938  -3.5725488  -3.0686968  -2.7603326 
+##   1.9784142   1.0550668  -4.6296906  -3.5725453  -3.0686937  -2.7603299 
 ##           p           p           p           p           p           p 
-##  -2.9931706  -2.4044117  -2.4069282  -1.6608864  -2.2097510  -2.0036112 
+##  -2.9931677  -2.4044095  -2.4069257  -1.6608843  -2.2097495  -2.0036092 
 ##           p           p           p           p           p           p 
-##  -1.8925853  -1.8306032  -2.1404159  -1.7709201  -1.7204327  -1.8273711 
+##  -1.8925835  -1.8306020  -2.1404148  -1.7709187  -1.7204319  -1.8273710 
 ##           p           p           p           p           p           p 
-##  -1.1754058  -1.3800553  -1.3878165  -1.4045442  -1.0845693  -1.4013129 
+##  -1.1754050  -1.3800545  -1.3878159  -1.4045445  -1.0845690  -1.4013131 
 ##           p           p           p           p           p           p 
-##  -0.9093099  -1.1045471  -1.1138092  -1.2245711  -1.2371810  -0.9143819 
+##  -0.9093096  -1.1045474  -1.1138094  -1.2245715  -1.2371815  -0.9143826 
 ##           p           p           p           p           p           p 
-##  -1.2027261  -0.7965283   1.4862588   1.8588129 -14.9143765  13.8310121 
+##  -1.2027273  -0.7965294   1.4862561   1.8588152 -14.9143799  13.8310126 
 ##           p           p           p           p           p           p 
-##  13.6991848  13.6194560  13.4489580  13.1492363  12.8975477  12.6729221 
+##  13.6991747  13.6194621  13.4489524  13.1492374  12.8975435  12.6729190 
 ##           p           p           p           p           p           p 
-##  12.6108058  12.2462862  12.2797207  11.7539121  11.9193966  13.0840733 
+##  12.6108005  12.2462906  12.2797158  11.7539203  11.9193946  13.0840648 
 ## 
 ## $objective
 ## [1] 1517.349
@@ -625,11 +625,11 @@ 

Fitting the Model## [1] 0 ## ## $iterations -## [1] 315 +## [1] 289 ## ## $evaluations ## function gradient -## 437 316 +## 398 290 ## ## $message ## [1] "relative convergence (4)"

@@ -643,54 +643,54 @@

TMB Reportingprint(sdr_fixed)

##      Estimate  Std. Error
-## p   1.9784124 0.072654872
-## p   1.0550686 0.065712443
-## p  -4.6296938 0.039598940
-## p  -3.5725488 0.037459629
-## p  -3.0686968 0.035872949
-## p  -2.7603326 0.034437130
-## p  -2.9931706 0.032449061
-## p  -2.4044117 0.030677672
-## p  -2.4069282 0.029412736
-## p  -1.6608864 0.028427773
-## p  -2.2097510 0.027488745
-## p  -2.0036112 0.026143057
-## p  -1.8925853 0.025395165
-## p  -1.8306032 0.025092578
-## p  -2.1404159 0.024477576
-## p  -1.7709201 0.023811629
-## p  -1.7204327 0.024025327
-## p  -1.8273711 0.024328102
-## p  -1.1754058 0.025384032
-## p  -1.3800553 0.027444847
-## p  -1.3878165 0.028233400
-## p  -1.4045442 0.028978807
-## p  -1.0845693 0.031152631
-## p  -1.4013129 0.034443918
-## p  -0.9093099 0.038145432
-## p  -1.1045471 0.042400870
-## p  -1.1138092 0.045973469
-## p  -1.2245711 0.050487256
-## p  -1.2371810 0.054774901
-## p  -0.9143819 0.061567535
-## p  -1.2027261 0.068427885
-## p  -0.7965283 0.076196415
-## p   1.4862588 0.046242898
-## p   1.8588129 0.132512016
-## p -14.9143765 0.043661675
-## p  13.8310121 0.008195871
-## p  13.6991848 0.061782905
-## p  13.6194560 0.060498768
-## p  13.4489580 0.064465789
-## p  13.1492363 0.074174327
-## p  12.8975477 0.084390567
-## p  12.6729221 0.095547593
-## p  12.6108058 0.101086219
-## p  12.2462862 0.127124942
-## p  12.2797207 0.135012278
-## p  11.7539121 0.205589362
-## p  11.9193966 0.238275055
-## p  13.0840733 0.104325542
+## p 1.9784142 0.072654895 +## p 1.0550668 0.065712204 +## p -4.6296906 0.039598928 +## p -3.5725453 0.037459609 +## p -3.0686937 0.035872924 +## p -2.7603299 0.034437107 +## p -2.9931677 0.032449041 +## p -2.4044095 0.030677652 +## p -2.4069257 0.029412718 +## p -1.6608843 0.028427757 +## p -2.2097495 0.027488735 +## p -2.0036092 0.026143050 +## p -1.8925835 0.025395163 +## p -1.8306020 0.025092580 +## p -2.1404148 0.024477585 +## p -1.7709187 0.023811644 +## p -1.7204319 0.024025347 +## p -1.8273710 0.024328129 +## p -1.1754050 0.025384068 +## p -1.3800545 0.027444894 +## p -1.3878159 0.028233462 +## p -1.4045445 0.028978885 +## p -1.0845690 0.031152729 +## p -1.4013131 0.034444029 +## p -0.9093096 0.038145563 +## p -1.1045474 0.042401030 +## p -1.1138094 0.045973661 +## p -1.2245715 0.050487469 +## p -1.2371815 0.054775134 +## p -0.9143826 0.061567793 +## p -1.2027273 0.068428158 +## p -0.7965294 0.076196698 +## p 1.4862561 0.046242717 +## p 1.8588152 0.132512004 +## p -14.9143799 0.043661687 +## p 13.8310126 0.008195896 +## p 13.6991747 0.061783225 +## p 13.6194621 0.060498608 +## p 13.4489524 0.064465962 +## p 13.1492374 0.074174302 +## p 12.8975435 0.084390756 +## p 12.6729190 0.095547775 +## p 12.6108005 0.101086539 +## p 12.2462906 0.127124763 +## p 12.2797158 0.135012811 +## p 11.7539203 0.205589070 +## p 11.9193946 0.238277035 +## p 13.0840648 0.104326567
@@ -704,36 +704,36 @@

Plotting Results) print(index_results)

##       observed    expected
-## 1  0.006795379 0.006314928
-## 2  0.006170738 0.006356072
-## 3  0.005977854 0.006355315
-## 4  0.005907966 0.006242292
-## 5  0.007211237 0.006012834
-## 6  0.006867264 0.006018000
-## 7  0.006329387 0.005943465
-## 8  0.006137000 0.005852803
-## 9  0.005279601 0.005261616
-## 10 0.005666829 0.005084843
-## 11 0.004806935 0.004821780
-## 12 0.004374876 0.004534035
-## 13 0.003992211 0.004207427
-## 14 0.004188884 0.004044713
-## 15 0.003711145 0.003748426
-## 16 0.003818704 0.003500219
-## 17 0.002878658 0.003399896
-## 18 0.002936660 0.002967898
-## 19 0.002972886 0.002698287
-## 20 0.002484963 0.002419289
-## 21 0.001983795 0.002191653
-## 22 0.001738507 0.001945133
-## 23 0.002122178 0.001965202
-## 24 0.001617189 0.001729716
-## 25 0.001745169 0.001586376
-## 26 0.001414111 0.001486532
-## 27 0.001350571 0.001431013
-## 28 0.001323396 0.001387285
-## 29 0.001069791 0.001309405
-## 30 0.001459411 0.001409967
+## 1 0.006795379 0.006314888 +## 2 0.006170738 0.006356033 +## 3 0.005977854 0.006355277 +## 4 0.005907966 0.006242256 +## 5 0.007211237 0.006012800 +## 6 0.006867264 0.006017967 +## 7 0.006329387 0.005943434 +## 8 0.006137000 0.005852774 +## 9 0.005279601 0.005261591 +## 10 0.005666829 0.005084819 +## 11 0.004806935 0.004821759 +## 12 0.004374876 0.004534016 +## 13 0.003992211 0.004207409 +## 14 0.004188884 0.004044696 +## 15 0.003711145 0.003748412 +## 16 0.003818704 0.003500206 +## 17 0.002878658 0.003399884 +## 18 0.002936660 0.002967888 +## 19 0.002972886 0.002698278 +## 20 0.002484963 0.002419281 +## 21 0.001983795 0.002191646 +## 22 0.001738507 0.001945128 +## 23 0.002122178 0.001965197 +## 24 0.001617189 0.001729711 +## 25 0.001745169 0.001586372 +## 26 0.001414111 0.001486529 +## 27 0.001350571 0.001431010 +## 28 0.001323396 0.001387283 +## 29 0.001069791 0.001309403 +## 30 0.001459411 0.001409964
 ggplot(index_results, aes(x = 1:nyears, y = observed)) +
   geom_point() +
@@ -749,36 +749,36 @@ 

Plotting Results) print(catch_results)

##     observed  expected
-## 1   160.2363  160.1960
-## 2   460.6336  460.5299
+## 1   160.2363  160.1959
+## 2   460.6336  460.5301
 ## 3   752.1299  751.9285
-## 4   996.9872  996.7154
-## 5   769.6972  769.5560
-## 6  1352.7309 1352.4449
-## 7  1317.7236 1317.4960
-## 8  2626.0240 2625.3649
-## 9  1415.1162 1414.8595
-## 10 1666.0168 1665.5179
-## 11 1751.8060 1751.2855
-## 12 1739.5435 1738.9520
-## 13 1208.5391 1208.3927
-## 14 1647.6643 1647.2343
-## 15 1593.6254 1593.1013
-## 16 1343.2277 1343.0134
-## 17 2337.0098 2336.1670
-## 18 1685.7172 1685.1892
+## 4   996.9872  996.7151
+## 5   769.6972  769.5561
+## 6  1352.7309 1352.4443
+## 7  1317.7236 1317.4962
+## 8  2626.0240 2625.3646
+## 9  1415.1162 1414.8588
+## 10 1666.0168 1665.5184
+## 11 1751.8060 1751.2858
+## 12 1739.5435 1738.9513
+## 13 1208.5391 1208.3924
+## 14 1647.6643 1647.2346
+## 15 1593.6254 1593.1009
+## 16 1343.2277 1343.0123
+## 17 2337.0098 2336.1672
+## 18 1685.7172 1685.1893
 ## 19 1529.8325 1529.6612
-## 20 1359.5044 1359.2677
-## 21 1637.5099 1637.0598
-## 22 1081.9126 1082.1723
-## 23 1648.7687 1650.0290
-## 24 1230.1199 1230.3145
-## 25 1133.8784 1134.2291
-## 26  956.5872  957.1985
-## 27  911.0781  911.7777
-## 28 1172.4887 1173.1900
-## 29  852.1934  852.3925
-## 30 1278.3228 1278.3752
+## 20 1359.5044 1359.2668 +## 21 1637.5099 1637.0599 +## 22 1081.9126 1082.1721 +## 23 1648.7687 1650.0295 +## 24 1230.1199 1230.3143 +## 25 1133.8784 1134.2294 +## 26 956.5872 957.1986 +## 27 911.0781 911.7779 +## 28 1172.4887 1173.1903 +## 29 852.1934 852.3924 +## 30 1278.3228 1278.3754

 ggplot(catch_results, aes(x = 1:nyears, y = observed)) +
   geom_point() +
diff --git a/articles/fims-demo_files/figure-html/plots-1.png b/articles/fims-demo_files/figure-html/plots-1.png
index 59983f5f..6655b86b 100644
Binary files a/articles/fims-demo_files/figure-html/plots-1.png and b/articles/fims-demo_files/figure-html/plots-1.png differ
diff --git a/articles/fims-demo_files/figure-html/plots-2.png b/articles/fims-demo_files/figure-html/plots-2.png
index 9a2cf951..43965114 100644
Binary files a/articles/fims-demo_files/figure-html/plots-2.png and b/articles/fims-demo_files/figure-html/plots-2.png differ
diff --git a/articles/fims-path-maturity.html b/articles/fims-path-maturity.html
index 730dd4cc..51472e6c 100644
--- a/articles/fims-path-maturity.html
+++ b/articles/fims-path-maturity.html
@@ -495,13 +495,13 @@ 

Calling maturity from population * @brief Calculates expected proportion of individuals mature at a selected * age * - * @param index_ya dimension folded index for year and age + * @param i_age_year dimension folded index for age and year * @param age the age of maturity */ - void CalculateMaturityAA(size_t index_ya, size_t age) { + 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[index_ya] = + this->proportion_mature_at_age[i_age_year] = this->maturity->evaluate(ages[age]); }

diff --git a/pkgdown.yml b/pkgdown.yml index 2fac74c2..8ae1efff 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-10-24T18:23Z +last_built: 2023-10-24T18:24Z 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 31924d88..005e571b 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. create new Rcpp fims module using Rcpp::Module call Fims$clear ensure C++ memory previous fims model run cleared .","code":"library(FIMS) library(TMB) # load the module Fims <- Rcpp::Module(\"fims\", PACKAGE = \"FIMS\") Fims$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 3 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 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(Fims$Index) ## C++ class 'Index' <0x55f9ad9742e0> ## Constructors: ## Index(int) ## ## Fields: ## Rcpp::Vector<14, Rcpp::PreserveStorage> index_data ## ## Methods: ## unsigned int get_id() ## show(Fims$AgeComp) ## C++ class 'AgeComp' <0x55f9af5c7740> ## 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(Fims$Index, nyears) # fleet age composition data fishing_fleet_age_comp <- methods::new(Fims$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: median 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(Fims$LogisticSelectivity) ## C++ class 'LogisticSelectivity' <0x55f9ad974860> ## Constructors: ## LogisticSelectivity() ## ## Fields: ## Parameter median ## Parameter slope ## ## Methods: ## double evaluate(double) ## ## unsigned int get_id() ## fishing_fleet_selectivity <- methods::new(Fims$LogisticSelectivity) fishing_fleet_selectivity$median$value <- 2.0 fishing_fleet_selectivity$median$is_random_effect <- FALSE fishing_fleet_selectivity$median$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(Fims$Fleet) see fields methods available R. can see five boolean flags: estimate_F, estimate_q, is_survey, random_F, random_q. vector, log_Fmort, Parameter, 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(Fims$Fleet) ## C++ class 'Fleet' <0x55f9af5c75e0> ## Constructors: ## Fleet() ## ## Fields: ## bool estimate_F ## bool estimate_q ## bool is_survey ## Rcpp::Vector<14, Rcpp::PreserveStorage> log_Fmort ## Parameter 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(Fims$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$value <- log(sqrt(log(0.01^2 + 1))) fishing_fleet$log_obs_error$estimated <- 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(Fims$Index, nyears) # survey age composition data survey_fleet_age_comp <- methods::new(Fims$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(Fims$LogisticSelectivity) survey_fleet_selectivity$median$value <- 1.5 survey_fleet_selectivity$median$is_random_effect <- FALSE survey_fleet_selectivity$median$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(Fims$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$value <- log(sqrt(log(0.2^2 + 1))) survey_fleet$log_obs_error$estimated <- 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 Fims$BevertonHoltRecruitment module. three parameters need set-: log_sigma_recruit, log_rzero, logit_steep. also need set recruitment deviations. FIMS recruitment modules boolean, estimate_deviations specify whether deviations estimated; vector, deviations set deviation values. deviations vector takes values greater 0 logged likelihood.","code":"# Recruitment recruitment <- methods::new(Fims$BevertonHoltRecruitment) methods::show(Fims$BevertonHoltRecruitment) ## C++ class 'BevertonHoltRecruitment' <0x55f9af5c7480> ## Constructors: ## BevertonHoltRecruitment() ## ## Fields: ## Rcpp::Vector<14, Rcpp::PreserveStorage> deviations ## bool estimate_deviations ## 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_deviations <- FALSE recruitment$deviations <- c( 1.0931337, 1.5494153, 0.8754735, 0.6488721, 1.9128839, 1.6593211, 0.9327825, 1.3531871, 0.9207434, 1.2304792, 1.1652038, 0.8048559, 0.8752845, 1.1187967, 0.8989675, 1.3083559, 1.2724463, 0.5799534, 0.7891447, 0.5571984, 1.3515173, 1.2452116, 0.8002613, 0.5983474, 1.1704664, 0.5828168, 0.8223697, 1.2225558, 1.4513402, 0.9308739 )"},{"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(Fims$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(Fims$LogisticMaturity) maturity$median$value <- 2.25 maturity$median$is_random_effect <- FALSE maturity$median$estimated <- FALSE maturity$slope$value <- 3 maturity$slope$is_random_effect <- FALSE maturity$slope$estimated <- FALSE # Population population <- new(Fims$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$prop_female <- 0.5 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 <- Fims$CreateTMBModel() parameters <- list(p = Fims$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.9784124 1.0550686 -4.6296938 -3.5725488 -3.0686968 -2.7603326 ## p p p p p p ## -2.9931706 -2.4044117 -2.4069282 -1.6608864 -2.2097510 -2.0036112 ## p p p p p p ## -1.8925853 -1.8306032 -2.1404159 -1.7709201 -1.7204327 -1.8273711 ## p p p p p p ## -1.1754058 -1.3800553 -1.3878165 -1.4045442 -1.0845693 -1.4013129 ## p p p p p p ## -0.9093099 -1.1045471 -1.1138092 -1.2245711 -1.2371810 -0.9143819 ## p p p p p p ## -1.2027261 -0.7965283 1.4862588 1.8588129 -14.9143765 13.8310121 ## p p p p p p ## 13.6991848 13.6194560 13.4489580 13.1492363 12.8975477 12.6729221 ## p p p p p p ## 12.6108058 12.2462862 12.2797207 11.7539121 11.9193966 13.0840733 ## ## $objective ## [1] 1517.349 ## ## $convergence ## [1] 0 ## ## $iterations ## [1] 315 ## ## $evaluations ## function gradient ## 437 316 ## ## $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.9784124 0.072654872 ## p 1.0550686 0.065712443 ## p -4.6296938 0.039598940 ## p -3.5725488 0.037459629 ## p -3.0686968 0.035872949 ## p -2.7603326 0.034437130 ## p -2.9931706 0.032449061 ## p -2.4044117 0.030677672 ## p -2.4069282 0.029412736 ## p -1.6608864 0.028427773 ## p -2.2097510 0.027488745 ## p -2.0036112 0.026143057 ## p -1.8925853 0.025395165 ## p -1.8306032 0.025092578 ## p -2.1404159 0.024477576 ## p -1.7709201 0.023811629 ## p -1.7204327 0.024025327 ## p -1.8273711 0.024328102 ## p -1.1754058 0.025384032 ## p -1.3800553 0.027444847 ## p -1.3878165 0.028233400 ## p -1.4045442 0.028978807 ## p -1.0845693 0.031152631 ## p -1.4013129 0.034443918 ## p -0.9093099 0.038145432 ## p -1.1045471 0.042400870 ## p -1.1138092 0.045973469 ## p -1.2245711 0.050487256 ## p -1.2371810 0.054774901 ## p -0.9143819 0.061567535 ## p -1.2027261 0.068427885 ## p -0.7965283 0.076196415 ## p 1.4862588 0.046242898 ## p 1.8588129 0.132512016 ## p -14.9143765 0.043661675 ## p 13.8310121 0.008195871 ## p 13.6991848 0.061782905 ## p 13.6194560 0.060498768 ## p 13.4489580 0.064465789 ## p 13.1492363 0.074174327 ## p 12.8975477 0.084390567 ## p 12.6729221 0.095547593 ## p 12.6108058 0.101086219 ## p 12.2462862 0.127124942 ## p 12.2797207 0.135012278 ## p 11.7539121 0.205589362 ## p 11.9193966 0.238275055 ## p 13.0840733 0.104325542"},{"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.006314928 ## 2 0.006170738 0.006356072 ## 3 0.005977854 0.006355315 ## 4 0.005907966 0.006242292 ## 5 0.007211237 0.006012834 ## 6 0.006867264 0.006018000 ## 7 0.006329387 0.005943465 ## 8 0.006137000 0.005852803 ## 9 0.005279601 0.005261616 ## 10 0.005666829 0.005084843 ## 11 0.004806935 0.004821780 ## 12 0.004374876 0.004534035 ## 13 0.003992211 0.004207427 ## 14 0.004188884 0.004044713 ## 15 0.003711145 0.003748426 ## 16 0.003818704 0.003500219 ## 17 0.002878658 0.003399896 ## 18 0.002936660 0.002967898 ## 19 0.002972886 0.002698287 ## 20 0.002484963 0.002419289 ## 21 0.001983795 0.002191653 ## 22 0.001738507 0.001945133 ## 23 0.002122178 0.001965202 ## 24 0.001617189 0.001729716 ## 25 0.001745169 0.001586376 ## 26 0.001414111 0.001486532 ## 27 0.001350571 0.001431013 ## 28 0.001323396 0.001387285 ## 29 0.001069791 0.001309405 ## 30 0.001459411 0.001409967 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.1960 ## 2 460.6336 460.5299 ## 3 752.1299 751.9285 ## 4 996.9872 996.7154 ## 5 769.6972 769.5560 ## 6 1352.7309 1352.4449 ## 7 1317.7236 1317.4960 ## 8 2626.0240 2625.3649 ## 9 1415.1162 1414.8595 ## 10 1666.0168 1665.5179 ## 11 1751.8060 1751.2855 ## 12 1739.5435 1738.9520 ## 13 1208.5391 1208.3927 ## 14 1647.6643 1647.2343 ## 15 1593.6254 1593.1013 ## 16 1343.2277 1343.0134 ## 17 2337.0098 2336.1670 ## 18 1685.7172 1685.1892 ## 19 1529.8325 1529.6612 ## 20 1359.5044 1359.2677 ## 21 1637.5099 1637.0598 ## 22 1081.9126 1082.1723 ## 23 1648.7687 1650.0290 ## 24 1230.1199 1230.3145 ## 25 1133.8784 1134.2291 ## 26 956.5872 957.1985 ## 27 911.0781 911.7777 ## 28 1172.4887 1173.1900 ## 29 852.1934 852.3925 ## 30 1278.3228 1278.3752 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":"Fims$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 Fims <- Rcpp::Module(\"fims\", PACKAGE = \"FIMS\") maturity <- new(Fims$LogisticMaturity) # Populate the maturity module with parameter values. maturity$median$value <- 10 maturity$median$is_random_effect <- FALSE maturity$median$estimated <- FALSE maturity$slope$value <- 0.2 maturity$slope$is_random_effect <- FALSE maturity$slope$estimated <- FALSE population <- new(Fims$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 Fims$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), median 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., median, 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(\"median\", &LogisticMaturityInterface::median) .field(\"slope\", &LogisticMaturityInterface::slope) .method(\"get_id\", &LogisticMaturityInterface::get_id) .method(\"evaluate\", &LogisticMaturityInterface::evaluate); maturity <- new(Fims$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 median; /**< the index value at which the response reaches .5 */ Parameter slope; /**< the width of the curve at the median */ ... } 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::. 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 ModelTraits class that contains the DataVector * and ParameterVector types. */ template struct 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::Information class order register maturity parameters specify whether random effects. setting two pointers interface: d0 points information, lm0, points logistic maturity module. Linking fims::LogisticMaturity class allows us link values input R values used model calculation: can also link two pointers together fims::Information class links fims::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::Information std::shared_ptr > d0 = fims::Information::GetInstance(); if (this->median.estimated) { if (this->median.is_random_effect) { /* if median is estimated and a random effect, the median value from LogisticMaturityInterface (lm0->median) is passed to the Information member function RegisterRandomEffect */ d0->RegisterRandomEffect(lm0->median); } else { /* if median is estimated and not a random effect, the median value from LogisticMaturityInterface (lm0->median) is passed to the Information member function RegisterParameter */ d0->RegisterParameter(lm0->median); } } //file: rcpp_maturity.hpp //lm0 is a shared pointer that points to fims::LogisticMaturity std::shared_ptr > lm0 = std::make_shared >(); /* the median value from LogisticMaturity (lm0->median) equals the median value from LogisticMaturityInterface (this->median.value) */ lm0->median = this->median.value; //file: rcpp_maturity.hpp /* the maturity_models pointer from Information that matches the id of the fims::LogisticMaturity class is equal to the pointer to fims::LogisticMaturity */ d0->maturity_models[lm0->id] = lm0;"},{"path":"https://NOAA-FIMS.github.io/FIMS/articles/fims-path-maturity.html","id":"inside-the-fimslogisticmaturity-class","dir":"Articles","previous_headings":"","what":"Inside the fims::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 median slope values.","code":"namespace fims { /** * @brief LogisticMaturity class that returns the logistic function value * from fims_math. */ template struct LogisticMaturity : public MaturityBase { T median; /*!< 50% quantile of the value of the quantity of interest (x); e.g., age at which 50% of the fish are mature */ T 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 T evaluate(const T& x) { return fims::logistic(median, 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 */ Fims$population$SetMaturity(maturity$get_id()) //file: inst/include/population_dynamics/maturity/functors/maturity_base.hpp namespace fims { /** @brief Base class for all maturity functors. * * @tparam T The type of the maturity functor. */ template struct MaturityBase : public 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 T evaluate(const T& x) = 0; }; //file: inst/include/population_dynamics/population/population.hpp /** * @brief Calculates expected proportion of individuals mature at a selected * age * * @param index_ya dimension folded index for year and age * @param age the age of maturity */ void CalculateMaturityAA(size_t index_ya, size_t age) { // this->maturity is pointing to the maturity module, which has // an evaluate function. -> can be nested. this->proportion_mature_at_age[index_ya] = 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, Fims$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::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::LogisticMaturity class is equal to the pointer to fims::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, median = 10, slope = 0.2), \"Some Other Maturity\" = list(id = 2, median = 8, slope = 0.3) ) # Fims <- Rcpp::Module(\"fims\", PACKAGE = \"FIMS\") # maturity1 <- new(Fims$LogisticMaturity) # maturity1$median$value <- 10 # maturity1$slope$value <- 0.2 # maturity2 <- new(Fims$LogisticMaturity) # maturity2$median$value <- 8 # maturity2$slope$value <- 0.3 # population1 <- new(Fims$Population) # population2 <- new(Fims$Population) # population3 <- new(Fims$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 #> median 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::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::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::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::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::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\", \"median\"), evaluate_parameter = \"x\", evaluate_parameter_type = \"double\" ) #> class LogisticSelectivityInterface : public SelectivityInterfaceBase { #> public: #> #> Parameter slope; #> Parameter median; #> #> #> LogisticSelectivityInterface() : SelectivityInterfaceBase() {} #> #> virtual ~LogisticSelectivityInterface() {} #> #> #> virtual uint32_t get_id() { return this->id; } #> #> #> virtual double evaluate(double x) { #> fims::LogisticSelectivity object; #> object.slope = this->slope.value; #> object.median = this->median.value; #> return object.evaluate(double); #> } #> #> #> virtual bool add_to_fims_tmb(){ #> std::shared_ptr > d0 = #> fims::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->median= this->median.value; #> if (this->median.estimated) { #> if (this->median.is_random_effect) { #> d0->RegisterRandomEffect(model0->median); #> } else { #> d0->RegisterParameter(model0->median); #> } #> } #> d0->selectivity_models[model0->id]=model0; #> #> #> std::shared_ptr > d1 = #> fims::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->median= this->median.value; #> if (this->median.estimated) { #> if (this->median.is_random_effect) { #> d1->RegisterRandomEffect(model1->median); #> } else { #> d1->RegisterParameter(model1->median); #> } #> } #> d1->selectivity_models[model1->id]=model1; #> #> #> std::shared_ptr > d2 = #> fims::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->median= this->median.value; #> if (this->median.estimated) { #> if (this->median.is_random_effect) { #> d2->RegisterRandomEffect(model2->median); #> } else { #> d2->RegisterParameter(model2->median); #> } #> } #> d2->selectivity_models[model2->id]=model2; #> #> #> std::shared_ptr > d3 = #> fims::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->median= this->median.value; #> if (this->median.estimated) { #> if (this->median.is_random_effect) { #> d3->RegisterRandomEffect(model3->median); #> } else { #> d3->RegisterParameter(model3->median); #> } #> } #> 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(\"median\", &LogisticSelectivityInterface::median);"},{"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. create new Rcpp fims module using Rcpp::Module call Fims$clear ensure C++ memory previous fims model run cleared .","code":"library(FIMS) library(TMB) # load the module Fims <- Rcpp::Module(\"fims\", PACKAGE = \"FIMS\") Fims$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 3 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 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(Fims$Index) ## C++ class 'Index' <0x55f12b5dc750> ## Constructors: ## Index(int) ## ## Fields: ## Rcpp::Vector<14, Rcpp::PreserveStorage> index_data ## ## Methods: ## unsigned int get_id() ## show(Fims$AgeComp) ## C++ class 'AgeComp' <0x55f12b5dc5f0> ## 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(Fims$Index, nyears) # fleet age composition data fishing_fleet_age_comp <- methods::new(Fims$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: median 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(Fims$LogisticSelectivity) ## C++ class 'LogisticSelectivity' <0x55f12b5dccd0> ## Constructors: ## LogisticSelectivity() ## ## Fields: ## Parameter median ## Parameter slope ## ## Methods: ## double evaluate(double) ## ## unsigned int get_id() ## fishing_fleet_selectivity <- methods::new(Fims$LogisticSelectivity) fishing_fleet_selectivity$median$value <- 2.0 fishing_fleet_selectivity$median$is_random_effect <- FALSE fishing_fleet_selectivity$median$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(Fims$Fleet) see fields methods available R. can see five boolean flags: estimate_F, estimate_q, is_survey, random_F, random_q. vector, log_Fmort, Parameter, 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(Fims$Fleet) ## C++ class 'Fleet' <0x55f12b5dc490> ## Constructors: ## Fleet() ## ## Fields: ## bool estimate_F ## bool estimate_q ## bool is_survey ## Rcpp::Vector<14, Rcpp::PreserveStorage> log_Fmort ## Parameter 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(Fims$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$value <- log(sqrt(log(0.01^2 + 1))) fishing_fleet$log_obs_error$estimated <- 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(Fims$Index, nyears) # survey age composition data survey_fleet_age_comp <- methods::new(Fims$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(Fims$LogisticSelectivity) survey_fleet_selectivity$median$value <- 1.5 survey_fleet_selectivity$median$is_random_effect <- FALSE survey_fleet_selectivity$median$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(Fims$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$value <- log(sqrt(log(0.2^2 + 1))) survey_fleet$log_obs_error$estimated <- 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 Fims$BevertonHoltRecruitment module. three parameters need set-: log_sigma_recruit, log_rzero, logit_steep. also need set recruitment deviations. FIMS recruitment modules boolean, estimate_deviations specify whether deviations estimated; vector, deviations set deviation values. deviations vector takes values greater 0 logged likelihood.","code":"# Recruitment recruitment <- methods::new(Fims$BevertonHoltRecruitment) methods::show(Fims$BevertonHoltRecruitment) ## C++ class 'BevertonHoltRecruitment' <0x55f12b5dc330> ## Constructors: ## BevertonHoltRecruitment() ## ## Fields: ## Rcpp::Vector<14, Rcpp::PreserveStorage> deviations ## bool estimate_deviations ## 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_deviations <- FALSE recruitment$deviations <- c( 1.0931337, 1.5494153, 0.8754735, 0.6488721, 1.9128839, 1.6593211, 0.9327825, 1.3531871, 0.9207434, 1.2304792, 1.1652038, 0.8048559, 0.8752845, 1.1187967, 0.8989675, 1.3083559, 1.2724463, 0.5799534, 0.7891447, 0.5571984, 1.3515173, 1.2452116, 0.8002613, 0.5983474, 1.1704664, 0.5828168, 0.8223697, 1.2225558, 1.4513402, 0.9308739 )"},{"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(Fims$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(Fims$LogisticMaturity) maturity$median$value <- 2.25 maturity$median$is_random_effect <- FALSE maturity$median$estimated <- FALSE maturity$slope$value <- 3 maturity$slope$is_random_effect <- FALSE maturity$slope$estimated <- FALSE # Population population <- new(Fims$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$prop_female <- 0.5 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 <- Fims$CreateTMBModel() parameters <- list(p = Fims$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.9784142 1.0550668 -4.6296906 -3.5725453 -3.0686937 -2.7603299 ## p p p p p p ## -2.9931677 -2.4044095 -2.4069257 -1.6608843 -2.2097495 -2.0036092 ## p p p p p p ## -1.8925835 -1.8306020 -2.1404148 -1.7709187 -1.7204319 -1.8273710 ## p p p p p p ## -1.1754050 -1.3800545 -1.3878159 -1.4045445 -1.0845690 -1.4013131 ## p p p p p p ## -0.9093096 -1.1045474 -1.1138094 -1.2245715 -1.2371815 -0.9143826 ## p p p p p p ## -1.2027273 -0.7965294 1.4862561 1.8588152 -14.9143799 13.8310126 ## p p p p p p ## 13.6991747 13.6194621 13.4489524 13.1492374 12.8975435 12.6729190 ## p p p p p p ## 12.6108005 12.2462906 12.2797158 11.7539203 11.9193946 13.0840648 ## ## $objective ## [1] 1517.349 ## ## $convergence ## [1] 0 ## ## $iterations ## [1] 289 ## ## $evaluations ## function gradient ## 398 290 ## ## $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.9784142 0.072654895 ## p 1.0550668 0.065712204 ## p -4.6296906 0.039598928 ## p -3.5725453 0.037459609 ## p -3.0686937 0.035872924 ## p -2.7603299 0.034437107 ## p -2.9931677 0.032449041 ## p -2.4044095 0.030677652 ## p -2.4069257 0.029412718 ## p -1.6608843 0.028427757 ## p -2.2097495 0.027488735 ## p -2.0036092 0.026143050 ## p -1.8925835 0.025395163 ## p -1.8306020 0.025092580 ## p -2.1404148 0.024477585 ## p -1.7709187 0.023811644 ## p -1.7204319 0.024025347 ## p -1.8273710 0.024328129 ## p -1.1754050 0.025384068 ## p -1.3800545 0.027444894 ## p -1.3878159 0.028233462 ## p -1.4045445 0.028978885 ## p -1.0845690 0.031152729 ## p -1.4013131 0.034444029 ## p -0.9093096 0.038145563 ## p -1.1045474 0.042401030 ## p -1.1138094 0.045973661 ## p -1.2245715 0.050487469 ## p -1.2371815 0.054775134 ## p -0.9143826 0.061567793 ## p -1.2027273 0.068428158 ## p -0.7965294 0.076196698 ## p 1.4862561 0.046242717 ## p 1.8588152 0.132512004 ## p -14.9143799 0.043661687 ## p 13.8310126 0.008195896 ## p 13.6991747 0.061783225 ## p 13.6194621 0.060498608 ## p 13.4489524 0.064465962 ## p 13.1492374 0.074174302 ## p 12.8975435 0.084390756 ## p 12.6729190 0.095547775 ## p 12.6108005 0.101086539 ## p 12.2462906 0.127124763 ## p 12.2797158 0.135012811 ## p 11.7539203 0.205589070 ## p 11.9193946 0.238277035 ## p 13.0840648 0.104326567"},{"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.006314888 ## 2 0.006170738 0.006356033 ## 3 0.005977854 0.006355277 ## 4 0.005907966 0.006242256 ## 5 0.007211237 0.006012800 ## 6 0.006867264 0.006017967 ## 7 0.006329387 0.005943434 ## 8 0.006137000 0.005852774 ## 9 0.005279601 0.005261591 ## 10 0.005666829 0.005084819 ## 11 0.004806935 0.004821759 ## 12 0.004374876 0.004534016 ## 13 0.003992211 0.004207409 ## 14 0.004188884 0.004044696 ## 15 0.003711145 0.003748412 ## 16 0.003818704 0.003500206 ## 17 0.002878658 0.003399884 ## 18 0.002936660 0.002967888 ## 19 0.002972886 0.002698278 ## 20 0.002484963 0.002419281 ## 21 0.001983795 0.002191646 ## 22 0.001738507 0.001945128 ## 23 0.002122178 0.001965197 ## 24 0.001617189 0.001729711 ## 25 0.001745169 0.001586372 ## 26 0.001414111 0.001486529 ## 27 0.001350571 0.001431010 ## 28 0.001323396 0.001387283 ## 29 0.001069791 0.001309403 ## 30 0.001459411 0.001409964 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.1959 ## 2 460.6336 460.5301 ## 3 752.1299 751.9285 ## 4 996.9872 996.7151 ## 5 769.6972 769.5561 ## 6 1352.7309 1352.4443 ## 7 1317.7236 1317.4962 ## 8 2626.0240 2625.3646 ## 9 1415.1162 1414.8588 ## 10 1666.0168 1665.5184 ## 11 1751.8060 1751.2858 ## 12 1739.5435 1738.9513 ## 13 1208.5391 1208.3924 ## 14 1647.6643 1647.2346 ## 15 1593.6254 1593.1009 ## 16 1343.2277 1343.0123 ## 17 2337.0098 2336.1672 ## 18 1685.7172 1685.1893 ## 19 1529.8325 1529.6612 ## 20 1359.5044 1359.2668 ## 21 1637.5099 1637.0599 ## 22 1081.9126 1082.1721 ## 23 1648.7687 1650.0295 ## 24 1230.1199 1230.3143 ## 25 1133.8784 1134.2294 ## 26 956.5872 957.1986 ## 27 911.0781 911.7779 ## 28 1172.4887 1173.1903 ## 29 852.1934 852.3924 ## 30 1278.3228 1278.3754 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":"Fims$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 Fims <- Rcpp::Module(\"fims\", PACKAGE = \"FIMS\") maturity <- new(Fims$LogisticMaturity) # Populate the maturity module with parameter values. maturity$median$value <- 10 maturity$median$is_random_effect <- FALSE maturity$median$estimated <- FALSE maturity$slope$value <- 0.2 maturity$slope$is_random_effect <- FALSE maturity$slope$estimated <- FALSE population <- new(Fims$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 Fims$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), median 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., median, 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(\"median\", &LogisticMaturityInterface::median) .field(\"slope\", &LogisticMaturityInterface::slope) .method(\"get_id\", &LogisticMaturityInterface::get_id) .method(\"evaluate\", &LogisticMaturityInterface::evaluate); maturity <- new(Fims$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 median; /**< the index value at which the response reaches .5 */ Parameter slope; /**< the width of the curve at the median */ ... } 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::. 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 ModelTraits class that contains the DataVector * and ParameterVector types. */ template struct 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::Information class order register maturity parameters specify whether random effects. setting two pointers interface: d0 points information, lm0, points logistic maturity module. Linking fims::LogisticMaturity class allows us link values input R values used model calculation: can also link two pointers together fims::Information class links fims::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::Information std::shared_ptr > d0 = fims::Information::GetInstance(); if (this->median.estimated) { if (this->median.is_random_effect) { /* if median is estimated and a random effect, the median value from LogisticMaturityInterface (lm0->median) is passed to the Information member function RegisterRandomEffect */ d0->RegisterRandomEffect(lm0->median); } else { /* if median is estimated and not a random effect, the median value from LogisticMaturityInterface (lm0->median) is passed to the Information member function RegisterParameter */ d0->RegisterParameter(lm0->median); } } //file: rcpp_maturity.hpp //lm0 is a shared pointer that points to fims::LogisticMaturity std::shared_ptr > lm0 = std::make_shared >(); /* the median value from LogisticMaturity (lm0->median) equals the median value from LogisticMaturityInterface (this->median.value) */ lm0->median = this->median.value; //file: rcpp_maturity.hpp /* the maturity_models pointer from Information that matches the id of the fims::LogisticMaturity class is equal to the pointer to fims::LogisticMaturity */ d0->maturity_models[lm0->id] = lm0;"},{"path":"https://NOAA-FIMS.github.io/FIMS/articles/fims-path-maturity.html","id":"inside-the-fimslogisticmaturity-class","dir":"Articles","previous_headings":"","what":"Inside the fims::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 median slope values.","code":"namespace fims { /** * @brief LogisticMaturity class that returns the logistic function value * from fims_math. */ template struct LogisticMaturity : public MaturityBase { T median; /*!< 50% quantile of the value of the quantity of interest (x); e.g., age at which 50% of the fish are mature */ T 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 T evaluate(const T& x) { return fims::logistic(median, 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 */ Fims$population$SetMaturity(maturity$get_id()) //file: inst/include/population_dynamics/maturity/functors/maturity_base.hpp namespace fims { /** @brief Base class for all maturity functors. * * @tparam T The type of the maturity functor. */ template struct MaturityBase : public 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 T evaluate(const T& 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, Fims$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::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::LogisticMaturity class is equal to the pointer to fims::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, median = 10, slope = 0.2), \"Some Other Maturity\" = list(id = 2, median = 8, slope = 0.3) ) # Fims <- Rcpp::Module(\"fims\", PACKAGE = \"FIMS\") # maturity1 <- new(Fims$LogisticMaturity) # maturity1$median$value <- 10 # maturity1$slope$value <- 0.2 # maturity2 <- new(Fims$LogisticMaturity) # maturity2$median$value <- 8 # maturity2$slope$value <- 0.3 # population1 <- new(Fims$Population) # population2 <- new(Fims$Population) # population3 <- new(Fims$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 #> median 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::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::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::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::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::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\", \"median\"), evaluate_parameter = \"x\", evaluate_parameter_type = \"double\" ) #> class LogisticSelectivityInterface : public SelectivityInterfaceBase { #> public: #> #> Parameter slope; #> Parameter median; #> #> #> LogisticSelectivityInterface() : SelectivityInterfaceBase() {} #> #> virtual ~LogisticSelectivityInterface() {} #> #> #> virtual uint32_t get_id() { return this->id; } #> #> #> virtual double evaluate(double x) { #> fims::LogisticSelectivity object; #> object.slope = this->slope.value; #> object.median = this->median.value; #> return object.evaluate(double); #> } #> #> #> virtual bool add_to_fims_tmb(){ #> std::shared_ptr > d0 = #> fims::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->median= this->median.value; #> if (this->median.estimated) { #> if (this->median.is_random_effect) { #> d0->RegisterRandomEffect(model0->median); #> } else { #> d0->RegisterParameter(model0->median); #> } #> } #> d0->selectivity_models[model0->id]=model0; #> #> #> std::shared_ptr > d1 = #> fims::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->median= this->median.value; #> if (this->median.estimated) { #> if (this->median.is_random_effect) { #> d1->RegisterRandomEffect(model1->median); #> } else { #> d1->RegisterParameter(model1->median); #> } #> } #> d1->selectivity_models[model1->id]=model1; #> #> #> std::shared_ptr > d2 = #> fims::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->median= this->median.value; #> if (this->median.estimated) { #> if (this->median.is_random_effect) { #> d2->RegisterRandomEffect(model2->median); #> } else { #> d2->RegisterParameter(model2->median); #> } #> } #> d2->selectivity_models[model2->id]=model2; #> #> #> std::shared_ptr > d3 = #> fims::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->median= this->median.value; #> if (this->median.estimated) { #> if (this->median.is_random_effect) { #> d3->RegisterRandomEffect(model3->median); #> } else { #> d3->RegisterParameter(model3->median); #> } #> } #> 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(\"median\", &LogisticSelectivityInterface::median);"},{"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\" ) }"}]