Description Usage Arguments Value Author(s) Examples
View source: R/two.sample.test.r
Function performs a two-sample hypothesis test for two independent samples, based on resampling (randomization) procedure, and estimates confidence intervals. Parametric confidence intervals are also estimatd.
1 2 | two.sample.test(f, data = NULL, alpha = 0.05, mu = 0, iter = 999,
seed = NULL)
|
f |
A formula in the form y ~ x. The left-hand side of the formula, y, is the variable one wishes to analyze. The right-hand side, x, is a variable to describe the different samples (a factor). It is important that the formula is set up this way. Do not provide two different vectors! |
data |
The data frame from which the variables can be found. |
alpha |
The significance level for the test (accepted proability of a type I error). |
mu |
The hypothesized difference in population means (defaults to 0). This is the expected difference as stated in a null hypothesis. |
iter |
Number of resampling iterations. The oberved value counts as one iteration, so this number should be the desired number of permutations - 1. For example, if 1,000 permutations are desired, this value should be 999. |
seed |
If one should wish to define the random seed for the random permutations (for advanced users). |
The function returns a list containg means, sample sizes, variances, pooled standard error, the t-value, linear model fitted values and residuals, random mean differences, random t-values, and confidence intervals for all types of alternative hypotheses.
Michael Collyer
1 2 3 4 5 6 7 8 9 10 11 12 | data(lowbwt)
# TST = two-sample test
TST1 <- two.sample.test(sbp ~ sex, data = lowbwt, alpha = 0.05, mu = 0, iter = 999)
summary(TST1)
plot(TST1, method = "hist", conf.int = "2T")
TST2 <- two.sample.test(sbp ~ grmhem, data = lowbwt, alpha = 0.05, mu = 0, iter = 999)
summary(TST2)
plot(TST2, method = "hist", conf.int = "2T")
plot(TST2, method = "hist", conf.int = "PT")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.