z_test_BFF {BFF} | R Documentation |
z_test_BFF
Description
z_test_BFF constructs BFFs based on the z test. BFFs depend on hyperparameters r and tau^2 which determine the shape and scale of the prior distributions which define the alternative hypotheses. By setting r > 1, we use higher-order moments for replicated studies. Fractional moments are set with r > 1 and r not an integer. All results are on the log scale. Plot saved to working directory unless a full path is specified in the 'savename' variable of the function.
Usage
z_test_BFF(
z_stat,
n = NULL,
one_sample = TRUE,
n1 = NULL,
n2 = NULL,
savename = NULL,
maximize = FALSE,
r = 1,
tau2 = NULL,
save = TRUE,
xlab = NULL,
ylab = NULL,
main = NULL
)
Arguments
z_stat |
z statistic |
n |
sample size (if one sample test) |
one_sample |
is test one sided? Default is TRUE |
n1 |
sample size of group one for two sample test |
n2 |
sample size of group two for two sample test |
savename |
optional, filename for saving the pdf of the final plot |
maximize |
Should the value of r be maximized? Default is FALSE. Only set to TRUE if analyzing multiple studies |
r |
r value |
tau2 |
tau2 values (can be a single entry or a vector of values) |
save |
should a copy of the plot be saved? |
xlab |
optional, x label for plot |
ylab |
optional, y label for plot |
main |
optional, main label for plot |
Value
Returns Bayes factor function results
BFF | The log of the Bayes Factor Function values |
effect_size | Effect sizes tested (seq(0, 1, by = 0.01)) |
BFF_max_RMSE | Maximum BFF value |
max_RMSE | Effect size that maximizes BFF |
tau2 | tau^2 values tested |
Examples
zBFF = z_test_BFF(z_stat = 2.5, n = 50, save = FALSE)
z_test_BFF(z_stat = 2.5, n = 50, save = FALSE, tau2 = 0.5)
z_test_BFF(z_stat = 2.5, n = 50, save = FALSE, tau2 = c(0.5, 0.8))
z_test_BFF(z_stat = 2.5, n1 = 50, n2 = 35, one_sample = FALSE, save = FALSE) ##
z_test_BFF(z_stat = 2.5, n = 50, r = 2, save = FALSE)
z_test_BFF(z_stat = 2.5, r = 2, n1 = 50, n2 = 30, one_sample = FALSE, save = FALSE) ##
z_test_BFF(z_stat = 2.5, n = 50, r = 2.5, save = FALSE)
z_test_BFF(z_stat = 2.5, r = 2.5, n1 = 50, n2 = 30, one_sample = FALSE, save = FALSE) ##
z_test_BFF(z_stat=2.5, n = 50, maximize = TRUE)
z_test_BFF(z_stat=2.5, n = 50, maximize = TRUE, tau2 = 0.5)
z_test_BFF(z_stat=2.5, n = 50, maximize = TRUE, tau2 = c(0.5, 0.8))
zBFF$BFF_max_RMSE # maximum BFF value
zBFF$max_RMSE # effect size which maximizes the BFF value