sample_fish | R Documentation |
Create sampled data from numbers-at-age data to create composition data from and Atlantis scenario by default. todo: add more information here later
sample_fish(dat, effN, sample = TRUE)
dat |
A
The |
effN |
Efficiency for each species: a matrix with nrow=length(species). Columns: species: the species name. Matches names in species effN: the effective N for each species (effective sample size) |
sample |
Logical asking whether to apply multinomial sampling using effN.
Setting to false results in simple aggregation of atoutput to annual age class values.
The default value is |
The function takes numbers-at-age data from an Atlantis scenario
where the data was read in from Atlantis output using load_nc
within run_truth
. One does not need to use these functions
to create dat
, rather you must only ensure that the structure of
dat
is the same.
Currently, the function creates sampled numbers-at-age data to create
composition data (age, convert to length, age-at-weigth, etc.).
sums across boxes to properly weight the
numbers-at-age data. Subsequently, the data is sampled using a multinomial
with the effective sample size based on the number of fish you pass in
dat
and prop
. Density data are also needed for biological sampling.
Therefore, when called with sample=FALSE for density data,
applies median to aggregate and does not apply multinomial.
The function starts with numbers-at-age data and therefore the function then must
sum across boxes to properly weight them. Subsequently, the function then uses
a multinomial with a specified effective sample size.
The function could be improved by adding an argument to create spatial
strata which are conglomerations of subsets of boxes.
Poseidon
directory <- system.file("extdata", "SETAS_Example", package = "atlantisom")
scenario <- "outputs"
species <- c("Pisciv_T_Fish","Pisciv_S_Fish")
results <- run_truth(scenario = scenario,
dir = directory,
file_fgs = "Functional_groups.csv",
file_bgm = "Geography.bgm",
select_groups = species,
file_init = "Initial_condition.nc",
file_biolprm = "Biology.prm",
file_runprm = "Run_settings.xml",
file_fish = "Fisheries.csv")
boxes <- 1:3
effic <- data.frame(species=c("Pisciv_T_Fish","Pisciv_S_Fish"), efficiency=c(0.3,0.1))
selex <- data.frame(species=c(rep("Pisciv_T_Fish",10),rep("Pisciv_S_Fish",10)),
agecl=c(1:10,1:10),
selex=c(0,0,0.1,0.5,0.8,1,1,1,1,1,0,0,0.1,0.3,0.5,0.7,0.9,1,1,1))
tmp <- create_survey(dat=results$nums, time=seq(10,55,3), species=species, boxes=boxes, effic=effic, selex=selex)
effN <- data.frame(species=species, effN=c(200, 500))
samp <- sample_fish(tmp, effN=effN)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.