Description Usage Arguments Details Value Author(s) See Also Examples
Produces table of relevant descriptive statistics and inference for either one- or two-sample t-test. In the two-sample case, the user can specify whether or not observations are matched, and whether or not equal variances should be presumed. Can also perform a test of equality of proportions (Wald based or exact binomial based).
1 2 3 4 |
var1 |
a (non-empty) numeric vector of data values. |
var2 |
an optional (non-empty) numeric vector of data. |
by |
a variable of equal length to that of |
strat |
a variable to use instead of |
geom |
a logical indicating whether the geometric mean should be calculated and displayed. |
prop |
if |
exact |
must be |
null.hypoth |
a number specifying the null hypothesis for the mean (or difference in means if performing a two-sample test). Defaults to zero. |
test.type |
a string: one of |
var.eq |
a logical value, either |
conf.level |
confidence level of the test. Defaults to 95/100. |
matched |
a logical value, either |
more.digits |
a numeric value specifying whether or not to display more or fewer digits in the output. Non-integers are automatically rounded down. Any call to |
... |
only used in the generic S3 class. |
Missing values must be given by "NA"s to be recognized as missing values. Any call to ttest() is run by ttest.default(), with user specified values in place of defaults in the appropriate places.
Prints a summary of the data and the corresponding t-test.
Variable |
the variable name supplied to the t-test function |
Group |
the group name: either the variable names supplied to the function or the names of the strata if the variable |
Obs |
Number of observations of each variable: includes missing values. |
Missing |
number of missing values in each data vector. |
Mean |
the sample mean of each data vector; also, the estimated difference in means in a two-sample test. |
Std.Err. |
the estimated standard error of the mean and of the difference in the two-sample test. |
Std.Dev. |
standard deviation estimates from the data. |
CI |
a confidence interval for the means, and for the difference in the two-sample test. This is at the confidence level specified in the argument. If |
Null hypothesis |
a statement of the null hypothesis. |
Alternative hypothesis |
a statement of the alternative hypothesis. |
t |
value of the t-statistic. |
df |
the degrees of freedom for the test. |
Pr |
a p-value for inference on the corresponding hypothesis test. |
Scott S. Emerson, M.D., Ph.D., Andrew J. Spieker, Brian D. Williamson, Travis Y. Hee Wai, Solomon Lim
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | #- Read in data set -#
psa <- read.table("http://www.emersonstatistics.com/datasets/psa.txt", header=TRUE)
attach(psa)
#- Perform t-test -#
ttest(pretxpsa, null.hypoth = 100, test.type = "greater", more.digits = 1)
#- Define new binary variable as indicator -#
#- of whether or not bss was worst possible -#
bssworst <- bss
bssworst[bss == 1] <- 0
bssworst[bss == 2] <- 0
bssworst[bss == 3] <- 1
#- Perform t-test allowing for unequal -#
#- variances between strata -#
ttest(pretxpsa, by = bssworst)
#- Perform matched t-test -#
ttest(pretxpsa, nadirpsa, matched = TRUE, conf.level = 99/100, more.digits = 1)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.