selectivelyContinueTTestCombineData {safestats} | R Documentation |
Selectively Continue Experiments that Did Not Lead to a Null Rejection for a (Safe) T-Test
Description
Helper function used in the vignette.
Usage
selectivelyContinueTTestCombineData(
oldValues,
valuesType = c("eValues", "pValues"),
designObj = NULL,
alternative = c("twoSided", "greater", "less"),
oldData,
deltaTrue,
alpha = NULL,
n1Extra = NULL,
n2Extra = NULL,
seed = NULL,
paired = FALSE,
muGlobal = 0,
sigmaTrue = 1,
moreMainText = ""
)
Arguments
oldValues |
vector of e-values or p-values. |
valuesType |
character string either "eValues" or "pValues". |
designObj |
a safeDesign object obtained from |
alternative |
a character string specifying the alternative hypothesis must be one of "twoSided" (default), "greater" or "less". |
oldData |
a list of matrices with names "dataGroup1" and "dataGroup2". |
deltaTrue |
numeric, the value of the true standardised effect size (test-relevant parameter). |
alpha |
numeric in (0, 1) that specifies the tolerable type I error control –independent of n– that the designed test has to adhere to. Note that it also defines the rejection rule e10 > 1/alpha. |
n1Extra |
integer, that defines the additional number of samples of the first group. If
|
n2Extra |
optional integer, that defines the additional number of samples of the second group.
If |
seed |
To set the seed for the simulated data. |
paired |
logical, if |
muGlobal |
numeric, the true global mean of a paired or two-sample t-test. Its value should not matter for the test. This parameter is treated as a nuisance. |
sigmaTrue |
numeric > 0,the true standard deviation of the data. Its value should not matter for the test.This parameter treated is treated as a nuisance. |
moreMainText |
character, additional remarks in the title of the histogram. |
Value
a list that includes the continued s or p-values based on the combined data, and a list of the combined data.
Examples
alpha <- 0.05
mIter <- 1000L
designObj <- designSafeT(deltaMin=1, alpha=alpha, beta=0.2, nSim=100)
oldData <- generateNormalData(nPlan=designObj$nPlan, deltaTrue=0, nSim=mIter, seed=1)
eValues <- vector("numeric", length=mIter)
for (i in seq_along(eValues)) {
eValues[i] <- safeTTest(x=oldData$dataGroup1[i, ], designObj=designObj)$eValue
}
# First run: 8 false null rejections
sum(eValues > 1/alpha)
continuedSafe <- selectivelyContinueTTestCombineData(
oldValues=eValues, designObj=designObj, oldData=oldData,
deltaTrue=0, seed=2)
# Second run: 1 false null rejections
sum(continuedSafe$newValues > 1/alpha)
# Third run: 0 false null rejections
eValues <- continuedSafe$newValues
oldData <- continuedSafe$combinedData
continuedSafe <- selectivelyContinueTTestCombineData(
oldValues=eValues, designObj=designObj, oldData=oldData,
deltaTrue=0, seed=3)
sum(continuedSafe$newValues > 1/alpha)