safeZTest {safestats} | R Documentation |
Safe Z-Test
Description
Safe one and two sample z-tests on vectors of data. The function is modelled after t.test()
.
Usage
safeZTest(
x,
y = NULL,
paired = FALSE,
designObj = NULL,
pilot = FALSE,
ciValue = NULL,
tol = 1e-05,
na.rm = FALSE,
...
)
safe.z.test(
x,
y = NULL,
paired = FALSE,
designObj = NULL,
pilot = FALSE,
tol = 1e-05,
...
)
Arguments
x |
a (non-empty) numeric vector of data values. |
y |
an optional (non-empty) numeric vector of data values. |
paired |
a logical indicating whether you want the paired z-test. |
designObj |
an object obtained from |
pilot |
a logical indicating whether a pilot study is run. If |
ciValue |
numeric is the ciValue-level of the confidence sequence. Default ciValue=NULL, and ciValue = 1 - alpha |
tol |
numeric > 0, only used if pilot equals |
na.rm |
a logical value indicating whether |
... |
further arguments to be passed to or from methods. |
Value
Returns an object of class 'safeTest'. An object of class 'safeTest' is a list containing at least the following components:
- statistic
the value of the test statistic. Here the z-statistic.
- n
The realised sample size(s).
- eValue
the e-value of the safe test.
- confInt
To be implemented: a safe confidence interval for the mean appropriate to the specific alternative hypothesis.
- estimate
the estimated mean or difference in means or mean difference depending on whether it was a one- sample test or a two-sample test.
- h0
the specified hypothesised value of the mean or mean difference depending on whether it was a one-sample or a two-sample test.
- testType
any of "oneSample", "paired", "twoSample" effectively provided by the user.
- dataName
a character string giving the name(s) of the data.
- designObj
an object of class "safeDesign" described in
designSafeZ()
.- call
the expression with which this function is called.
Examples
designObj <- designSafeZ(meanDiffMin=0.6, alpha=0.008,
alternative="greater", testType="twoSample",
ratio=1.2)
set.seed(1)
x <- rnorm(100)
y <- rnorm(100)
safeZTest(x, y, designObj=designObj) #
safeZTest(1:10, y = c(7:20), pilot=TRUE, alternative="less") # s = 7.7543e+20 > 1/alpha