| Title: | Approximate Odds Ratio Confidence Intervals with Welch's Adjustments |
|---|---|
| Description: | Calculates approximate odds ratio confidence intervals with Welch's adjustments for a given dataset and ranks different odds ratio confidence intervals in terms of multiple metrics based on the dataset given. References for Welch's adjustments can be found at Pan (2002) <doi:10.1016/S0167-9473(01)00107-4> and Clinton, Morgan, and Noguchi (2026) <https://meetings.ams.org/math/jmm2026/meetingapp.cgi/Paper/58471>. |
| Authors: | Cosette Clinton [aut], McKenna Morgan [ctb], Kimihiro Noguchi [aut, cre] |
| Maintainer: | Kimihiro Noguchi <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.1 |
| Built: | 2026-09-26 09:52:05 UTC |
| Source: | https://github.com/cran/ORCI.Welch |
Plots objects of the class "ORCompareCounts" in stacked bar graphs to summarize the the top-performing approximate odds ratio confidence interval methods.
## S3 method for class 'ORCompareCounts' barplot(height, ...)## S3 method for class 'ORCompareCounts' barplot(height, ...)
height |
An object of class " |
... |
Additional arguments. |
This function generates stacked bar graphs showing how often each of the approximate odds ratio confidence interval methods implemented in this package appears within ranking groups.
No return value, called for plotting objects of the class "ORCompareCounts".
OR_Compare, summary.ORCompare, print.ORCompare.
#Testing with the data from Dube et al. (2009) test_Dube <- OR_Compare( x = as.numeric(Dube_2009[1, 2:3]), n = as.numeric(Dube_2009[3, 2:3]), alternative = "two.sided", data.gen = "Binomial", conf.level = 0.95, nsim = 1000, fix.seed = TRUE, seed.num = 1234 ) test_Dube_counts <- ORCompare_Counts(test_Dube) oldpar <- par(mfrow = c(1,2)) par(mar = c(15, 4.1, 4.1, 2.1)) colors <- c("blue", "orange") barplot(test_Dube_counts, xlab = "", ylab = "Count", main = "Stacked Bar Graph of the Ranking Groups", col = colors, las = 2, xlim = c(0, 6)) legend("topright", legend = test_Dube_counts$Rank_Group[c(1, 5)], col = colors, title = "Ranking Groups", lwd = 2, cex = 0.8) par(oldpar) #Another example using simulated data sim_results <- OR_Compare( x = c(10, 20), n = c(30, 50), alternative = "two.sided", data.gen = "Binomial", conf.level = 0.95, nsim = 1000, fix.seed = TRUE, seed.num = 1234 ) sim_results_counts <- ORCompare_Counts(sim_results) oldpar <- par(mfrow = c(1,2)) par(mar = c(15, 4.1, 4.1, 2.1)) colors <- c("blue", "orange") barplot(sim_results_counts, xlab = "", ylab = "Count", main = "Stacked Bar Graph of the Ranking Groups", col = colors, las=2, xlim=c(0,6)) legend("topright", legend = sim_results_counts$Rank_Group[c(1,5)], col = colors, title = "Ranking Groups", lwd = 2, cex = 0.8) par(oldpar)#Testing with the data from Dube et al. (2009) test_Dube <- OR_Compare( x = as.numeric(Dube_2009[1, 2:3]), n = as.numeric(Dube_2009[3, 2:3]), alternative = "two.sided", data.gen = "Binomial", conf.level = 0.95, nsim = 1000, fix.seed = TRUE, seed.num = 1234 ) test_Dube_counts <- ORCompare_Counts(test_Dube) oldpar <- par(mfrow = c(1,2)) par(mar = c(15, 4.1, 4.1, 2.1)) colors <- c("blue", "orange") barplot(test_Dube_counts, xlab = "", ylab = "Count", main = "Stacked Bar Graph of the Ranking Groups", col = colors, las = 2, xlim = c(0, 6)) legend("topright", legend = test_Dube_counts$Rank_Group[c(1, 5)], col = colors, title = "Ranking Groups", lwd = 2, cex = 0.8) par(oldpar) #Another example using simulated data sim_results <- OR_Compare( x = c(10, 20), n = c(30, 50), alternative = "two.sided", data.gen = "Binomial", conf.level = 0.95, nsim = 1000, fix.seed = TRUE, seed.num = 1234 ) sim_results_counts <- ORCompare_Counts(sim_results) oldpar <- par(mfrow = c(1,2)) par(mar = c(15, 4.1, 4.1, 2.1)) colors <- c("blue", "orange") barplot(sim_results_counts, xlab = "", ylab = "Count", main = "Stacked Bar Graph of the Ranking Groups", col = colors, las=2, xlim=c(0,6)) legend("topright", legend = sim_results_counts$Rank_Group[c(1,5)], col = colors, title = "Ranking Groups", lwd = 2, cex = 0.8) par(oldpar)
A 2-by-2 contingency table from Doll and Hill (1950) comparing lung cancer status between male smokers who smoke 25-49 cigarettes per day and male non-smokers.
Doll_Hill_1950Doll_Hill_1950
A data frame with 2 rows and 3 variables:
Lung cancer status ("Lung Cancer", "Control").
Number of individuals smoking 25–49 cigarettes per day.
Number of non-smokers.
Row Totals.
The contingency table is:
| Lung Cancer Status | 25--49 Cigarettes/Day | Non-Smoker | Total |
| Lung Cancer | 136 | 2 | 138 |
| Control | 71 | 27 | 98 |
| Total | 207 | 29 | 236 |
The data contains counts from a case-control study.
The estimated odds ratio (OR) is
That is, males who smoke 25-49 cigarettes per day have 25.8592 times the odds of being in the lung cancer group compared to the control group, meaning that there is a strong association between smoking one or more packs of cigarettes a day (a pack of cigarettes generally has 25+ cigarettes) and lung cancer.
The proportion of lung cancer cases among heavy smokers is approximately 0.9855.
Doll, C. and Hill, A. B. (1950). See doi:10.1136/bmj.2.4682.739.
Doll, R. and Hill, A. B. (1950). Smoking and carcinoma of the lung. British Medical Journal, 2, 739–748.
data(Doll_Hill_1950) Doll_Hill_1950 n11 <- as.numeric(Doll_Hill_1950[1,2]) n12 <- as.numeric(Doll_Hill_1950[1,3]) n21 <- as.numeric(Doll_Hill_1950[2,2]) n22 <- as.numeric(Doll_Hill_1950[2,3]) OR <- (n11 * n22) / (n12 * n21) ORdata(Doll_Hill_1950) Doll_Hill_1950 n11 <- as.numeric(Doll_Hill_1950[1,2]) n12 <- as.numeric(Doll_Hill_1950[1,3]) n21 <- as.numeric(Doll_Hill_1950[2,2]) n22 <- as.numeric(Doll_Hill_1950[2,3]) OR <- (n11 * n22) / (n12 * n21) OR
A 2-by-2 contingency table from Dube et al. (2009) relating adverse childhood experiences (ACE) score to lifetime suicide attempts.
Dube_2009Dube_2009
A data frame with 2 observations and 3 variables:
ACE category (">=7", "None").
Number reporting a lifetime suicide attempt.
Number reporting no lifetime suicide attempt.
Row Totals
The data compares individuals with an ACE score of seven or more to individuals reporting no adverse childhood experiences.
The estimated odds ratio (OR) is
That is, individuals with an Adverse Childhood Experiences (ACE) score of 7 or more have approximately 48.50 times the odds of reporting a lifetime suicide attempt compared to individuals with no reported adverse childhood experiences. This suggests a very strong positive association between high ACE scores and lifetime suicide attempts.
The proportion of suicide attempts among individuals with an ACE score of seven or more is approximately 0.3522.
Dube, S. R., Anda, R. F., Felitti, V. J., Chapman, D. P., Williamson, D. F., and Giles, W. H. (2009). See doi:10.1001/jama.286.24.3089.
Dube, S. R., Anda, R. F., Felitti, V. J., Chapman, D. P., Williamson, D. F., and Giles, W. H. (2009). Childhood abuse, household dysfunction, and the risk of attempted suicide throughout the life span. JAMA, 286(24), 3089–3096.
data(Dube_2009) Dube_2009 n11 <- as.numeric(Dube_2009[1,2]) n12 <- as.numeric(Dube_2009[1,3]) n21 <- as.numeric(Dube_2009[2,2]) n22 <- as.numeric(Dube_2009[2,3]) OR <- (n11 * n22) / (n12 * n21) ORdata(Dube_2009) Dube_2009 n11 <- as.numeric(Dube_2009[1,2]) n12 <- as.numeric(Dube_2009[1,3]) n21 <- as.numeric(Dube_2009[2,2]) n22 <- as.numeric(Dube_2009[2,3]) OR <- (n11 * n22) / (n12 * n21) OR
Evaluates and compares multiple approximate odds ratio confidence intervals using Monte Carlo simulation.
OR_Compare( x, n, alternative = c("two.sided", "less", "greater"), data.gen = c("Binomial", "Multinomial", "Poisson"), conf.level = 0.95, nsim = 10000, fix.seed = TRUE, seed.num = 1234 )OR_Compare( x, n, alternative = c("two.sided", "less", "greater"), data.gen = c("Binomial", "Multinomial", "Poisson"), conf.level = 0.95, nsim = 10000, fix.seed = TRUE, seed.num = 1234 )
x |
A numeric vector of length 2 giving the numbers of successes for the first and second row of the 2-by-2 contingency table. |
n |
A numeric vector of length 2 giving the total cell counts for the first and second row of the 2-by-2 contingency table. |
alternative |
A character string specifying the alternative hypothesis. It must be one of "two.sided" (default), "greater" or "less". |
data.gen |
A character string specifying the distribution to be used for data generation. The default option is "Binomial", which indicates that there are two independent binomial samples. If "Multinomial" is chosen, that indicates that the four cell counts follow a multinomial distribution. If "Poisson" is chosen, that indicates that there are four independent Poisson samples. |
conf.level |
A numeric specifying the confidence level. It must be a single number between 0 and 1. The default option is 0.95 for the 95% confidence interval. |
nsim |
A numeric specifying the number of datasets to be generated for the Monte Carlo simulation. The default option is 10000. |
fix.seed |
A Boolean specifying whether to fix seed for replication. The default option is TRUE, in which case, the seed is fixed using |
seed.num |
A numeric specifying the seed number to be used for setting the seed when |
This function evaluates and compares various approximate odds ratio confidence intervals in terms of the coverage probability, mean length, median length, mean log length, median log length, and the number of cases where exceptions (NAs) are produced. These approximate odds ratio confidence intervals vary in terms of the degrees of freedom adjustments, cell count adjustments, standard error calculations, and endpoint adjustment.
An object of class "ORCompare" with the following columns:
The distribution assumed for the degrees of freedom calculation. See data.gen for details.
The cell count adjustment method used. See adjust in OR_Welch for details.
The standard error transformation used. See se.option in OR_Welch for details.
The endpoint adjustment method used. See endpoint in OR_Welch for details.
The coverage probability including the exceptional cases with an indefinite form for the odds ratio estimate.
Ranking of the odds ratio confidence intervals based on Coverage_Prob_All.
Coverage probability excluding the exceptional cases with an indefinite form for the odds ratio estimate.
Ranking of the odds ratio confidence intervals based on Coverage_Prob_NoNA.
Mean log length of the odds ratio confidence intervals. It is applicable only if "two.sided" is chosen for the alternative hypothesis.
Ranking of the odds ratio confidence intervals based on Mean_Log_Length.
Median log length of the odds ratio confidence intervals. It is applicable only if "two.sided" is chosen for the alternative hypothesis.
Ranking of the odds ratio confidence intervals based on Median_Log_Length.
Mean length of the odds ratio confidence intervals.
Ranking of the odds ratio confidence intervals based on Mean_Orig_Length.
Median length of the odds ratio confidence intervals.
Ranking of the odds ratio confidence intervals based on Median_Orig_Length.
Number of NA counts in the Monte Carlo simulation.
Ranking of the odds ratio confidence intervals based on NA_Counts.
See OR_Welch for computing approximate odds ratio confidence intervals with Welch's adjustments. Also see ORCompare_Counts and ORCompare_Sort for summarizing the results.
#Testing with the data from Doll and Hill (1950) test_Doll_Hill <- OR_Compare( x = as.numeric(Doll_Hill_1950[1, 2:3]), n = as.numeric(Doll_Hill_1950[3, 2:3]), alternative = "two.sided", data.gen = "Binomial", conf.level = 0.95, nsim = 1000, fix.seed = TRUE, seed.num = 1234 ) #Another example using simulated data sim_results <- OR_Compare( x = c(10, 20), n = c(30, 50), alternative = "two.sided", data.gen = "Binomial", conf.level = 0.95, nsim = 1000, fix.seed = TRUE, seed.num = 1234 )#Testing with the data from Doll and Hill (1950) test_Doll_Hill <- OR_Compare( x = as.numeric(Doll_Hill_1950[1, 2:3]), n = as.numeric(Doll_Hill_1950[3, 2:3]), alternative = "two.sided", data.gen = "Binomial", conf.level = 0.95, nsim = 1000, fix.seed = TRUE, seed.num = 1234 ) #Another example using simulated data sim_results <- OR_Compare( x = c(10, 20), n = c(30, 50), alternative = "two.sided", data.gen = "Binomial", conf.level = 0.95, nsim = 1000, fix.seed = TRUE, seed.num = 1234 )
Computes the odds ratio confidence interval, test statistic, and p-value based on Student's t distribution with Welch's degrees of freedom.
OR_Welch( x, n, alternative = c("two.sided", "less", "greater"), OR.null = 1, dist = c("Binomial", "Multinomial", "Poisson", "Asymptotic"), endpoint = FALSE, adjust = c("Agresti", "Gart", "Fagerland", "Woolf", "Custom"), adjust.custom = rep(0, 4), se.option = c("original", "sinh"), conf.level = 0.95 )OR_Welch( x, n, alternative = c("two.sided", "less", "greater"), OR.null = 1, dist = c("Binomial", "Multinomial", "Poisson", "Asymptotic"), endpoint = FALSE, adjust = c("Agresti", "Gart", "Fagerland", "Woolf", "Custom"), adjust.custom = rep(0, 4), se.option = c("original", "sinh"), conf.level = 0.95 )
x |
A numeric vector of length 2 giving the numbers of successes for the first and second row of the 2-by-2 contingency table. |
n |
A numeric vector of length 2 giving the total cell counts for the first and second row of the 2-by-2 contingency table. |
alternative |
A character string specifying the alternative hypothesis. It must be one of "two.sided" (default), "greater" or "less". |
OR.null |
A numeric specifying the odds ratio value under the null hypothesis. The default value is 1. |
dist |
A character string specifying the distribution to be used: "Binomial" for t with Welch's adjustment assuming two independent binomial distributions, "Multinomial" for t with Welch's adjustment assuming a multinomial distribution, "Poisson" for t with Welch's adjustment assuming four independent Poisson distributions, and "Asymptotic" for no Welch's adjustment (i.e., by applying the z-score). |
endpoint |
A Boolean showing whether the endpoint adjustment mentioned in Agresti (1999) should be used. The default option is FALSE, in which case, the endpoint adjustment will not be not made to the confidence interval. If it is set to TRUE, the endpoint adjustment will be made to the confidence interval only; no adjustment will be made to the p-value or the test statistic. |
adjust |
A character string specifying the cell count adjustment: "Agresti" for the independent-smoothed adjustment of Agresti (1999), "Gart" for the Gart (1966) adjustment of adding 0.5 to each cell, "Fagerland" for the Fagerland and Newcombe (2012) adjustment of adding 0.25 to each cell, "Woolf" for no adjustment, corresponding to the original Woolf (1955) logit interval, and "Custom" for custom adjustment. |
adjust.custom |
A numeric vector of length 4 specifying the custom cell count adjustments. This is used only when "Custom" is chosen for in the |
se.option |
A character string specifying the standard error option: "original" for the original (untransformed) version and "sinh" for the inverse hyperbolic sine transformation of Newcombe (2001). |
conf.level |
A numeric specifying the confidence level. It must be a single number between 0 and 1. The default option is 0.95 for the 95% confidence level. |
This function provides new ways of computing an approximate odds ratio confidence interval for the 2-by-2 contingency table. Specifically, it allows the users to use the t-distribution with the Welch-adjusted degrees of freedom. Some brief descriptions can be found in Clinton, Morgan, and Noguchi (2026) although similar confidence intervals for the difference between the two proportions can also be found in Pan (2002).
An object of class "htest" with components:
The value of the t- or z-test statistic. It returns NA if the estimate is of an indefinite form.
The degrees of freedom of the approximate t-distribution of the test statistic. It returns Inf if "Asymptotic" is chosen for the dist input argument. It returns NA if the estimate is of an indefinite form.
P-value. It returns NA if the estimate is of an indefinite form.
Estimated odds ratio. If the estimate is of an indefinite form such as 0/0, it returns NA.
Confidence interval for the population odds ratio parameter. It returns a unit interval if the estimate is of an indefinite form.
Population of the odds ratio parameter under the null hypothesis.
Character string describing the alternative hypothesis.
Character string indicating the method used.
Character string giving the names of the data.
Agresti, A. (1999). On logit confidence intervals for the odds ratio with small samples. Biometrics, 55(2), 597–602.
Clinton, C., Morgan, M., and Noguchi, K. (2026). A Comparison of Odds Ratio Confidence Interval Methods Utilizing Welch's Adjustment. 2026 Joint Mathematics Meetings, Washington, D.C.
Fagerland, M. W., and Newcombe, R. G. (2013). Confidence intervals for odds ratio and relative risk based on the inverse hyperbolic sine transformation. Statistics in Medicine, 32(16), 2823–2836.
Gart, J. J. (1966). Alternative analyses of contingency tables. Journal of the Royal Statistical Society Series B: Statistical Methodology, 28(1), 164–179.
Newcombe, R. G. (2001). Logit confidence intervals and the inverse sinh transformation. The American Statistician, 55(3), 200–202.
Pan, W. (2002). Approximate confidence intervals for one proportion and difference of two proportions. Computational Statistics and Data Analysis, 40(1), 143–157.
Woolf, B. (1955). On estimating the relation between blood group and disease. Annals of Human Genetics, 19(4), 251–253.
See OR_Compare for comparing the performances of different odds ratio confidence intervals.
#Testing with the data from Dube et al. (2009) test_Dube <- OR_Welch( x = as.numeric(Dube_2009[1, 2:3]), n = as.numeric(Dube_2009[3, 2:3])) #Another example using simulated data OR_Welch(x = c(12, 5), n = c(20, 18))#Testing with the data from Dube et al. (2009) test_Dube <- OR_Welch( x = as.numeric(Dube_2009[1, 2:3]), n = as.numeric(Dube_2009[3, 2:3])) #Another example using simulated data OR_Welch(x = c(12, 5), n = c(20, 18))
Computes descriptive statistics of objects of the class "ORCompare" by creating a data frame of top-performing approximate odds ratio confidence interval methods.
ORCompare_Counts(object, rank.by = NULL, n = 5, m = 2, l = 4)ORCompare_Counts(object, rank.by = NULL, n = 5, m = 2, l = 4)
object |
An object of class " |
rank.by |
A character string or a vector of character strings specifying which metric(s) to rank by. The default option is NULL, in which case, every option below is used. The available options are:
|
n |
An integer specifying the number of rankings in each group. The default option is 5. |
m |
An integer specifying the number of ranking groups. The default option is 2. |
l |
An integer specifying the number of methods to display. The default option is 4. |
This function calculates descriptive statistics of of the class "ORCompare" by giving counts (frequencies) of each approximate odds ratio confidence interval method appearing in the rankings.
An "ORCompareCounts" class object.
OR_Compare, summary.ORCompareCounts, print.ORCompareCounts, plot.ORCompareCounts, barplot.ORCompareCounts.
#Testing with the data from Wei et al. (2015) test_Wei <- OR_Compare( x = as.numeric(Wei_2015[1, 2:3]), n = as.numeric(Wei_2015[3, 2:3]), alternative = "two.sided", data.gen = "Binomial", conf.level = 0.95, nsim = 1000, fix.seed = TRUE, seed.num = 1234 ) ORCompare_Counts(test_Wei) #Another example using simulated data sim_results <- OR_Compare( x = c(10, 20), n = c(30, 50), alternative = "two.sided", data.gen = "Binomial", conf.level = 0.95, nsim = 1000, fix.seed = TRUE, seed.num = 1234 ) ORCompare_Counts(sim_results, rank.by="Coverage_Prob_All", n = 3, m = 3, l = 5) ORCompare_Counts(sim_results)#Testing with the data from Wei et al. (2015) test_Wei <- OR_Compare( x = as.numeric(Wei_2015[1, 2:3]), n = as.numeric(Wei_2015[3, 2:3]), alternative = "two.sided", data.gen = "Binomial", conf.level = 0.95, nsim = 1000, fix.seed = TRUE, seed.num = 1234 ) ORCompare_Counts(test_Wei) #Another example using simulated data sim_results <- OR_Compare( x = c(10, 20), n = c(30, 50), alternative = "two.sided", data.gen = "Binomial", conf.level = 0.95, nsim = 1000, fix.seed = TRUE, seed.num = 1234 ) ORCompare_Counts(sim_results, rank.by="Coverage_Prob_All", n = 3, m = 3, l = 5) ORCompare_Counts(sim_results)
Sorts the top-performing approximate odds ratio confidence interval methods for objects of the class "ORCompare".
ORCompare_Sort(x, top.n = 10, rank.by = NULL)ORCompare_Sort(x, top.n = 10, rank.by = NULL)
x |
An object of class " |
top.n |
An integer specifying how many of the top methods to extract. The default option is 10. |
rank.by |
A character string or a vector of character strings specifying which metric(s) to rank by. The default option is NULL, in which case, every option below is used. The available options are:
|
This function sorts the best-performing approximate odds ratio confidence intervals according to the chosen metric(s). By default, these methods are ranked by how close the simulated coverage probability is to the nominal confidence level.
An "ORCompareSort" class object.
OR_Compare, summary.ORCompareSort, print.ORCompareSort.
#Testing with the data from Sando et al. (2008) test_Sando <- OR_Compare( x = as.numeric(Sando_2008[1, 2:3]), n = as.numeric(Sando_2008[3, 2:3]), alternative = "two.sided", data.gen = "Binomial", conf.level = 0.95, nsim = 1000, fix.seed = TRUE, seed.num = 1234 ) ORCompare_Sort(test_Sando) #Another example using simulated data sim_results <- OR_Compare( x = c(10, 20), n = c(30, 50), alternative = "two.sided", data.gen = "Binomial", conf.level = 0.95, nsim = 1000, fix.seed = TRUE, seed.num = 1234 ) ORCompare_Sort(sim_results, top.n = 5, rank.by = "Median_Log_Length") ORCompare_Sort(sim_results)#Testing with the data from Sando et al. (2008) test_Sando <- OR_Compare( x = as.numeric(Sando_2008[1, 2:3]), n = as.numeric(Sando_2008[3, 2:3]), alternative = "two.sided", data.gen = "Binomial", conf.level = 0.95, nsim = 1000, fix.seed = TRUE, seed.num = 1234 ) ORCompare_Sort(test_Sando) #Another example using simulated data sim_results <- OR_Compare( x = c(10, 20), n = c(30, 50), alternative = "two.sided", data.gen = "Binomial", conf.level = 0.95, nsim = 1000, fix.seed = TRUE, seed.num = 1234 ) ORCompare_Sort(sim_results, top.n = 5, rank.by = "Median_Log_Length") ORCompare_Sort(sim_results)
Plots objects of the class "ORCompareCounts" to summarize the the top-performing approximate odds ratio confidence interval methods.
## S3 method for class 'ORCompareCounts' plot(x, ...)## S3 method for class 'ORCompareCounts' plot(x, ...)
x |
An object of class " |
... |
Additional arguments. |
This function displays the counts (frequencies) of the top-performing methods graphically.
No return value, called for plotting objects of the class "ORCompareCounts".
ORCompare_Counts, summary.ORCompareCounts, print.ORCompareCounts, barplot.ORCompareCounts.
#Testing with the data from Wei et al. (2015) test_Wei <- OR_Compare( x = as.numeric(Wei_2015[1, 2:3]), n = as.numeric(Wei_2015[3, 2:3]), alternative = "two.sided", data.gen = "Binomial", conf.level = 0.95, nsim = 1000, fix.seed = TRUE, seed.num = 1234 ) test_Wei_counts <- ORCompare_Counts(test_Wei) oldpar <- par(mfrow = c(1,2)) par(mar = c(17, 4.1, 4.1, 2.1)) method_rank_group <- as.factor(paste(test_Wei_counts$Method, test_Wei_counts$Rank_Group)) plot(test_Wei_counts, xlab = "", ylab = "Count", main = "Counts vs. Methods", type = "h", col = "blue", xaxt = "n", lwd = 50, lend = "butt") axis(1, at = 1:nrow(test_Wei_counts), labels = method_rank_group, las = 2) par(oldpar) #Another example using simulated data sim_results <- OR_Compare( x = c(10, 20), n = c(30, 50), alternative = "two.sided", data.gen = "Binomial", conf.level = 0.95, nsim = 1000, fix.seed = TRUE, seed.num = 1234 ) sim_results_counts <- ORCompare_Counts(sim_results) oldpar <- par(mfrow = c(1,2)) par(mar = c(17, 4.1, 4.1, 2.1)) method_rank_group <- as.factor(paste(sim_results_counts$Method, sim_results_counts$Rank_Group)) plot(sim_results_counts, xlab = "", ylab = "Count", main = "Counts vs. Methods", type = "h", col = "blue", xaxt = "n", lwd = 50, lend="butt") axis(1, at = 1:nrow(sim_results_counts), labels = method_rank_group, las = 2) par(oldpar)#Testing with the data from Wei et al. (2015) test_Wei <- OR_Compare( x = as.numeric(Wei_2015[1, 2:3]), n = as.numeric(Wei_2015[3, 2:3]), alternative = "two.sided", data.gen = "Binomial", conf.level = 0.95, nsim = 1000, fix.seed = TRUE, seed.num = 1234 ) test_Wei_counts <- ORCompare_Counts(test_Wei) oldpar <- par(mfrow = c(1,2)) par(mar = c(17, 4.1, 4.1, 2.1)) method_rank_group <- as.factor(paste(test_Wei_counts$Method, test_Wei_counts$Rank_Group)) plot(test_Wei_counts, xlab = "", ylab = "Count", main = "Counts vs. Methods", type = "h", col = "blue", xaxt = "n", lwd = 50, lend = "butt") axis(1, at = 1:nrow(test_Wei_counts), labels = method_rank_group, las = 2) par(oldpar) #Another example using simulated data sim_results <- OR_Compare( x = c(10, 20), n = c(30, 50), alternative = "two.sided", data.gen = "Binomial", conf.level = 0.95, nsim = 1000, fix.seed = TRUE, seed.num = 1234 ) sim_results_counts <- ORCompare_Counts(sim_results) oldpar <- par(mfrow = c(1,2)) par(mar = c(17, 4.1, 4.1, 2.1)) method_rank_group <- as.factor(paste(sim_results_counts$Method, sim_results_counts$Rank_Group)) plot(sim_results_counts, xlab = "", ylab = "Count", main = "Counts vs. Methods", type = "h", col = "blue", xaxt = "n", lwd = 50, lend="butt") axis(1, at = 1:nrow(sim_results_counts), labels = method_rank_group, las = 2) par(oldpar)
Summarizes the rankings of different approximate odds ratio confidence interval methods.
## S3 method for class 'ORCompare' print(x, ...)## S3 method for class 'ORCompare' print(x, ...)
x |
An object of class " |
... |
Additional arguments. |
This function displays the rankings of approximate methods according to different metrics used.
An "ORCompare" class object.
OR_Compare, summary.ORCompare.
#Testing with the data from Doll and Hill (1950) test_Doll_Hill <- OR_Compare( x = as.numeric(Doll_Hill_1950[1, 2:3]), n = as.numeric(Doll_Hill_1950[3, 2:3]), alternative = "two.sided", data.gen = "Binomial", conf.level = 0.95, nsim = 1000, fix.seed = TRUE, seed.num = 1234 ) print(test_Doll_Hill) #Another example using simulated data sim_results <- OR_Compare( x = c(10, 20), n = c(30, 50), alternative = "two.sided", data.gen = "Binomial", conf.level = 0.95, nsim = 1000, fix.seed = TRUE, seed.num = 1234 ) print(sim_results)#Testing with the data from Doll and Hill (1950) test_Doll_Hill <- OR_Compare( x = as.numeric(Doll_Hill_1950[1, 2:3]), n = as.numeric(Doll_Hill_1950[3, 2:3]), alternative = "two.sided", data.gen = "Binomial", conf.level = 0.95, nsim = 1000, fix.seed = TRUE, seed.num = 1234 ) print(test_Doll_Hill) #Another example using simulated data sim_results <- OR_Compare( x = c(10, 20), n = c(30, 50), alternative = "two.sided", data.gen = "Binomial", conf.level = 0.95, nsim = 1000, fix.seed = TRUE, seed.num = 1234 ) print(sim_results)
Summarizes how often the top-performing methods appear in the ranking.
## S3 method for class 'ORCompareCounts' print(x, ...)## S3 method for class 'ORCompareCounts' print(x, ...)
x |
An object of class " |
... |
Additional arguments. |
This function displays how many times the top-performing methods appeared according to different metric(s) used.
An "ORCompareCounts" class object.
ORCompare_Counts, summary.ORCompareCounts, plot.ORCompareCounts, barplot.ORCompareCounts.
#Testing with the data from Rake et al. (2009) test_Rake <- OR_Compare( x = as.numeric(Rake_2009[1, 2:3]), n = as.numeric(Rake_2009[3, 2:3]), alternative = "two.sided", data.gen = "Binomial", conf.level = 0.95, nsim = 1000, fix.seed = TRUE, seed.num = 1234 ) test_Rake_counts <- ORCompare_Counts(test_Rake) print(test_Rake_counts) #Another example using simulated data sim_results <- OR_Compare( x = c(10, 20), n = c(30, 50), alternative = "two.sided", data.gen = "Binomial", conf.level = 0.95, nsim = 1000, fix.seed = TRUE, seed.num = 1234 ) sim_results_counts <- ORCompare_Counts(sim_results) print(sim_results_counts)#Testing with the data from Rake et al. (2009) test_Rake <- OR_Compare( x = as.numeric(Rake_2009[1, 2:3]), n = as.numeric(Rake_2009[3, 2:3]), alternative = "two.sided", data.gen = "Binomial", conf.level = 0.95, nsim = 1000, fix.seed = TRUE, seed.num = 1234 ) test_Rake_counts <- ORCompare_Counts(test_Rake) print(test_Rake_counts) #Another example using simulated data sim_results <- OR_Compare( x = c(10, 20), n = c(30, 50), alternative = "two.sided", data.gen = "Binomial", conf.level = 0.95, nsim = 1000, fix.seed = TRUE, seed.num = 1234 ) sim_results_counts <- ORCompare_Counts(sim_results) print(sim_results_counts)
Summarizes the top-performing methods by sorting them according to the rankings for the chosen metric(s).
## S3 method for class 'ORCompareSort' print(x, ...)## S3 method for class 'ORCompareSort' print(x, ...)
x |
An object of class " |
... |
Additional arguments. |
This function displays the top-performing methods as lists according to different metric(s) used.
An "ORCompareSort" class object.
ORCompare_Sort, summary.ORCompareSort.
#Testing with the data from Sando et al. (2008) test_Sando <- OR_Compare( x = as.numeric(Sando_2008[1, 2:3]), n = as.numeric(Sando_2008[3, 2:3]), alternative = "two.sided", data.gen = "Binomial", conf.level = 0.95, nsim = 1000, fix.seed = TRUE, seed.num = 1234 ) test_Sando_sort <- ORCompare_Sort(test_Sando) print(test_Sando_sort) #Another example using simulated data sim_results <- OR_Compare( x = c(10, 20), n = c(30, 50), alternative = "two.sided", data.gen = "Binomial", conf.level = 0.95, nsim = 1000, fix.seed = TRUE, seed.num = 1234 ) sim_results_sort <- ORCompare_Sort(sim_results) print(sim_results_sort)#Testing with the data from Sando et al. (2008) test_Sando <- OR_Compare( x = as.numeric(Sando_2008[1, 2:3]), n = as.numeric(Sando_2008[3, 2:3]), alternative = "two.sided", data.gen = "Binomial", conf.level = 0.95, nsim = 1000, fix.seed = TRUE, seed.num = 1234 ) test_Sando_sort <- ORCompare_Sort(test_Sando) print(test_Sando_sort) #Another example using simulated data sim_results <- OR_Compare( x = c(10, 20), n = c(30, 50), alternative = "two.sided", data.gen = "Binomial", conf.level = 0.95, nsim = 1000, fix.seed = TRUE, seed.num = 1234 ) sim_results_sort <- ORCompare_Sort(sim_results) print(sim_results_sort)
A 2-by-2 contingency table from Rake et al. (2009) comparing mesothelioma status between individuals who worked as carpenters for more than 10 years before age 30 and individuals employed in non-industrial occupations.
Rake_2009Rake_2009
A data frame with 3 rows and 4 variables:
Mesothelioma status ("Mesothelioma", "None", "Total").
Number of individuals who worked as carpenters for more than 10 years before age 30.
Number of individuals employed in non-industrial occupations.
Row totals.
The contingency table is:
| Mesothelioma Status | Carpenter >10 Years Before 30 | Non-Industrial | Total |
| Mesothelioma | 66 | 15 | 81 |
| None | 25 | 278 | 303 |
| Total | 91 | 293 | 384 |
The estimated odds ratio (OR) is
That is, individuals who worked as carpenters for more than 10 years before age 30 have approximately 48.93 times the odds of being in the mesothelioma group compared to individuals employed in non-industrial occupations. This indicates a strong association between long-term occupational carpentry work and mesothelioma, a cancer commonly associated with asbestos exposure.
The proportion of mesothelioma cases among individuals who worked as carpenters for more than 10 years before age 30 is approximately 0.8148.
Rake, C., Gilham, C., Hatch, J., Darnton, A., Hodgson, J., and Peto, J. (2009). See doi:10.1038/sj.bjc.6604879.
Rake, C., Gilham, C., Hatch, J., Darnton, A., Hodgson, J., and Peto, J. (2009). Occupational, domestic and environmental mesothelioma risks in the British population: a case–control study. British Journal of Cancer, 100, 1175–1183.
data(Rake_2009) Rake_2009 n11 <- as.numeric(Rake_2009[1,2]) n12 <- as.numeric(Rake_2009[1,3]) n21 <- as.numeric(Rake_2009[2,2]) n22 <- as.numeric(Rake_2009[2,3]) OR <- (n11 * n22) / (n12 * n21) ORdata(Rake_2009) Rake_2009 n11 <- as.numeric(Rake_2009[1,2]) n12 <- as.numeric(Rake_2009[1,3]) n21 <- as.numeric(Rake_2009[2,2]) n22 <- as.numeric(Rake_2009[2,3]) OR <- (n11 * n22) / (n12 * n21) OR
A 2-by-2 contingency table from Sando et al. (2008) comparing Alzheimer's disease status between individuals with the APOE e4/e4 genotype and individuals with the APOE e3/e3 genotype.
Sando_2008Sando_2008
A data frame with 3 rows and 4 variables:
Alzheimer's disease status ("Alzheimer's Disease", "None", "Total").
Number of individuals with the APOE e4/e4 genotype.
Number of individuals with the APOE e3/e3 genotype.
Row totals.
The estimated odds ratio (OR) is
That is, individuals with the APOE e4/e4 genotype have approximately 12.95 times the odds of being in the Alzheimer's disease group compared to individuals with the APOE e3/e3 genotype, indicating a strong association between the APOE e4/e4 genotype and Alzheimer's disease.
The proportion of Alzheimer's disease cases among individuals with the APOE e4/e4 genotype is approximately 0.3497.
Sando, S. B., Melquist, S., Cannon, A., Hutton, M.L., Sletvold, O., Saltvedt, I., White, L. R., Lydersen, S., and Aasly, J. O. (2008). See doi:10.1186/1471-2377-8-9.
Sando, S. B., Melquist, S., Cannon, A., Hutton, M.L., Sletvold, O., Saltvedt, I., White, L. R., Lydersen, S., and Aasly, J. O. (2008). APOE e4 lowers age at onset and is a high risk factor for Alzheimer's disease; A case control study from central Norway. BMC Neurology, 8(9), 7 pages.
data(Sando_2008) Sando_2008 n11 <- as.numeric(Sando_2008[1,2]) n12 <- as.numeric(Sando_2008[1,3]) n21 <- as.numeric(Sando_2008[2,2]) n22 <- as.numeric(Sando_2008[2,3]) OR <- (n11 * n22) / (n12 * n21) ORdata(Sando_2008) Sando_2008 n11 <- as.numeric(Sando_2008[1,2]) n12 <- as.numeric(Sando_2008[1,3]) n21 <- as.numeric(Sando_2008[2,2]) n22 <- as.numeric(Sando_2008[2,3]) OR <- (n11 * n22) / (n12 * n21) OR
Summarizes the rankings of different approximate odds ratio confidence interval methods.
## S3 method for class 'ORCompare' summary(object, ...)## S3 method for class 'ORCompare' summary(object, ...)
object |
An object of class " |
... |
Additional arguments. |
This function displays the rankings of approximate methods according to different metrics used.
An "ORCompare" class object.
#Testing with the data from Dube et al. (2009) test_Dube <- OR_Compare( x = as.numeric(Dube_2009[1, 2:3]), n = as.numeric(Dube_2009[3, 2:3]), alternative = "two.sided", data.gen = "Binomial", conf.level = 0.95, nsim = 1000, fix.seed = TRUE, seed.num = 1234 ) summary(test_Dube) #Another example using simulated data sim_results <- OR_Compare( x = c(10, 20), n = c(30, 50), alternative = "two.sided", data.gen = "Binomial", conf.level = 0.95, nsim = 1000, fix.seed = TRUE, seed.num = 1234 ) summary(sim_results)#Testing with the data from Dube et al. (2009) test_Dube <- OR_Compare( x = as.numeric(Dube_2009[1, 2:3]), n = as.numeric(Dube_2009[3, 2:3]), alternative = "two.sided", data.gen = "Binomial", conf.level = 0.95, nsim = 1000, fix.seed = TRUE, seed.num = 1234 ) summary(test_Dube) #Another example using simulated data sim_results <- OR_Compare( x = c(10, 20), n = c(30, 50), alternative = "two.sided", data.gen = "Binomial", conf.level = 0.95, nsim = 1000, fix.seed = TRUE, seed.num = 1234 ) summary(sim_results)
Summarizes how often the top-performing methods appear in the ranking.
## S3 method for class 'ORCompareCounts' summary(object, ...)## S3 method for class 'ORCompareCounts' summary(object, ...)
object |
An object of class " |
... |
Additional arguments. |
This function displays how many times the top-performing methods appeared according to different metric(s) used.
An "ORCompareCounts" class object.
ORCompare_Counts, print.ORCompareCounts, plot.ORCompareCounts, barplot.ORCompareCounts.
#Testing with the data from Wei et al. (2015) test_Wei <- OR_Compare( x = as.numeric(Wei_2015[1, 2:3]), n = as.numeric(Wei_2015[3, 2:3]), alternative = "two.sided", data.gen = "Binomial", conf.level = 0.95, nsim = 1000, fix.seed = TRUE, seed.num = 1234 ) test_Wei_counts <- ORCompare_Counts(test_Wei) summary(test_Wei_counts) #Another example using simulated data sim_results <- OR_Compare( x = c(10, 20), n = c(30, 50), alternative = "two.sided", data.gen = "Binomial", conf.level = 0.95, nsim = 1000, fix.seed = TRUE, seed.num = 1234 ) sim_results_counts <- ORCompare_Counts(sim_results) summary(sim_results_counts)#Testing with the data from Wei et al. (2015) test_Wei <- OR_Compare( x = as.numeric(Wei_2015[1, 2:3]), n = as.numeric(Wei_2015[3, 2:3]), alternative = "two.sided", data.gen = "Binomial", conf.level = 0.95, nsim = 1000, fix.seed = TRUE, seed.num = 1234 ) test_Wei_counts <- ORCompare_Counts(test_Wei) summary(test_Wei_counts) #Another example using simulated data sim_results <- OR_Compare( x = c(10, 20), n = c(30, 50), alternative = "two.sided", data.gen = "Binomial", conf.level = 0.95, nsim = 1000, fix.seed = TRUE, seed.num = 1234 ) sim_results_counts <- ORCompare_Counts(sim_results) summary(sim_results_counts)
Summarizes the top-performing methods by sorting them according to the rankings for the chosen metric(s).
## S3 method for class 'ORCompareSort' summary(object, ...)## S3 method for class 'ORCompareSort' summary(object, ...)
object |
An object of class " |
... |
Additional arguments. |
This function displays the top-performing methods as lists according to different metric(s) used.
An "ORCompareSort" class object.
ORCompare_Sort, print.ORCompareSort.
#Testing with the data from Doll and Hill (1950) test_Doll_Hill <- OR_Compare( x = as.numeric(Doll_Hill_1950[1, 2:3]), n = as.numeric(Doll_Hill_1950[3, 2:3]), alternative = "two.sided", data.gen = "Binomial", conf.level = 0.95, nsim = 1000, fix.seed = TRUE, seed.num = 1234 ) test_Doll_Hill_sort <- ORCompare_Sort(test_Doll_Hill) summary(test_Doll_Hill_sort) #Another example using simulated data sim_results <- OR_Compare( x = c(10, 20), n = c(30, 50), alternative = "two.sided", data.gen = "Binomial", conf.level = 0.95, nsim = 1000, fix.seed = TRUE, seed.num = 1234 ) sim_results_sort <- ORCompare_Sort(sim_results) summary(sim_results_sort)#Testing with the data from Doll and Hill (1950) test_Doll_Hill <- OR_Compare( x = as.numeric(Doll_Hill_1950[1, 2:3]), n = as.numeric(Doll_Hill_1950[3, 2:3]), alternative = "two.sided", data.gen = "Binomial", conf.level = 0.95, nsim = 1000, fix.seed = TRUE, seed.num = 1234 ) test_Doll_Hill_sort <- ORCompare_Sort(test_Doll_Hill) summary(test_Doll_Hill_sort) #Another example using simulated data sim_results <- OR_Compare( x = c(10, 20), n = c(30, 50), alternative = "two.sided", data.gen = "Binomial", conf.level = 0.95, nsim = 1000, fix.seed = TRUE, seed.num = 1234 ) sim_results_sort <- ORCompare_Sort(sim_results) summary(sim_results_sort)
A 2-by-2 contingency table from Wei et al. (2015) comparing ankylosing spondylitis status between individuals who are HLA-B27 positive and individuals who are HLA-B27 negative.
Wei_2015Wei_2015
A data frame with 3 rows and 4 variables:
Disease status ("Ankylosing Spondylitis", "None", "Total").
Number of HLA-B27 positive individuals.
Number of HLA-B27 negative individuals.
Row totals.
The contingency table is:
| Ankylosing Spondylitis Status | HLA-B27+ | HLA-B27- | Total |
| Ankylosing Spondylitis | 431 | 40 | 471 |
| None | 43 | 514 | 557 |
| Total | 474 | 554 | 1028 |
The estimated odds ratio (OR) is
That is, HLA-B27 positive individuals have approximately 128.80 times the odds of having ankylosing spondylitis compared to HLA-B27 negative individuals, indicating an extremely strong association between HLA-B27 positivity and ankylosing spondylitis.
The proportion of ankylosing spondylitis cases among HLA-B27 positive individuals is approximately 0.9151.
Wei, J. C.-C., Sung-Ching, H. W., Hsu, Y.-W., Wen, Y.-F., Wang, W.-C., Wong, R.-H., Lu, H.-F., van Gaalen, F. A., and Chang, W.C-. (2015). See doi:10.1371/journal.pone.0137189.
Wei, J. C.-C., Wong, H. S.-C., Hsu, Y.-W., Wen, Y.-F., Wang, W.-C., Wong, R.-H., Lu, H.-F., van Gaalen, F. A., and Chang, W.C-. (2015). Interaction between HLA-B60 and HLA-B27 as a better predictor of ankylosing spondylitis in a Taiwanese population PLoS ONE, 10(10): e0137189.
data(Wei_2015) Wei_2015 n11 <- as.numeric(Wei_2015[1,2]) n12 <- as.numeric(Wei_2015[1,3]) n21 <- as.numeric(Wei_2015[2,2]) n22 <- as.numeric(Wei_2015[2,3]) OR <- (n11 * n22) / (n12 * n21) ORdata(Wei_2015) Wei_2015 n11 <- as.numeric(Wei_2015[1,2]) n12 <- as.numeric(Wei_2015[1,3]) n21 <- as.numeric(Wei_2015[2,2]) n22 <- as.numeric(Wei_2015[2,3]) OR <- (n11 * n22) / (n12 * n21) OR