View source: R/f_createObject.R
ebScores | R Documentation |
ebScores
calculates EBGM scores as well as the quantiles from the
posterior distribution and returns an object of class openEBGM.
ebScores(processed, hyper_estimate, quantiles = c(5, 95), digits = 2)
processed |
A data frame resulting from running |
hyper_estimate |
A list resulting from running |
quantiles |
Either a numeric vector of desired quantiles to be calculated from the posterior distribution or NULL for no calculation of quantiles. |
digits |
A whole number scalar specifying how many decimal places to use for rounding EBGM and the quantiles scores. |
This function takes the processed data as well as the hyperparameter estimates and instantiates an object of class openEBGM. This object then contains additional calculations, such as the EBGM score, and the quantiles that are supplied by the quantiles parameter at the time of calling the function.
The function allows for the choice of an arbitrary amount of quantiles or no quantiles at all to be calculated. This may be helpful for large datasets, or when the EBGM score is the only metric of interest.
An openEBGM object (class S3) containing:
data: A data frame containing the results (scores, etc.).
hyper_parameters: A list containing the hyperparameter estimation results.
quantiles: The chosen percentiles.
data.table::setDTthreads(2) #only needed for CRAN checks
theta_init <- data.frame(
alpha1 = c(0.5, 1),
beta1 = c(0.5, 1),
alpha2 = c(2, 3),
beta2 = c(2, 3),
p = c(0.1, 0.2)
)
data(caers)
proc <- processRaw(caers)
squashed <- squashData(proc, bin_size = 300, keep_pts = 10)
squashed <- squashData(squashed, count = 2, bin_size = 13, keep_pts = 10)
suppressWarnings(
hypers <- autoHyper(data = squashed, theta_init = theta_init)
)
obj <- ebScores(processed = proc, hyper_estimate = hypers, quantiles = 5)
print(obj)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.