t_test_BFF {BFF} | R Documentation |
t_test_BFF
Description
t_test_BFF constructs BFFs based on the t 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
t_test_BFF(
t_stat,
n = NULL,
df = 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
t_stat |
T statistic |
n |
sample size (if one sample test) |
df |
degrees of freedom |
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 function be maximzied over all possible r values? 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
tBFF = t_test_BFF(t_stat = 2.5, n = 50, df = 49, save = FALSE)
t_test_BFF(t_stat = 2.5, n = 50, df = 49, save = FALSE, tau2 = 0.5)
t_test_BFF(t_stat = 2.5, n = 50, df = 49, save = FALSE, tau2 = c(0.5, 0.2))
t_test_BFF(t_stat = 2.5, n1 = 50, n2 = 40, df = 88, save = FALSE, one_sample = FALSE)
t_test_BFF(t_stat = 2.5, n = 50, r = 2, df = 49, save = FALSE)
t_test_BFF(t_stat = 2.5, r = 2, n1 = 50, n2 = 30, df = 78, one_sample = FALSE, save = FALSE)
t_test_BFF(t_stat = 2.5, n = 50, r = 2.5, df = 49, save = FALSE)
t_test_BFF(t_stat=2.5, r = 2.5, n1 = 50, n2 = 30, df = 78, one_sample = FALSE, save=FALSE)
t_test_BFF(t_stat = 2.5, n = 50, df = 49, save = FALSE, maximize = TRUE)
t_test_BFF(t_stat = 2.5, n = 50, df = 49, save = FALSE, maximize = TRUE, tau2 = 0.5)
t_test_BFF(t_stat = 2.5, n = 50, df = 49, save = FALSE, maximize = TRUE, tau2 = c(0.5, 0.8))
tBFF$BFF_max_RMSE # maximum BFF value
tBFF$max_RMSE # effect size which maximizes the BFF value