generated from nmfs-opensci/NOAA-quarto-simple
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test file for fimsfit using pollock
- Loading branch information
1 parent
6470140
commit 440e159
Showing
1 changed file
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Load packages and input data ------------------------------------------- | ||
# Load required packages | ||
packages <- c("dplyr", "tidyr", "ggplot2", "TMB", "reshape2", "here", "remotes", "lubridate") | ||
invisible(lapply(packages, library, character.only = TRUE)) | ||
|
||
# Install the FIMS package from specific repositories | ||
# install.packages("FIMS", repos = c("https://noaa-fims.r-universe.dev", "https://cloud.r-project.org")) | ||
|
||
# detach("package:FIMS", unload = TRUE) | ||
library(FIMS) | ||
|
||
# Define the years and ages for the assessment | ||
years <- 1970:2023 | ||
nyears <- length(years) | ||
nseasons <- 1 | ||
nages <- 10 | ||
ages <- 1:nages | ||
|
||
# Source the script to prepare input data | ||
source(file.path("content", "R", "pk_prepare_dat.R")) | ||
|
||
# Run FIMS without helper functions --------------------------------------- | ||
clear() | ||
clear_logs() | ||
|
||
# Source the script to prepare FIMS inputs without using helper functions | ||
source(file.path(getwd(), "content", "R", "pk_prepare_FIMS_inputs.R")) | ||
|
||
# Create the TMB model and generate the report | ||
success <- CreateTMBModel() | ||
parameters <- list(p = get_fixed()) | ||
parameters$p[1] = 3.5 | ||
input <- list(data=age_frame, parameters=parameters, version='GOA pollock') | ||
|
||
## devtools::load_all('C:/Users/cole.monnahan/FIMS') | ||
|
||
fit <- fit_fims(input, verbose=FALSE) | ||
fit <- fit_fims(input) |