binomORci {MCPAN} | R Documentation |
Simultaneous confidence intervals for odds ratios
Description
Approximate simultaneous confidence intervals for (weighted geometric means of) odds ratios are constructed. Estimates are derived from fitting a glm on the logit-link, approximate intervals are constructed on the logit-link, and transformed to original scale.
Usage
binomORci(x, ...)
## Default S3 method:
binomORci(x, n, names = NULL,
type = "Dunnett", method="GLM", cmat = NULL,
alternative = "two.sided", conf.level = 0.95,
dist="MVN", ...)
## S3 method for class 'formula'
binomORci(formula, data,
type = "Dunnett", method="GLM", cmat = NULL,
alternative = "two.sided", conf.level = 0.95,
dist="MVN", ...)
## S3 method for class 'table'
binomORci(x,
type = "Dunnett",method="GLM", cmat = NULL,
alternative = "two.sided", conf.level = 0.95,
dist="MVN", ...)
## S3 method for class 'matrix'
binomORci(x,
type = "Dunnett", method="GLM", cmat = NULL,
alternative = "two.sided", conf.level = 0.95,
dist="MVN", ...)
Arguments
x |
a numeric vector, giving the number of successes in I independent samples, or an object of class "table", representing the 2xk-table, or an object of class "matrix", representing the 2xk-table |
n |
numeric vector, giving the number of trials (i.e. the sample size) in each of the I groups (only required if x is a numeric vector, ignored otherwise) |
names |
an optional character string, giving the names of the groups/ sample in x, n; if not specified the possible names of x are taken as group names (ignored if x is a table or matrix) |
formula |
a two-sided formula of the style 'response ~ treatment', where 'response' should be a categorical variable with two levels, while treatment should be a factor specifying the treatment levels |
data |
a data.frame, containing the variables specified in formula |
type |
a character string, giving the name of a contrast method, as defined in contrMat(multcomp); ignored if cmat is sepcified |
method |
a single character string, specifying the method for confidence interval computation; Options are "GLM" and "Woolf". "GLM" takes the maximum likelihood estimates and the their standard errors; this yields a conservative confidence intervals with uninformative limits if x=0 and x=n occures. "Woolf" adds 0.5 to the cell counts, resulting in less conservative bounds. These can be liberal when extreme proportions are compared. |
cmat |
a optional contrast matrix |
alternative |
a single character string, one of "two.sided", "less", "greater" |
conf.level |
a single numeric value, simultaneous confidence level |
dist |
a character string, "MVN" invokes multiplicity adjustment via the multivariate normal distribution, "N" invokes use of quantiles of the univariate normal distribution |
... |
arguments to be passed to binomest, currently only success labelling the event which should be considered as success |
Details
This function calls glm and fits a one-way-model with family binomial on the logit-link. Then, the point estimates and variances estimates from the fit are taken to construct simultaneous confidence intervals for differences (of weighted arithmetic means) of log-odds. Applying the exponential function to these intervals on the logit scale yields intervals for ratios (of weighted geometric) of odds. For simple groupwise comparisons, one yields intervals for oddsratios. For the case of Dunnett-type contrasts, the calculated simultaneous confidence intervals are those described in Holford et al. (1989).
Specifying method="GLM" takes maximum likelihood estimates for the log-odds and their standard errors evaluated at the estimate.
Specifying method="Woolf" takes adds 0.5 to each cell count and computes point estimates and standard errors for these continuity corrected values. For the two-sample comparison this method is refered to as "adjusted Woolf" (Lawson, 2005). In this implementation, the lower bounds yielded by this method are additionally expanded to 0, if all values in the denominator are x=n or all values in the numerator are x=0, and the upper bounds are expanded to Inf, if all values in the denominator are x=0 or all values in the numerator are x=n.
Note, that for the case of general contrasts, the methods are not described explicitly so far.
Value
A object of class "binomORci", a list containing:
conf.int |
a matrix with 2 columns: lower and upper confidence bounds, and M rows |
alternative |
character string, as input |
conf.level |
single numeric value, as input |
estimate |
a matrix with 1 column: containing the estimates of the contrasts |
x |
the observed number of successes |
n |
the number of trials |
p |
the estimated proportions |
success |
a character string labelling the event considered as success |
names |
the group names |
method |
a character string, specifying the method of interval construction |
cmat |
the contrast matrix used |
Author(s)
Frank Schaarschmidt, Daniel Gerhard
References
Holford, TR, Walter, SD and Dunnett, CW (1989). Simultaneous interval estimates of the odds ratio in studies with two or more comparisons. Journal of Clinical Epidemiology 42, 427-434.
See Also
Intervals for the risk difference binomRDci, summary for odds ratio confidence intervals summary.binomORci plot for confidence intervals plot.sci
Examples
data(liarozole)
table(liarozole)
# Comparison to the control group "Placebo",
# which is the fourth group in alpha-numeric
# order:
ORlia<-binomORci(Improved ~ Treatment,
data=liarozole, success="y", type="Dunnett", base=4)
ORlia
summary(ORlia)
plot(ORlia)
# if data are available as table:
tab<-table(liarozole)
tab
ORlia2<-binomORci(tab, success="y", type="Dunnett", base=4)
ORlia2
plot(ORlia2, lines=1, lineslty=3)
############################
# Performance for extreme cases
# method="GLM" (the default)
test1<-binomORci(x=c(0,1,5,20), n=c(20,20,20,20), names=c("A","B","C","D"))
test1
plot(test1)
# adjusted Woolf interval
test2<-binomORci(x=c(0,1,5,20), n=c(20,20,20,20), names=c("A","B","C","D"), method="Woolf")
test2
plot(test2)