View source: R/15.3-analysis-sensitivity.R
| compare_individuals | R Documentation |
Compares performance metrics between individuals in hierarchical models. Provides statistical summaries and identifies outliers.
compare_individuals(result, metrics = "all", confidence_level = 0.95)
result |
FB4 result object from hierarchical method |
metrics |
Vector of metrics to compare ("consumption", "growth", "efficiency", "all") |
confidence_level |
Confidence level for comparisons (default 0.95) |
A named list with at minimum three context elements:
n_individuals (integer), metrics_compared (character
vector), and confidence_level (numeric). Depending on
metrics, the following sub-lists are appended; each is produced
by an internal summary helper and contains metric_name,
n_valid, mean, sd, min, max,
median, cv, range, outliers, and
performance: consumption, efficiency, and
p_value. The growth element (when requested) is itself a
list with two such summaries (total_growth and
relative_growth). A rankings data.frame (one row
per individual; columns for per-metric ranks, composite_rank, and
overall_rank) is always appended. Stops with an error if
result was not produced by the hierarchical method.
data(fish4_parameters)
sp <- fish4_parameters[["Oncorhynchus tshawytscha"]]$life_stages$adult
info <- fish4_parameters[["Oncorhynchus tshawytscha"]]$species_info
bio <- Bioenergetic(
species_params = sp,
species_info = info,
environmental_data = list(
temperature = data.frame(Day = 1:30, Temperature = rep(12, 30))
),
diet_data = list(
proportions = data.frame(Day = 1:30, Prey1 = 1.0),
energies = data.frame(Day = 1:30, Prey1 = 5000),
prey_names = "Prey1"
),
simulation_settings = list(initial_weight = 100, duration = 30)
)
bio$species_params$predator$ED_ini <- 5000
bio$species_params$predator$ED_end <- 5500
mr_data <- data.frame(
individual_id = paste0("fish_", 1:5),
initial_weight = c(10, 12, 11, 13, 9),
final_weight = c(80, 95, 85, 100, 70)
)
result_hier <- run_fb4(bio, strategy = "hierarchical", backend = "tmb",
fit_to = "Weight", observed_weights = mr_data,
verbose = FALSE)
comparison <- compare_individuals(result_hier)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.