View source: R/14.2.3-strategy-optim.R
| optim_search_p_value | R Documentation |
Uses R's optim to find the p_value that minimises
the absolute difference between the simulated metric and the target value.
optim_search_p_value(
target_value,
fit_type,
simulation_function,
method = "Brent",
lower = 0.01,
upper = 5,
hessian = FALSE
)
target_value |
Target value (final weight or total consumption) |
fit_type |
Type of fitting ("weight" or "consumption") |
simulation_function |
Function that runs simulation and returns metric |
method |
Optimization method ("Brent", "L-BFGS-B", etc.) |
lower |
Lower bound for p_value search, default 0.01 |
upper |
Upper bound for p_value search, default 5.0 |
hessian |
Whether to compute Hessian for standard errors, default FALSE |
List with fitted p_value and convergence information
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.