oneSampleTTest
One sample t-test
Convenience function that runs a one sample t-test. This is a wrapper function intended to be used for pedagogical purposes only.
Usage
oneSampleTTest(
x, mu, one.sided=FALSE, conf.level=.95
)
Arguments
- x
- The variable to be tested (required).
- mu
- The value against which the mean should be tested (required).
- one.sided
- One sided or two sided hypothesis test (default =
FALSE
) - conf.level
- The confidence level for the confidence interval (default = .95).
Details
The oneSampleTTest
function runs a one-sample t-test on the data in x
, and prints the results in a format that is easier for novices to handle than the output of t.test
. All the actual calculations are done by the t.test
and cohensD
functions.
As with the t.test
function, the default test is two sided, corresponding to a default value of one.sided = FALSE
. To specify a one sided test in which the alternative hypothesis is that x
is larger than mu
, the input must be one.sided = "greater"
. Similarly, if one.sided="less"
, then the alternative hypothesis is that the mean of x
is smaller than mu
.
Value
Warning
This package is under development, and has been released only due to teaching constraints. Until this notice disappears from the help files, you should assume that everything in the package is subject to change. Backwards compatibility is NOT guaranteed. Functions may be deleted in future versions and new syntax may be inconsistent with earlier versions. For the moment at least, this package should be treated with extreme caution.
See Also
t.test
, pairedSamplesTTest
, independentSamplesTTest
, cohensD
Examples
library(lsr)
likert <- c(3,1,4,1,4,6,7,2,6,6,7)
oneSampleTTest( x = likert, mu = 4 )
oneSampleTTest( x = likert, mu = 4, one.sided = "greater" )
oneSampleTTest( x = likert, mu = 4, conf.level=.99 )
likert <- c(3,NA,4,NA,4,6,7,NA,6,6,7)
oneSampleTTest( x = likert, mu = 4 )