cc {epiDisplay}R Documentation

Odds ratio calculation and graphing

Description

Odds ratio calculation and graphing

Usage

cc(outcome, exposure, decimal = 2, cctable = NULL, graph = TRUE, 
	original = TRUE, design = "cohort", main, xlab = "auto", ylab,
  alpha = .05, fisher.or = FALSE, exact.ci.or = FALSE) 
cci(caseexp, controlex, casenonex, controlnonex, cctable = NULL, 
	graph = TRUE, design = "cohort", main, xlab, ylab, xaxis, yaxis, 
  alpha = .05, fisher.or = FALSE, exact.ci.or = FALSE,decimal = 2 ) 
cs(outcome, exposure, cctable = NULL, decimal = 2, method="Newcombe.Wilson", 
   main, xlab, ylab, cex, cex.axis)
csi(caseexp, controlex, casenonex, controlnonex, cctable = NULL, 
	decimal = 2, method="Newcombe.Wilson") 
graph.casecontrol(caseexp, controlex, casenonex, controlnonex,
	 decimal=2) 
graph.prospective(caseexp, controlex, casenonex, controlnonex,
	 decimal=2) 
labelTable(outcome, exposure, cctable = NULL, cctable.dimnames = NULL) 
make2x2(caseexp, controlex, casenonex, controlnonex)

Arguments

cctable.dimnames

Dimension names of the variables, usually omitted

decimal

number of decimal places displayed

outcome, exposure

two dichotomous variables

cctable

A 2-by-2 table. If specified, will supercede the outcome and exposure variables

graph

If TRUE (default), produces an odds ratio plot

design

Specification for graph; can be "case control","case-control", "cohort" or "prospective"

caseexp

Number of cases exposed

controlex

Number of controls exposed

casenonex

Number of cases not exosed

controlnonex

Number of controls not exposed

original

should the original table be displayed instead of standard outcome vs exposure table

main

main title of the graph

xlab

label on X axis

ylab

label on Y axis

alpha

level of significance

fisher.or

whether odds ratio should be computed by the exact method

exact.ci.or

whether confidence limite of the odds ratio should be computed by the exact method

xaxis

two categories of exposure in graph

yaxis

two categories of outcome in graph

method

method of computation for 95 percent limits of risk difference

cex.axis

character expansion factor for graph axis

cex

character expansion factor for text in the graph

Details

'cc' usually reads in two variables whereas in 'cci' four number are entered manually. However, both the variables and the numbers should be omitted if the analysis is directly on a table specified by 'cctable'.

From both functions, odds ratio and its confidence limits, chisquared test and Fisher's exact test are computed. The odds ratio calcuation is based on cross product method unless 'fisher.or' is set as TRUE. It's confidence limits are obtained by the exact method unless exact.ci.or is set as FALSE.

'cs' and 'csi' are for cohort and cross-sectional studies. It computes the absolute risk, risk difference, and risk ratio. When the exposure is a risk factor, the attributable fraction exposure, attributable fraction population and number needed to harm (NNH) are also displayed in the output. When the exposure is a protective factor, protective efficacy or percent of risk reduced and number needed to treat (NNT) are displayed instead.

If there are more than 2 exposure categories and the sample size is large enough, a graph will be plotted.

'method' in 'csi' and 'cs' chooses whether confidence limits of the risk difference should be computed by Newcomb-Wilson method. Both this and the standard method may give non-sensible values if the risk difference is not statistically significant.

'make2x2' creates a 2-by-2 table using the above orientation.

'graph.casecontrol' and 'graph.prospective' draw a graph comparing the odds of exposure between cases and controls or odds of diseased between exposed and non-exposed.

These two graphic commands are automatically chosen by 'cc' and 'cci', depending on the 'design' argument.

Alternatively, a contingency table saved from 'make2x2' can be supplied as the 'cctable' argument for the 'cc' function and so on.

Author(s)

Virasakdi Chongsuvivatwong <cvirasak@medicine.psu.ac.th>

See Also

'fisher.test', 'chisq.test' and 'mhor'

Examples

data(Oswego)
.data <- Oswego
attach(.data)
cc(ill, chocolate)
cc(ill, chocolate, design="case-control")
cs(ill, chocolate) # The outcome variable should come first.

#    For the following table
#          chocolate
#    ill     FALSE TRUE
#     FALSE     7   22
#     TRUE     20   25
#
cci(25, 22, 20, 7)
graph.casecontrol(25, 22, 20, 7)
graph.prospective(25, 22, 20, 7)
# Each of the above two lines produces untitled graph, which can be decorated
# additionally decorated

#Alternatively
table1 <- make2x2(25,22,20,7)
cc(outcome=NULL, exposure=NULL, cctable=table1)
cs(outcome=NULL, exposure=NULL, cctable=table1)
agegr <- pyramid(age, sex, bin=30)$ageGroup
cs(ill, agegr, main="Risk ratio by age group", xlab="Age (years)")
rm(list=ls())
detach(.data)

[Package epiDisplay version 3.5.0.1 Index]