View source: R/trunc_gamma_para.R
trunc_gamma_para | R Documentation |
This function estimates the shape and scale parameters of a truncated Gamma distribution based on expert-provided summary statistics, including the mean, median, standard deviation, and selected quantiles. Parameter estimation is performed using a grid search combined with weighted least squares optimization. Parallel computing is employed to accelerate the estimation process.
trunc_gamma_para(
L,
U,
expert_data,
weights = c(10, 10, 2, 1, 1),
num_cores = 4,
seed = NULL
)
L |
Numeric. Lower bound of the truncated Gamma distribution. |
U |
Numeric. Upper bound of the truncated Gamma distribution. |
expert_data |
A list of named lists, where each inner list represents one expert's input. Each expert can provide any subset of the following named elements:
|
weights |
Numeric vector of length 5. Specifies the relative importance of each summary statistic in the optimization procedure. The order corresponds to:
|
num_cores |
Integer. Number of CPU cores to use for parallel computation. Default is |
seed |
Optional integer. If provided, sets the seed for reproducibility. |
A list with the following components:
Numeric. Estimated shape parameter of the Gamma distribution.
Numeric. Estimated scale parameter of the Gamma distribution.
# Define expert-provided summary data
expert_data_correct <- list(
list(mean = 2.2, median = 2.27, sd = NULL, q25 = NULL, q975 = NULL), # Expert A
list(mean = 2.1, median = 2.3, sd = NULL, q25 = NULL, q975 = NULL), # Expert B
list(mean = NULL, median = 2.31, sd = NULL, q25 = NULL, q975 = NULL) # Expert C
)
# Estimate parameters using truncated gamma prior
trunc_gamma_para(L = 2,U = 2.5,expert_data = expert_data_correct,num_cores = 4)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.