# Safe Anytime-Valid Inference

## Documentation for package ‘safestats’ version 0.8.7

- DESCRIPTION file.
- User guides, package vignettes and other documentation.

## Help Pages

checkAndReturnsEsMinParameterSide | Checks consistency between the sided of the hypothesis and the minimal clinically relevant effect size or safe test defining parameter. Throws an error if the one-sided hypothesis is incongruent with the
checkAndReturnsNPlan | Check consistency between nPlan and the testType for one and two-sample z and t-tests
checkDoubleArgumentsDesignObject | Helper function to check whether arguments are specified in a function at a higher level and already provided in the design object.
computeBetaBatchSafeZ | Helper function: Computes the type II error based on the minimal clinically relevant effect size and sample size.
computeBetaSafeT | Helper function: Computes the type II error of the safeTTest based on the minimal clinically relevant standardised mean difference and nPlan.
computeBetaSafeZ | Helper function: Computes the type II error based on the minimal clinically relevant mean difference and nPlan
computeBootObj | Computes the bootObj for sequential sampling procedures regarding nPlan, beta, the implied target
computeConfidenceBoundForLogOddsTwoProportions | Estimate an upper or lower bound for a safe confidence sequence on the logarithm of the odds ratio for two proportions.
computeConfidenceBoundsForDifferenceTwoProportions | Estimate Lower and Upper Bounds on the Confidence Sequence (Interval) for the Difference Divergence Measure for Two Proportions
computeConfidenceIntervalT | Helper function: Computes the safe confidence sequence for the mean in a t-test
computeConfidenceIntervalZ | Helper function: Computes the safe confidence sequence for a z-test
computeEsMinSafeT | Helper function: Computes the minimal clinically relevant standardised mean difference for the safe t-test nPlan and beta.
computeLogrankBetaFrom | Helper function: Computes the type II error under optional stopping based on the minimal clinically relevant hazard ratio and the maximum number of nEvents.
computeLogrankNEvents | Helper function: Computes the planned sample size based on the minimal clinical relevant hazard ratio, alpha and beta under optional stopping.
computeLogrankZ | Helper function to computes the logrank statistic for 'Surv' objects of type "right" and "counting" with the hypergeometric variance.
computeMinEsBatchSafeZ | Computes the smallest mean difference that is detectable with chance 1-beta, for the provided sample size
computeNEff | Help function to compute the effective sample size based on a length 2 vector of samples
computeNPlanBatchSafeT | Helper function: Computes the planned sample size for the safe t-test based on the minimal clinically relevant standardised effect size, alpha and beta.
computeNPlanBatchSafeZ | Helper function: Computes the planned sample size based on the minimal clinical relevant mean difference, alpha and beta.
computeNPlanSafeT | Helper function: Computes the planned sample size of the safe t-test based on the minimal clinical relevant standardised mean difference.
computeNPlanSafeZ | Helper function: Computes the planned sample size based on the minimal clinical relevant mean difference, alpha and beta
computeStatsForLogrank | Computes the sufficient statistics needed to compute 'logrankSingleZ'
defineTTestN | Computes a Sequence of (Effective) Sample Sizes
designFreqT | Design a Frequentist T-Test
designFreqZ | Design a Frequentist Z-Test
designPilotSafeT | Designs a Safe T-Test Based on Planned Samples nPlan
designPilotSafeZ | Designs a Safe Z-Test Based on Planned Samples nPlan
designSafeLogrank | Designs a Safe Logrank Test Experiment
designSafeT | Designs a Safe Experiment to Test Means with a T Test
designSafeTwoProportions | Designs a Safe Experiment to Test Two Proportions in Stream Data
designSafeZ | Designs a Safe Z Experiment
extractNameFromArgs | Helper function: Get all names as entered by the user
generateNormalData | Generates Normally Distributed Data Depending on the Design
generateSurvData | Generate Survival Data which Can Be Analysed With the 'survival' Package
getArgs | Helper function: Get all arguments as entered by the user
getNameAlternative | Gets the Label of the Alternative Hypothesis
getNameTestType | Gets the Label of the Test
isTryError | Checks Whether a Vector of Object Inherits from the Class 'try-error'
logrankSingleEExact | Helper function computes single component of the exact logrank e-value
logrankSingleZ | Helper function computes single component of the logrank statistic
plot.safe2x2Sim | Plots Results of Simulations for Comparing Hyperparameters for Safe Tests of Two Proportions
plot.safeTSim | Plots a 'safeTSim' Object
plotConfidenceSequenceTwoProportions | Plot bounds of a safe confidence sequence of the difference or log odds ratio for two proportions against the number of data blocks in two data streams ya and yb.
plotHistogramDistributionStoppingTimes | Plots the Histogram of Stopping Times
plotSafeTDesignSampleSizeProfile | Plots the Sample Sizes Necessary for a Tolerable Alpha and Beta as a Function of deltaMin
print.safe2x2Sim | Prints Results of Simulations for Comparing Hyperparameters for Safe Tests of Two Proportions
print.safeDesign | Print Method for Safe Tests
print.safeTest | Print Method for Safe Tests
print.safeTSim | Prints a safeTSim Object
replicateTTests | Simulate Early Stopping Experiments
returnOne | Auxiliary function for sampling of the logrank simulations to return the integer 1 event per time.
rLogrank | Randomly samples from a logrank distribution
safe.prop.test | Perform a Safe Test for Two Proportions with Stream Data
safe.t.test | Safe Student's T-Test.
safe.z.test | Safe Z-Test
safeLogrankTest | Safe Logrank Test
safeLogrankTestStat | Safe Logrank Test
safeTTest | Safe Student's T-Test.
safeTTestStat | Computes E-Values Based on the T-Statistic
safeTTestStatAlpha | safeTTestStat() Subtracted with 1/alpha.
safeTTestStatTDensity | safeTTestStat() based on t-densities
safeTwoProportionsTest | Perform a Safe Test for Two Proportions with Stream Data
safeZ10Inverse | Computes the Inverse of the Two-Sided Safe Z-Test
safeZTest | Safe Z-Test
safeZTestStat | Computes E-Values Based on the Z-Statistic
sampleLogrankStoppingTimes | Simulate stopping times for the exact safe logrank test
sampleStoppingTimesSafeT | Simulate stopping times for the safe z-test
sampleStoppingTimesSafeZ | Simulate stopping times for the safe z-test
selectivelyContinueTTestCombineData | Selectively Continue Experiments that Did Not Lead to a Null Rejection for a (Safe) T-Test
setSafeStatsPlotOptionsAndReturnOldOnes | Sets 'safestats' Plot Options and Returns the Current Plot Options.
simulate.safeDesign | Simulate Early Stopping Experiments for the T Test
simulateCoverageDifferenceTwoProportions | Simulate the coverage of a safe confidence sequence for differences between proportions for a given distribution and safe design.
simulateIncorrectStoppingTimesFisher | Simulate incorrect optional stopping with fisher's exact test's p-value as the stopping rule.
simulateOptionalStoppingScenarioTwoProportions | Simulate an optional stopping scenario according to a safe design for two proportions
simulateTwoProportions | Compare Different Hyperparameter Settings for Safe Tests of Two Proportions.
tryOrFailWithNA | Tries to Evaluate an Expression and Fails with 'NA'