Description Usage Arguments Value Examples
View source: R/bound_frequency_exceeding_bp.R
This function uses the Nelder-Mead algorithm for the optimization procedure. This algorithm is implemented in the 'nmkb' function from the dfoptim package.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | bound_frequency_exceeding_bp(
obj_func_bp,
maximize = FALSE,
lower_parameters = c(1, -5, -20),
upper_parameters = c(6, 1, -10),
niter_ale = 1000,
niter_epi = 1000,
threshold = 1,
exposure_scenario = "av",
suff_stat_concentration,
suff_stat_consumption,
consumption_change_vals_EKE = c(-15, 7.5),
consumption_change_probs_EKE = c(0.25, 0.75),
consumers_info_sample_size,
concentration_mu0 = 2.75,
concentration_v0 = 5,
concentration_alpha0 = 1,
concentration_beta0 = 1,
sufficient_statistics_concentration = TRUE,
consumption_mu0 = -2.5,
consumption_v0 = 5,
consumption_alpha0 = 1,
consumption_beta0 = 1,
sufficient_statistics_consumption = TRUE,
consumption_event_alpha0 = 1,
consumption_event_beta0 = 1,
percentile = NULL
)
|
obj_func_bp |
The objective function to optimize. |
maximize |
A logical variable indicating whether the objective function should be maximized. Default is |
lower_parameters |
Lower bounds on the parameters. A vector of the same length as the parameters. |
upper_parameters |
Upper bounds on the parameters. A vector of the same length as the parameters. |
niter_ale |
number of generated samples |
niter_epi |
number of generated parameters from the posterior distrbutions (it indicates the number of repetitions the assessment will be done) |
threshold |
safety threshold |
exposure_scenario |
a value that indicates if the assessment is done on average consumption scenario by 'av' or on high consumption scenario by 'perc_95'. Default is 'av' |
suff_stat_concentration |
a vector of sufficient statistics: sample_size, sample_mean and sample_sd
corresponding to concentration. If sufficient_statistics_concentration = |
suff_stat_consumption |
a vector of sufficient statistics: sample_size, sample_mean and sample_sd
corresponding to consumption. If sufficient_statistics_consumption = |
consumption_change_vals_EKE |
a vector of elicited values from experts |
consumption_change_probs_EKE |
a vector of elicited probabilities from experts |
consumers_info_sample_size |
a vector with the sample size of non_consumer_sample_size and consumer_sample_size |
concentration_mu0 |
prior hyperparameter mu0 for the normal-gamma distribution corresponding to concentration |
concentration_v0 |
prior hyperparameter v0 for the normal-gamma distribution corresponding to concentration |
concentration_alpha0 |
prior hyperparameter alpha0 for the normal-gamma distribution corresponding to concentration |
concentration_beta0 |
prior hyperparameter beta0 for the normal-gamma distribution corresponding to concentration |
sufficient_statistics_concentration |
logical; if |
consumption_mu0 |
prior hyperparameter mu0 for the normal-gamma distribution corresponding to consumption |
consumption_v0 |
prior hyperparameter v0 for the normal-gamma distribution corresponding to consumption |
consumption_alpha0 |
prior hyperparameter alpha0 for the normal-gamma distribution corresponding to consumption |
consumption_beta0 |
prior hyperparameter beta0 for the normal-gamma distribution corresponding to consumption |
sufficient_statistics_consumption |
logical; if |
consumption_event_alpha0 |
prior hyperparameter alpha0 for the beta distribution corresponding to consumption event |
consumption_event_beta0 |
prior hyperparameter beta0 for the beta distribution corresponding to consumption event |
percentile |
a value between 1 and 100 which indicates a percentile. By default is NULL |
## Two lists
opt_value
opt_freq
The components of the first list (opt_value) are
Best estimate of the parameter vector found by the algorithm
The value of the objective function at termination
The number of times the objective function was evaluated
The number of times the algorithm had to be restarted when it stagnated
An integer code indicating type of convergence. 0 indicates successful convergence. Positive integer codes indicate failure to converge
Text message indicating the type of convergence or failure
The components of the second list (opt_freq) are
The estimated probability of consumption events
A list with the values of the prior and posterior parameters of concentration
A list with the prior and posterior parameters of consumption
A vector with the estimated frequency of exceeding the threshold (the lenght is niter_epi)
The expected value of the frequency of exceeding the threshold
The highest posterior density interval of the frequency of exceeding the threshold
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | ## Not run:
lower_bound_average_consumption <-
bound_frequency_exceeding_bp(obj_func_bp = obj_func_bp, maximize = FALSE,
lower_parameters = c(1, -5, -20),
upper_parameters = c(6, 1, -10),
niter_ale = 2000, niter_epi = 2000, threshold = 1, exposure_scenario = 'av',
suff_stat_concentration = data_assessment$log_concentration_ss_data,
suff_stat_consumption = data_assessment$log_consumption_ss_data,
consumption_change_vals_EKE = c(-15, 7.5),
consumption_change_probs_EKE = c(0.25, 0.75),
consumers_info_sample_size = data_assessment$consumers_info_sample_size,
concentration_mu0 = 2.75,
concentration_v0 = 5, concentration_alpha0 = 1, concentration_beta0 = 1,
sufficient_statistics_concentration = TRUE,
consumption_mu0 = -2.5,
consumption_v0 = 5, consumption_alpha0 = 1, consumption_beta0 = 1,
sufficient_statistics_consumption = TRUE,
consumption_event_alpha0 = 1, consumption_event_beta0 = 1, percentile = NULL)
upper_bound_average_consumption <-
bound_frequency_exceeding_bp(obj_func_bp = obj_func_bp, maximize = TRUE,
lower_parameters = c(1, -5, -20),
upper_parameters = c(6, 1, -10),
niter_ale = 2000, niter_epi = 2000, threshold = 1, exposure_scenario = 'av',
suff_stat_concentration = data_assessment$log_concentration_ss_data,
suff_stat_consumption = data_assessment$log_consumption_ss_data,
consumption_change_vals_EKE = c(-15, 7.5),
consumption_change_probs_EKE = c(0.25, 0.75),
consumers_info_sample_size = data_assessment$consumers_info_sample_size,
concentration_mu0 = 2.75,
concentration_v0 = 5, concentration_alpha0 = 1, concentration_beta0 = 1,
sufficient_statistics_concentration = TRUE,
consumption_mu0 = -2.5,
consumption_v0 = 5, consumption_alpha0 = 1, consumption_beta0 = 1,
sufficient_statistics_consumption = TRUE,
consumption_event_alpha0 = 1, consumption_event_beta0 = 1, percentile = NULL)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.