sample_diet | R Documentation |
Create sampled diet composition data from the total consumption in an Atlantis scenario. Observation error and bias are added.
sample_diet(dat, fgs, unidprey = 0, alphamult = 1e+07)
dat |
A |
fgs |
A data frame created by |
unidprey |
default (0) returns correctly identified prey, while decimal values up to 1 allocate up to that proportion of prey to an unidentified category at random. |
alphamult |
default (10000000) returns true diet comps, while a lower number (~10) returns high variance diet comp |
The function takes diet composition data from an Atlantis scenario
where the data was read in from Atlantis output using load_diet_comp
or
load_detailed_diet_comp
.
One does not need to use these functions to create dat
, rather you must only
ensure that the structure of dat
is the same.
The user supplies a parameter unidprey
ranging from 0 to 1 that determines
bias in sample diet composition. Bias is added by allocating a random portion of
each group to an "unidentified prey" category. The default unidprey
is 0
which results in no reallocation of prey to unidentified categories.
The user supplies a parameter alphamult
that detemines observation error
for sample diet compostion strays using a dirichlet distribution. The default
alphamult
is 10000000 which results in minimal observation error in diet
composition. Lower values of alphamult
increase observation error.
The function adjusts the remaining diet so each predator diet per agecl (if in
the input data) and time.days sums to one.
Robert Wildermuth, Sarah Gaichas
## Not run:
d <- system.file("extdata", "SETAS_Example", package = "atlantisom")
groups <- load_fgs(dir = directory, "Functional_groups.csv")
groups <- groups[groups$IsTurnedOn > 0, "Name"]
results <- run_truth(scenario = "outputs",
dir = d,
file_fgs = "Functional_groups.csv",
file_bgm = "Geography.bgm",
select_groups = groups,
file_init = "Initial_condition.nc",
file_biolprm = "Biology.prm",
file_runprm = "Run_settings.xml",
file_fish = "Fisheries.csv")
# rows should each sum to one:
rowSums(dat[,2:NCOL(dat)])
dim(dat)
obsDietComp <- sample_diet(dat)
dim(obsDietComp)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.