safeTTest | R Documentation |
A safe t-test adapted from t.test()
to perform one and two sample t-tests on vectors of data.
safeTTest( x, y = NULL, designObj = NULL, paired = FALSE, varEqual = TRUE, pilot = FALSE, alpha = NULL, alternative = NULL, ciValue = NULL, na.rm = FALSE, ... ) safe.t.test( x, y = NULL, designObj = NULL, paired = FALSE, var.equal = TRUE, pilot = FALSE, alpha = NULL, alternative = NULL, ... )
x |
a (non-empty) numeric vector of data values. |
y |
an optional (non-empty) numeric vector of data values. |
designObj |
an object obtained from |
paired |
a logical indicating whether you want a paired t-test. |
varEqual |
a logical variable indicating whether to treat the two variances as being equal. For
the moment, this is always |
pilot |
a logical indicating whether a pilot study is run. If |
alpha |
numeric > 0 only used if pilot equals |
alternative |
a character only used if pilot equals |
ciValue |
numeric is the ciValue-level of the confidence sequence. Default ciValue=NULL, and ciValue = 1 - alpha |
na.rm |
a logical value indicating whether |
... |
further arguments to be passed to or from methods. |
var.equal |
a logical variable indicating whether to treat the two variances as being equal. For the moment,
this is always |
Returns an object of class "safeTest". An object of class "safeTest" is a list containing at least the following components:
the value of the t-statistic.
The realised sample size(s).
the realised e-value from the safe test.
A safe confidence interval for the mean appropriate to the specific alternative hypothesis.
the estimated mean or difference in means or mean difference depending on whether it a one- sample test or a two-sample test was conducted.
the standard error of the mean (difference), used as denominator in the t-statistic formula.
any of "oneSample", "paired", "twoSample" provided by the user.
a character string giving the name(s) of the data.
an object of class "safeTDesign" obtained from designSafeT()
.
the expression with which this function is called.
designObj <- designSafeT(deltaMin=0.6, alpha=0.008, alternative="greater", testType="twoSample", ratio=1.2) set.seed(1) x <- rnorm(100) y <- rnorm(100) safeTTest(x, y, designObj=designObj) #0.2959334 safeTTest(1:10, y = c(7:20), pilot=TRUE) # s = 658.69 > 1/alpha designObj <- designSafeT(deltaMin=0.6, alpha=0.008, alternative="greater", testType="twoSample", ratio=1.2) set.seed(1) x <- rnorm(100) y <- rnorm(100) safe.t.test(x, y, alternative="greater", designObj=designObj) #0.2959334 safe.t.test(1:10, y = c(7:20), pilot=TRUE) # s = 658.69 > 1/alpha
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.