epiTTest: Epidemiological T-Test Function

Description Usage Arguments Details Value Author(s) References Examples

View source: R/epiTTest.R

Description

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.

Usage

1
epiTTest(X,Y, alpha=0.05, pooled=FALSE, digits=3)

Arguments

X

A vector of observed values of a continuous random variable.

Y

A vector of observed values of a continuous random variable.

alpha

The desired Type I Error Rate for Confidence Intervals

pooled

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.

digits

Number of Digits to round calculations

Details

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.

Value

nx

The number of observations in X.

ny

The number of observations in Y.

mean.x

The sample mean of X.

mean.y

The sample mean of Y.

s.x

The standard deviation of X.

s.y

The standard deviation of Y.

d

The difference between sample means, that is, mean.x - mean.y.

s2p

The pooled variance, when applicable.

df

The degrees of freedom for the test.

TStat

The test statistic for the null hypothesis mu_X - mu_Y = 0.

p.value

The P-value for the test statistic for mu_X - mu_Y = 0.

CIL

The lower bound of the constructed confidence interval for mu_X - mu_Y = 0.

CIU

The lower bound of the constructed confidence interval for mu_X - mu_Y = 0.

pooled

Logical: as above for assuming variances are equal.

alpha

The desired Type I Error Rate for Confidence Intervals

Author(s)

Michael Rotondi, mrotondi@yorku.ca

References

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.

Examples

1
2
3
X <- rnorm(100,10,1);
Y <- rnorm(100);
summary(epiTTest(X,Y, pooled = FALSE));

Example output

Epidemiological T-Test Analysis 
 
Number of Observations in Group I: 100
Sample Mean for Group I: 9.882 with a sample standard deviation of 1.063
Number of Observations in Group II: 100
Sample Mean for Group II: -0.118 with a sample standard deviation of 0.952
Sample Difference Between Means: 10
95% Confidence Limits for true mean difference: [9.719, 10.282]
 
T-Statistic for H0: difference = 0 vs. HA: difference != 0 is 70.104 with a p.value of 0
 
Note: The above Analysis uses the Satterthwaite estimate of the variance. 

epibasix documentation built on May 2, 2019, 10:08 a.m.

Related to epiTTest in epibasix...