Performs a one- or two-sample t-test given summary statistics. In the two-sample case, the user can specify whether or not equal variances should be presumed.
ttesti(
obs,
mean,
sd,
obs2 = NA,
mean2 = NA,
sd2 = NA,
null.hypoth = 0,
conf.level = 0.95,
alternative = "two.sided",
var.eq = FALSE,
more.digits = 0
)
a list of class ttesti
. The print method lays out the information in an easy-to-read
format.
A formatted table of descriptive and inferential statistics (number of observations, mean, standard error of the mean estimate, standard deviation), along with a confidence interval for the mean.
Degrees of freedom for the t-test.
P-value for the t-test.
Test statistic for the t-test.
A vector of information about the type of test (null hypothesis, alternative hypothesis, etc.)
A logical value indicating whether a two-sample test was performed.
The call made to the ttesti
function.
number of observations for the first sample.
the sample mean of the first sample.
the sample standard deviation of the first sample.
number of observations for the second sample (this is optional).
if obs2
is supplied, then sample mean of the second
sample must be supplied.
if obs2
is supplied, then sample standard deviation of the
second sample must be supplied.
a number specifying the null hypothesis for the mean (or difference in means if performing a two-sample test). Defaults to zero.
confidence level of the test. Defaults to 0.95.
a string: one of
"less"
, "two.sided"
, or "greater"
specifying the form
of the test. Defaults to a two-sided test.
a logical value, either
TRUE
or FALSE
(default), specifying whether or not equal
variances should be presumed in a two-sample t-test.
a numeric value specifying whether or not to display more or fewer digits in the output. Non-integers are automatically rounded down.
If obs2
, mean2
, or sd2
is specified, then all three must be specified
and a two-sample t-test is run.
# t-test given sample descriptives
ttesti(24, 175, 35, null.hypoth=230)
# two-sample test
ttesti(10, -1.6, 1.5, 30, -.7, 2.1)
Run the code above in your browser using DataLab