epi2x2: Epidemiological 2x2 Contingency Table Analysis Tool

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/epi2x2.R

Description

This function analyzes 2x2 tables assuming either a case-control or cohort study. Information such as Pearson's chi-squared test, the odds ratio, risk difference and relative risk are computed, as well as confidence intervals.

Usage

1
epi2x2(X,alpha=0.05, digits=3)

Arguments

X

A 2x2 matrix in standard epidemiological format, that is, column one represents outcome present, column two outcome absent, while row one represents risk present and row two represents risk absent. This is crucial for correct computation of odds ratio and parameters.

alpha

The desired Type I Error Rate for Hypothesis Tests and Confidence Intervals

digits

Number of Digits to round calculations

Details

This function is similar to PROC FREQ in SAS, as it provides the comprehensive analysis of a 2x2 contingency table. Again, I must stress that the table must be entered in the appropriate format, or unsuitable estimates will result. In a case control study, cases should be entered as column one and controls as column two.

Value

X

The original input matrix.

Sy

Value for Pearson's Chi-squared statistic (with continuity correction).

Sy.p.value

P-value for the hypothesis test of no association.

Fisher.p.value

P-value for the hypothesis test of no association. (Using Fisher's Exact Test)

OR

Point Estimate of the odds ratio.

OR.CIL

Lower Confidence Limit for the odds ratio.

OR.CIU

Upper Confidence Limit for the odds ratio.

p1Co

Row One Risk (Cohort Study)

p2Co

Row Two Risk (Cohort Study)

rdCo

Risk difference (Cohort Study). That is p1Co - p2Co.

rdCo.CIL

Lower Confidence Limit for Risk Difference in a cohort study.

rdCo.CIU

Upper Confidence Limit for Risk Difference in a cohort study.

RR

Relative Risk (Cohort Study)

RR.CIL

Lower Confidence Limit for Relative Risk in a cohort study.

RR.CIU

Upper Confidence Limit for Relative Risk in a cohort study.

p1CC

Column One Risk (Case-Control Study)

p2CC

Column Two Risk (Case-Control Study)

rdCC

Risk difference (Case-Control Study). That is p1CC - p2CC.

rdCC.CIL

Lower Confidence Limit for Risk Difference in a case-control study.

rdCC.CIU

Upper Confidence Limit for Risk Difference in a case-control study.

alpha

The desired Type I Error Rate for Hypothesis Tests and Confidence Intervals

digits

Number of Digits to round calculations

Author(s)

Michael Rotondi, mrotondi@yorku.ca

References

Szklo M and Nieto FJ. Epidemiology: Beyond the Basics, Jones and Bartlett: Boston, 2007.

See Also

mcNemar

Examples

1
2
data <- cbind(c(100, 225), c(58, 45));
summary(epi2x2(data));

Example output

Epidemiological 2x2 Table Analysis 
 
Input Matrix: 
             Disease Present (Cases) Disease Absent (Controls)
Risk Present                     100                        58
Risk Absent                      225                        45

Pearson Chi-Squared Statistic (Includes Yates' Continuity Correction): 20.827
Associated p.value for H0: There is no association between exposure and outcome vs. HA: There is an association : 0
p.value using Fisher's Exact Test (1 DF) : 0
 
Estimate of Odds Ratio: 0.345
95% Confidence Limits for true Odds Ratio are: [0.219, 0.544]
 
Estimate of Relative Risk (Cohort, Col1): 0.759
95% Confidence Limits for true Relative Risk are: [0.667, 0.865]
 
Estimate of Risk Difference (p1 - p2) in Cohort Studies: -0.2
95% Confidence Limits for Risk Difference: [-0.293, -0.108]
 
Estimate of Risk Difference (p1 - p2) in Case Control Studies: -0.255
95% Confidence Limits for Risk Difference: [-0.355, -0.156]
 
Note: Above Confidence Intervals employ a continuity correction. 

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

Related to epi2x2 in epibasix...