| tsum.test | R Documentation |
Performs a one-sample, two-sample, or a Welch modified two-sample t-test
based on user supplied summary information. Output is identical to that
produced with t.test.
tsum.test(
mean.x,
s.x = NULL,
n.x = NULL,
mean.y = NULL,
s.y = NULL,
n.y = NULL,
alternative = "two.sided",
mu = 0,
var.equal = FALSE,
conf.level = 0.95
)
mean.x |
a single number representing the sample mean of |
s.x |
a single number representing the sample standard deviation for
|
n.x |
a single number representing the sample size for |
mean.y |
a single number representing the sample mean of |
s.y |
a single number representing the sample standard deviation for
|
n.y |
a single number representing the sample size for |
alternative |
is a character string, one of |
mu |
is a single number representing the value of the mean or difference in means specified by the null hypothesis. |
var.equal |
logical flag: if |
conf.level |
is the confidence level for the returned confidence interval; it must lie between zero and one. |
If y is NULL, a one-sample t-test is carried out with
x. If y is not NULL, either a standard or Welch modified
two-sample t-test is performed, depending on whether var.equal is
TRUE or FALSE.
A list of class htest, containing the following components:
statistic |
the t-statistic, with names attribute |
parameters |
is the degrees of freedom of the t-distribution associated
with statistic. Component |
p.value |
the p-value for the test. |
conf.int |
is
a confidence interval (vector of length 2) for the true mean or difference
in means. The confidence level is recorded in the attribute
|
estimate |
vector of length 1 or 2, giving the sample mean(s) or mean
of differences; these estimate the corresponding population parameters.
Component |
null.value |
the value of the mean or difference in means specified by
the null hypothesis. This equals the input argument |
alternative |
records the value of the input argument alternative:
|
data.name |
a character string (vector of length 1) containing the names x and y for the two summarized samples. |
For the one-sample t-test, the null hypothesis is
that the mean of the population from which x is drawn is mu.
For the standard and Welch modified two-sample t-tests, the null hypothesis
is that the population mean for x less that for y is
mu.
The alternative hypothesis in each case indicates the direction of
divergence of the population mean for x (or difference of means for
x and y) from mu (i.e., "greater",
"less", or "two.sided").
Alan T. Arnholt
Kitchens, L.J. (2003). Basic Statistics and Data Analysis. Duxbury.
Hogg, R. V. and Craig, A. T. (1970). Introduction to Mathematical Statistics, 3rd ed. Toronto, Canada: Macmillan.
Mood, A. M., Graybill, F. A. and Boes, D. C. (1974). Introduction to the Theory of Statistics, 3rd ed. New York: McGraw-Hill.
Snedecor, G. W. and Cochran, W. G. (1980). Statistical Methods, 7th ed. Ames, Iowa: Iowa State University Press.
z.test, zsum.test
tsum.test(mean.x=5.6, s.x=2.1, n.x=16, mu=4.9, alternative="greater")
# Problem 6.31 on page 324 of BSDA states: The chamber of commerce
# of a particular city claims that the mean carbon dioxide
# level of air polution is no greater than 4.9 ppm. A random
# sample of 16 readings resulted in a sample mean of 5.6 ppm,
# and s=2.1 ppm. One-sided one-sample t-test. The null
# hypothesis is that the population mean for 'x' is 4.9.
# The alternative hypothesis states that it is greater than 4.9.
x <- rnorm(12)
tsum.test(mean(x), sd(x), n.x=12)
# Two-sided one-sample t-test. The null hypothesis is that
# the population mean for 'x' is zero. The alternative
# hypothesis states that it is either greater or less
# than zero. A confidence interval for the population mean
# will be computed. Note: above returns same answer as:
t.test(x)
x <- c(7.8, 6.6, 6.5, 7.4, 7.3, 7.0, 6.4, 7.1, 6.7, 7.6, 6.8)
y <- c(4.5, 5.4, 6.1, 6.1, 5.4, 5.0, 4.1, 5.5)
tsum.test(mean(x), s.x=sd(x), n.x=11 ,mean(y), s.y=sd(y), n.y=8, mu=2)
# Two-sided standard two-sample t-test. The null hypothesis
# is that the population mean for 'x' less that for 'y' is 2.
# The alternative hypothesis is that this difference is not 2.
# A confidence interval for the true difference will be computed.
# Note: above returns same answer as:
t.test(x, y)
tsum.test(mean(x), s.x=sd(x), n.x=11, mean(y), s.y=sd(y), n.y=8, conf.level=0.90)
# Two-sided standard two-sample t-test. The null hypothesis
# is that the population mean for 'x' less that for 'y' is zero.
# The alternative hypothesis is that this difference is not
# zero. A 90% confidence interval for the true difference will
# be computed. Note: above returns same answer as:
t.test(x, y, conf.level=0.90)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.