View source: R/15.4-analysis-uncertainty.R
| predict_consumption_delta | R Documentation |
Propagates p-value uncertainty to consumption predictions using the delta method. Computes numerical derivatives and applies first-order approximation for uncertainty propagation. Suitable when the relationship between p and consumption is approximately linear.
predict_consumption_delta(
p_est,
p_se,
bio_obj,
delta_size = 0.001,
first_day = 1,
last_day = 365,
verbose = FALSE
)
p_est |
Estimated p-value (feeding level parameter) |
p_se |
Standard error of p-value estimate |
bio_obj |
Bioenergetic object with simulation settings and environmental data |
delta_size |
Small increment for numerical derivative computation, default 0.001 |
first_day |
First simulation day, default 1 |
last_day |
Last simulation day, default 365 |
verbose |
Show progress messages, default FALSE |
The delta method uses first-order Taylor series approximation: Var(f(X)) ~ [f'(mu)]^2 * Var(X)
The linearity check verifies that the derivative times delta_size is small relative to the consumption estimate, indicating local linearity.
A named list with elements:
methodCharacter string "delta".
consumption_estPoint estimate of total consumption (g).
consumption_seStandard error of consumption estimate (g).
consumption_ciNumeric vector of length 2 with lower and upper confidence interval bounds (g).
derivativeNumerical derivative of consumption with respect to p.
linearity_checkLogical; TRUE if the linearity assumption
appears satisfied.
p_estThe supplied p_est value.
p_seThe supplied p_se value.
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
uncertainty_result <- predict_consumption_delta(
p_est = 0.5,
p_se = 0.05,
bio_obj = bio,
last_day = 30
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.