This function computes the standard two sample T-Test, as well as performing hypothesis tests and computing confidence intervals for the equality of both population means.
epiTTest(X,Y, alpha=0.05, pooled=FALSE, digits=3)
A vector of observed values of a continuous random variable.
A vector of observed values of a continuous random variable.
The desired Type I Error Rate for Confidence Intervals
Logical: If TRUE, a pooled estimate of the variance is used. That is, the variance is assumed to be equal in both groups. If FALSE, the Satterthwaite estimate of the variance is used.
Number of Digits to round calculations
The number of observations in X.
The number of observations in Y.
The sample mean of X.
The sample mean of Y.
The standard deviation of X.
The standard deviation of Y.
The difference between sample means, that is, mean.x - mean.y.
The pooled variance, when applicable.
The degrees of freedom for the test.
The test statistic for the null hypothesis \(\mu_X - \mu_Y = 0\).
The P-value for the test statistic for \(\mu_X - \mu_Y = 0\).
The lower bound of the constructed confidence interval for \(\mu_X - \mu_Y = 0\).
The lower bound of the constructed confidence interval for \(\mu_X - \mu_Y = 0\).
Logical: as above for assuming variances are equal.
The desired Type I Error Rate for Confidence Intervals
This function performs the simple two-sample T-Test, while providing detailed information regarding the analysis and summary information for both groups. Note that this function requires the input of two vectors, so if the data is stored in a matrix, it must be separated into two distinct vectors, X and Y.
Casella G and Berger RL. Statistical Inference (2nd Ed.) Duxbury: New York, 2002.
Szklo M and Nieto FJ. Epidemiology: Beyond the Basics, Jones and Bartlett: Boston, 2007.
# NOT RUN {
X <- rnorm(100,10,1);
Y <- rnorm(100);
summary(epiTTest(X,Y, pooled = FALSE));
# }
Run the code above in your browser using DataLab