Skip to contents

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.

Usage

predict_consumption_delta(
  p_est,
  p_se,
  bio_obj,
  delta_size = 0.001,
  first_day = 1,
  last_day = 365,
  verbose = FALSE
)

Arguments

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

Value

A named list with elements:

method

Character string "delta".

consumption_est

Point estimate of total consumption (g).

consumption_se

Standard error of consumption estimate (g).

consumption_ci

Numeric vector of length 2 with lower and upper confidence interval bounds (g).

derivative

Numerical derivative of consumption with respect to p.

linearity_check

Logical; TRUE if the linearity assumption appears satisfied.

p_est

The supplied p_est value.

p_se

The supplied p_se value.

Details

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.

Examples

# \donttest{
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)
)
#> Bioenergetic object created for: Oncorhynchus tshawytscha
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
)
#> Validation warnings:
#> Missing optional parameters (will be calculated): CG1, CG2
#> Object is ready for simulation
#> Validation warnings:
#> Missing optional parameters (will be calculated): CG1, CG2
#> Object is ready for simulation
#> Processing species parameters...
#> Processing temporal data...
#> No indigestible fraction data provided, using default 0% for all prey (FB4 default)
#> Processing simulation settings...
#> Simulation data preparation complete. Ready for simulation.
#> Validation warnings:
#> Missing optional parameters (will be calculated): CG1, CG2
#> Object is ready for simulation
#> Validation warnings:
#> Missing optional parameters (will be calculated): CG1, CG2
#> Object is ready for simulation
#> Processing species parameters...
#> Processing temporal data...
#> No indigestible fraction data provided, using default 0% for all prey (FB4 default)
#> Processing simulation settings...
#> Simulation data preparation complete. Ready for simulation.
#> Validation warnings:
#> Missing optional parameters (will be calculated): CG1, CG2
#> Object is ready for simulation
#> Validation warnings:
#> Missing optional parameters (will be calculated): CG1, CG2
#> Object is ready for simulation
#> Processing species parameters...
#> Processing temporal data...
#> No indigestible fraction data provided, using default 0% for all prey (FB4 default)
#> Processing simulation settings...
#> Simulation data preparation complete. Ready for simulation.
# }