Skip to content

Commit

Permalink
Updated: Enhanced explanations for both code and data.
Browse files Browse the repository at this point in the history
  • Loading branch information
kyuhank committed Dec 8, 2023
1 parent 41ec743 commit a940bc4
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 27 deletions.
4 changes: 1 addition & 3 deletions Analysis/Diagnostics/setup.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
# MIT License: https://opensource.org/licenses/MIT
# ———————————————————————————————



cat('\n\n Setup begins \n\n')

LocalRun=T
Expand Down Expand Up @@ -51,7 +49,7 @@ nsimJitter <- as.integer(Sys.getenv("nsimJitter", 100))
npeels <- as.integer(Sys.getenv("npeels", 8))

RetroTest <- as.integer(Sys.getenv("RetroTest", 1))
JitAnalysis <- as.integer(Sys.getenv("JitAnalysis", 1))
JitAnalysis <- as.integer(Sys.getenv("JitAnalysis", 0))
ResidTest <- as.integer(Sys.getenv("ResidTest", 1))
SelfTestObs <- as.integer(Sys.getenv("SelfTestObs", 1))

Expand Down
19 changes: 1 addition & 18 deletions Analysis/EstimCheck/SelfTestBoth.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,35 +6,18 @@
# MIT License: https://opensource.org/licenses/MIT
# ———————————————————————————————



######################################
## self test (Parametric bootstrap) ##
######################################

cat('\n\n running the parametric bootstrap test (SelfTestBoth: both obs and process errors are randomised) \n\n')
#cat('\n\n also REML (on/off) \n\n')

# objTemp1=apply(ModelsEstimResults, 2, function(x) x$f )
# objTemp2=apply(ModelsEstimResults, 2, function(x) x$f )

# for(i in 1:length(objTemp1)) {
# objTemp1[[i]]$Penal=1
# objTemp2[[i]]$Penal=0
# }

#print(paste0("number of models: ", length(c(objTemp1, objTemp2)) ))


BootTestResults2=parallel::mcmapply(MackBoot,
FittedObj=apply(ModelsEstimResults, 2, function(x) x$f),
#FittedObj=c(objTemp1, objTemp2),
#REML=list(F,T),
#REML=list(F,T),
MoreArgs = list(nsims=nsimSelfBoth,
SimProcess=1,
seed=seed,
silent=T),
mc.cores = nGridJobs,
SIMPLIFY = T)


2 changes: 0 additions & 2 deletions Analysis/EstimCheck/setup.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
# MIT License: https://opensource.org/licenses/MIT
# ———————————————————————————————



cat('\n\n Setup begins \n\n')

LocalRun=T
Expand Down
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[![DOI](https://zenodo.org/badge/724971318.svg)](https://zenodo.org/doi/10.5281/zenodo.10258210)

This repository contains the code and data for the following paper:

This repository contains the code and data for the following paper, which ensures reproducibility and transparency of the research:

## **Enhancing data-limited assessments: Optimal utilization of fishery-dependent data through random effects &mdash; A case study on Korea chub mackerel (_Scomber japonicus_)**

Expand All @@ -13,20 +14,24 @@ In a state-space framework, temporal variations in fishery-dependent processes c
## How to run the code

1. Navigate to the `Analysis` folder.
2. Execute the scripts by entering `makefile` in the terminal, ensuring that the working directory is set to the appropriate subfolders in this order: `Modelfitting`, `Diagnostics`, and `EstimCheck`. Before running the `Modelfitting` subfolder, modify the `setup.R` script by changing `penalty=0` to `penalty=1` for the `ModelEstim.R` script. `penalty=1` enables the use of a non-degenerate estimator.
2. Execute the scripts by entering `makefile` in the terminal, ensuring that the working directory is set to the appropriate subfolders in this order: `Modelfitting`, `Diagnostics`, and `EstimCheck`.

The execution order should be:
i. `Modelfitting`
ii. `Diagnostics`
iii. `EstimCheck`

## Important things to note when running the code
- Certain datasets, such as CPUE (Catch Per Unit Effort) and length composition data, were digitized from figures published in earlier studies (Kim et al., 2018; Jung, 2019; Gim, 2019) using WebPlotDigitizer ([Rohatgi, 2022](https://automeris.io/WebPlotDigitizer/)).

- Certain datasets, such as CPUE (Catch Per Unit Effort) and length composition data, were digitized from figures published in earlier studies openly accessible online (Kim et al., 2018; Jung, 2019; Gim, 2019) using WebPlotDigitizer ([Rohatgi, 2022](https://automeris.io/WebPlotDigitizer/)). The accuracy of the digitization was verified by comparing the digitized data with the original figures.

- The data for the length composition were rounded to integers and the CPUE (Catch Per Unit Effort) to two decimal places in the actual analysis. However, we presented the data in its raw form for transparency regarding digitization.

- Results from simulation runs, such as those from parametric bootstrap, are not stored in this repository due to their substantial file size. However, the repository does include the code necessary to conduct these simulations. Please note that running these simulations on a local machine without parallelization may be time-consuming. Should you require the simulation results, they can be requested directly from the author of this repository.

## References

Figures used for digitization were sourced from the following references:
Figures used for digitization were sourced from the following publications:

- Kim, K., Hyun, S.-Y., & Seo, Y. I. (2018). (Korean) Inference of age compositions in a sample of fish from fish length data. *The Korean Journal of Fisheries and Aquatic Sciences*, 51(1), 79–90. [DOI](https://doi.org/10.5657/KFAS.2018.0079)

Expand Down
Binary file modified Results/ModelFitted.RData
Binary file not shown.

0 comments on commit a940bc4

Please sign in to comment.