gm.or, gm.rr {gmvalid} | R Documentation |
Computes (stratified) odds ratios or risk ratios and their asymptotic confidence interval.
gm.or(X, Y, data = 0, conditions = 0, reference = c("last", "biggest", "first"), conf.level = 0.95) gm.rr(X, Y, data = 0, conditions = 0, reference = c("last", "biggest", "first"), conf.level = 0.95)
X |
Index of the variable's position in data or a vector. |
Y |
Index of the variable's position in data or a vector. |
data |
Data frame or a table |
conditions |
Variable indices in data or a data frame of the conditioning variables. |
reference |
Character string specifying the reference category, must be one of "last" (default), "biggest" (largest) or "first". May be abbreviated. |
conf.level |
confidence level of the interval (default is 0.95). |
Calculates odds ratios by conditional maximum likelihood estimation (Fisher) for stratified odds ratios and odds ratios by unconditional maximum likelihood estimation (Wald) for marginal odds ratios. Confidence intervals are calculated using exact methods.
Calculates risk ratios by unconditional maximum likelihood estimation (Wald). Confidence intervals are calculated using normal approximation.
Is based on the functions oddsratio.fisher
, oddsratio.wald
and riskratio.wald
(package: epitools).
A matrix containing the estimate(s), confidence interval(s) and p-value(s).
Ronja Foraita, Fabian Sobotka
Bremen Institute for Prevention Research and Social Medicine
(BIPS) http://www.bips.uni-bremen.de
Rothman KJ, Greenland S (1998) Modern Epidemiology. (2nd) Lippincott-Raven Publisher
group <- c("treatment","placebo1","placebo2") target <- c("low","medium","high") mat <- matrix(c(78,35,53,77,10,89,16,119,32),nrow=3,ncol=3,byrow=TRUE, dimnames=list("group"=group,"target"=target)) treat <- data.frame(expand.table(mat)) table(treat) ### Marginal OR gm.or(1,2,treat,reference="f") gm.or(treat$target,treat$group) ### Stratified OR data <- gm.modelsim(1000,"ab,bcd",list(c(1,1),c(1,1),c(1,1),c(1,1))) gm.or(1,2,conditions=c(3,4),data=data) ### Marginal RR gm.rr(1,2,treat,reference="f") gm.rr(treat$target,treat$group) ### Stratified RR data <- gm.modelsim(1000,"ab,bcd",list(c(1,1),c(1,1),c(1,1),c(1,1))) gm.rr(1,2,conditions=c(3,4),data=data) ### ALSO gm.or(X=data$a,Y=data$b,conditions=data$d)