UK-based online statistics and data analysis support for USA, UK, and international clients. No exams, no impersonation, no fabricated data.

Unconditional exact inference for two independent proportions

Boschloo Test: Formula, Statistic, Calculator, Python, R, SPSS and Excel Guide

Boschloo Test, commonly written as Boschloo's Test, is an unconditional exact procedure for comparing two independent binomial proportions in a 2 × 2 table. This guide explains the Fisher-p ordering statistic, nuisance-parameter maximization, two-sided convention, effect sizes, APA reporting, Python and R charts, SPSS output, Excel formulas and a worked analysis of 649 students.

2 × 2 contingency table649 observationsRisk difference −5.74 pointsBoschloo p = 0.051387

Boschloo Test Model Overview

Boschloo Test is an exact unconditional test for comparing two independent binary-outcome probabilities. It uses a one-sided Fisher exact p-value to order every possible 2 × 2 table and then maximizes the unconditional tail probability over the common null success probability.

Research Question

Does the probability of G3 ≥ 10 differ between female and male students?

H0: pF = pM    versus    H1: pF ≠ pM

Why the Method Is Unconditional

The female and male sample sizes are fixed, but the combined positive-outcome total is not conditioned upon. Under H0, both groups share an unknown probability π. Boschloo Test finds the largest null rejection probability over possible π values.

Boschloo Test Statistic

The Boschloo Test statistic is a one-sided Fisher exact p-value. For the observed direction, the statistic is 0.0304927910. Smaller Fisher-p values define more extreme tables.

Two-Sided Convention

The primary workflow uses twice the smaller one-sided Boschloo p-value, clipped at 1.

2 × min(0.0256936226, 0.9779287416) = 0.0513872452

Worked Scenario

Female students have 333 positive and 50 negative outcomes; male students have 216 positive and 50 negative outcomes. The positive proportions are 0.869452 and 0.812030.

Overview conclusion: Boschloo Test gives p = 0.051387. At α = .05, the null is not rejected, although the observed difference is 5.74 percentage points.

Quick Answer: Boschloo Test Result

Female G3 ≥ 10333/383
Male G3 ≥ 10216/266
Fisher-p statistic0.030493
Exact p-value0.051387

Test Summary

  • Procedure: two-sided Boschloo unconditional exact test
  • Selected direction: greater
  • One-sided p: 0.025694
  • Two-sided p: 0.051387
  • Decision: fail to reject H0

Substantive Meaning

  • Female proportion: 0.869452
  • Male proportion: 0.812030
  • Risk difference, M − F: -0.057422
  • Risk ratio: 0.933957
  • Cramer's V: 0.078222
Best interpretation: the positive-outcome proportion was 5.74 percentage points lower among males. Boschloo Test produced borderline but nonsignificant evidence, p = .051, and the association was small.
Do not write “the groups are equal”: p = .051 means the exact procedure did not cross .05; it does not prove identical probabilities.

Table of Contents

  1. Research question and data design
  2. When to use Boschloo Test
  3. How Boschloo's Test works
  4. Variables and data dictionary
  5. Complete results
  6. Boschloo vs Fisher, Barnard and chi-square
  7. Calculator steps
  8. Seven Python chart stories
  9. Five additional R charts
  10. Assumptions and diagnostics
  11. Python, R, SPSS and Excel
  12. Expandable code
  13. Advanced topics
  14. APA reporting
  15. Common mistakes
  16. Downloads
  17. Related guides
  18. FAQs
  19. Conclusion

Research Question, Hypotheses and Data Design

Independent groupsFemale and male students form two binomial samples.
Binary outcomeG3 ≥ 10 versus G3 < 10.
Inferential targetEquality of the two positive-outcome probabilities.

Null and Alternative Hypotheses

HypothesisStatementMeaning
NullpF = pMEqual positive-outcome probabilities.
Two-sidedpF ≠ pMDifferent probabilities in either direction.
DirectionalpF > pMUse only when specified before the data are viewed.

Sampling Design

The fixed binomial sample sizes are 383 and 266. The combined positive total of 549 is not fixed by the test.

Why Direction Must Be Prespecified

The observed proportions suggest a female advantage, but the primary analysis remains two-sided. See Null and Alternative Hypothesis and Type I and Type II Error.

Methods sentence: “A two-sided Boschloo Test compared two independent binomial proportions using a one-sided Fisher exact p-value as the ordering statistic.”

When to Use Boschloo Test

Use It When

  • The table is exactly 2 × 2.
  • The groups are independent.
  • The outcome is binary.
  • The group sample sizes are fixed.
  • The outcome totals are not fixed.
  • An exact unconditional comparison is required.
  • Fisher may be unnecessarily conservative.
  • Small or unbalanced samples make asymptotic methods unattractive.

Choose Another Method When

  • Observations are paired.
  • The table is larger than 2 × 2.
  • Data are clustered or repeated.
  • Covariate adjustment is required.
  • The original outcome should stay quantitative.
  • Both margins were fixed.
  • The question concerns prediction.
  • Multiple strata require adjustment.

Boschloo Test Statistic 2x4 Clarification

The phrase boschloo test statistic 2x4 describes a table outside the standard method. Boschloo Test is defined for 2 × 2 tables. A 2 × 4 table requires a larger-table method or a justified recoding.

Independent Versus Paired Data

Boschloo's Test is not a matched-pair test. Repeated observations from the same people require a paired binary procedure.

How Boschloo's Test Works

Step 1Fisher ordering

Calculate a one-sided Fisher p-value.

Step 2Enumerate tables

Vary both success counts while fixing group sizes.

Step 3Maximize tail

Search the common null probability.

Observed Table

GroupG3 ≥ 10G3 < 10TotalProportion
Female333503830.869451697
Male216502660.812030075

Observed Fisher-p Statistic

Tobs = 0.0304927910

Double-Binomial Sample Space

Female positive counts range from 0 to 383; male positive counts range from 0 to 266. The exact calculation considers 102,528 possible count pairs.

Joint Null Probability

P(XF,XM|π) = Bin(383,XF;π) × Bin(266,XM;π)

Nuisance Maximization

pone-sided = max0≤π≤1 Σ P(extreme table|π)

The greater-direction maximum is 0.0256936226 near π = .590522. The opposite-direction result is 0.9779287416.

Two-Sided Result

p = min[1,2 × min(pless,pgreater)] = 0.0513872452

Statistic Versus P-Value

The statistic is the observed one-sided Fisher p-value. The final p-value is an unconditional maximum. Reporting them as the same number is incorrect.

Variables and Data Dictionary

VariableRoleCodingNCountsMeaning
sexGrouping variableF, M649383, 266Two independent samples.
G3Original outcome0–19649ThresholdedSource of the binary event.
G3 ≥ 10Positive outcome1649549Event category.
G3 < 10Negative outcome0649100Non-event category.

Observed, Expected and Residual Values

CellObservedExpectedPearson residualAdjusted residual
Female positive333323.9861330.5007811.992745
Female negative5059.013867-1.173368-1.992745
Male positive216225.013867-0.600906-1.992745
Male negative5040.9861331.4079681.992745
Direction: relative effects are male compared with female. Reversing groups changes signs or reciprocals but not the two-sided decision.

Complete Boschloo Test Results

Female proportion0.869452

333/383

Male proportion0.812030

216/266

Risk difference-0.057422

Male minus female

Fisher-p statistic0.030493

Ordering value

Boschloo p0.051387

Two-sided exact

Cramer's V0.078222

Small association

Primary Test

TestStatisticP-valueDecision
Two-sided Boschloo Test0.03049279100.0513872452Fail to reject H0
Greater component0.03049279100.0256936226Directional rejection
Less component0.98178691780.9779287416Fail to reject

Effect Estimates

MeasureEstimate95% lower95% upperMeaning
Female proportion0.8694516970.8320100790.899555769Female positive probability.
Male proportion0.8120300750.7607620320.854414008Male positive probability.
Risk difference-0.057421622-0.1152383350.000395091Male is 5.74 points lower.
Risk ratio0.9339565130.8711337021.001309864Male probability is 93.4% of female probability.
Odds ratio0.6486486490.4228979880.994909130Male success odds are lower.
Cramer's V0.078222103Small association.

Interpretation

The two-sided Boschloo Test p-value is .051387, slightly above .05. The equality null is not rejected. The effect estimates nevertheless show a 5.74-point female advantage, with intervals that sit close to their null values.

Why Intervals Can Differ at the Boundary

The displayed risk-difference, risk-ratio and odds-ratio intervals use different approximate scales and are not exact inversions of the Boschloo Test. Small differences near the threshold are therefore possible.

Result summary: the observed association is small and the exact evidence is borderline, but the primary two-sided result remains nonsignificant at .05.

Boschloo Test Versus Fisher, Barnard and Chi-Square

Boschloo

Unconditional exact test ordered by Fisher p-values.

Fisher

Conditional exact test with fixed margins.

Barnard

Unconditional test ordered by a score statistic.

Chi-Square

Asymptotic test based on observed and expected counts.

Numerical Comparison

MethodStatisticP-valueDecisionRole
Boschloo Test0.0304930.051387Fail to rejectPrimary exact result
Fisher exactOR = 1.5416670.059797Fail to rejectConditional comparison
Barnard exact1.9927450.048703Reject narrowlyAlternative ordering
Pearson chi-square3.9710350.046289RejectAsymptotic comparison
Yates chi-square3.5427060.059808Fail to rejectCorrected comparison

Why Boschloo Is More Powerful Than Fisher

Boschloo Test uses Fisher's p-value as an ordering statistic but calibrates the rejection region unconditionally. This avoids some conservatism caused by conditioning on the observed outcome total.

Boschloo Versus Barnard

Both are unconditional. Boschloo uses Fisher-p ordering; Barnard uses a score or Wald ordering. Different exact orderings can give different borderline decisions.

Why Pearson Rejects

Pearson uses an asymptotic continuous reference and gives p = .0463. Boschloo uses a discrete unconditional calculation and gives p = .0514.

Which Result Is Primary?

Use the method selected from the design and analysis plan. Do not replace a prespecified Boschloo Test after seeing another p-value cross .05.

Boschloo Test Calculator: Step-by-Step Workflow

A Boschloo Test calculator needs the four counts, the two group totals, the alternative, the two-sided convention and a global nuisance search.

Calculator Inputs

InputValue
Female positive333
Female negative50
Male positive216
Male negative50
AlternativeTwo-sided
Two-sided rule2 × smaller one-sided p

Step 1: Confirm Sample Sizes

The fixed binomial totals are 383 and 266, not the outcome totals.

Step 2: Calculate Fisher Ordering

The observed Fisher-p statistic is 0.0304927910.

Step 3: Enumerate Tables

The sample space contains 102,528 possible positive-count pairs.

Step 4: Build the Nuisance Profile

The greater-direction maximum is 0.0256936226 near π = .590522.

Step 5: Double the Smaller Direction

2 × 0.0256936226 = 0.0513872452

Step 6: Interpret the Effect

Read the exact p-value with the two proportions, risk difference and confidence intervals.

Calculator target: statistic = 0.0304927910; two-sided p = 0.0513872452; fail to reject at .05.

Seven Python Boschloo Test Chart Stories

The Python figures progress from the four observed cells to standardized proportions, method comparison, nuisance-parameter optimization, relative effects, expected counts and residual diagnostics. Each chart is interpreted with exact numerical values from the 649-case analysis, so the visual section functions as a connected statistical argument rather than as a gallery of images.

Python Chart 1: Boschloo Test — 2 × 2 Contingency Heatmap

Boschloo Test contingency heatmap showing female and male G3 outcome counts
Observed counts for female and male students classified by G3 ≥ 10 and G3 < 10.
Pattern

The largest cell is the female positive-outcome cell. Both negative cells contain 50 students, but the unequal group totals mean the negative-outcome rates are not equal. The heatmap therefore needs to be read with the row totals rather than by cell size alone.

Key Values

Female: 333 positive and 50 negative, n = 383. Male: 216 positive and 50 negative, n = 266. The complete table contains 649 observations.

Interpretation

Boschloo Test compares two probabilities. The heatmap supplies the four counts used to calculate the one-sided Fisher ordering statistic, enumerate every possible table and construct the unconditional tail probability.

Why It Matters

Every later statistic depends on this coding. Reversing the event category or treating the outcome totals as the sample sizes would answer a different question.

Next step: Confirm that the two independent binomial sample sizes are 383 and 266 before running the exact test.

Python Chart 2: Boschloo Test — Group Outcome Proportions

Boschloo Test chart of female and male positive and negative outcome proportions
Within-group proportions standardize the two groups to a common 100% scale.
Pattern

The female positive segment is visibly larger, whereas the male negative segment is larger. Unlike the count chart, this display removes the effect of unequal sample sizes and presents the substantive group difference directly on the probability scale.

Key Values

Female positive: 86.945%. Male positive: 81.203%. Female negative: 13.055%. Male negative: 18.797%.

Interpretation

The observed female advantage is approximately {(p_f-p_m)*100:.3f} percentage points. This is the primary absolute effect description and remains meaningful regardless of whether the exact p-value lies just above or below .05.

Why It Matters

The proportion chart prevents the larger female sample from being mistaken for stronger performance merely because its positive count is larger.

Next step: Report the two percentages with the raw counts and then state the male-minus-female risk difference.

Python Chart 3: Boschloo Test — Exact and Asymptotic P-Value Comparison

Boschloo Test p-value comparison with Fisher exact Barnard exact and Pearson chi-square methods
Primary and comparison p-values are positioned against the conventional .05 reference line.
Pattern

Boschloo Test and Fisher's exact test remain above .05, while the uncorrected Pearson chi-square result falls below the line. The figure demonstrates how a borderline 2 × 2 table can produce different binary decisions under different conditioning and approximation rules.

Key Values

Boschloo: 0.051387. Fisher: 0.059797. Pearson: 0.046289. Yates: 0.059808.

Interpretation

The comparison does not identify one universally correct p-value. The primary method must be selected from the sampling design and analysis plan. Here, Boschloo Test is the headline procedure, so p = .051 governs the formal two-sided decision.

Why It Matters

Choosing whichever method produces the smallest p-value after inspecting the table creates selective reporting. The chart is useful as a sensitivity display, not as a menu for post-hoc test selection.

Next step: Keep Boschloo Test as the primary result and describe the cross-method differences as sensitivity context.

Python Chart 4: Boschloo Test — Nuisance-Parameter Profile

Boschloo Test nuisance parameter probability profile
Directional unconditional rejection probabilities are displayed across the common null probability.
Pattern

The relevant greater-direction curve rises from the boundaries, reaches an interior maximum and then declines. The opposite-direction curve has a much larger maximum because the observed table is not extreme in that direction.

Key Values

Greater one-sided maximum: 0.0256936226. Maximizing π: approximately 0.590522. Less one-sided maximum: 0.9779287416.

Interpretation

The directional Boschloo p-value is the highest rejection probability over the entire nuisance-parameter range. It is not the probability evaluated only at the observed pooled proportion or at π = .50.

Why It Matters

The profile is the computational heart of the unconditional exact method. A coarse grid can underestimate the supremum and make the test anti-conservative.

Next step: Increase numerical resolution or use global optimization until the maximum and reported p-value are stable.

Python Chart 5: Boschloo Test — Risk Ratio and Odds Ratio

Boschloo Test risk ratio and odds ratio effect measures with confidence intervals
Risk ratio and odds ratio compare male students with female students on two related but different relative scales.
Pattern

Both point estimates are below 1. The risk ratio stays relatively close to the null because it compares common event probabilities, while the odds ratio sits farther from 1 because odds and probability diverge when the outcome is frequent.

Key Values

Risk ratio: 0.933957, 95% CI [0.871134, 1.001310]. Odds ratio: 0.648649, 95% CI [0.422898, 0.994909].

Interpretation

The male positive probability is estimated to be about 93.4% of the female probability. The male success odds are estimated to be about 64.9% of the female odds. These statements are not interchangeable.

Why It Matters

Relative measures can make a small absolute difference look more dramatic. The risk difference of −5.74 percentage points should be presented first.

Next step: State the comparison direction explicitly and report the absolute risk difference before the two ratio measures.

Python Chart 6: Boschloo Test — Observed and Expected Counts

Boschloo Test observed and expected count comparison
Observed 2 × 2 cell counts are compared with counts expected under Pearson independence.
Pattern

Female positive and male negative counts exceed their independence expectations. Female negative and male positive counts fall below expectation. The deviations are balanced because the margins determine all four expected values.

Key Values

Expected counts: 323.986, 59.014, 225.014, and 40.986. Each observed-minus-expected deviation has magnitude approximately 9.014.

Interpretation

The deviations produce Pearson χ² = 3.971 and p = .0463. Boschloo Test does not use an expected-count rule, but the chart explains why the asymptotic comparison is close to the significance threshold.

Why It Matters

All expected counts are above 40. The difference between Boschloo and Pearson is therefore caused by exact versus asymptotic probability rules, not by sparse expected cells.

Next step: Use this chart to explain the chi-square sensitivity result without replacing the prespecified exact procedure.

Python Chart 7: Boschloo Test — Adjusted Standardized Residuals

Boschloo Test adjusted standardized residual heatmap
Adjusted residuals show the direction and standardized size of each cell's departure from independence.
Pattern

The residual pattern is symmetric. Female positive and male negative cells have positive residuals, while female negative and male positive cells have negative residuals. Every cell carries the same absolute adjusted residual because the table has one degree of freedom.

Key Values

Female positive: 1.992745. Female negative: -1.992745. Male positive: -1.992745. Male negative: 1.992745.

Interpretation

The absolute residual of approximately 1.993 lies close to the common descriptive guideline of 2. The pattern identifies which cells create the association but should not be converted into an independent set of significance tests.

Why It Matters

Residuals are diagnostics for table structure. They do not replace Boschloo's Fisher-p ordering, the nuisance search or the unconditional p-value.

Next step: Use the residual signs to describe the pattern and the exact p-value to make the formal inferential decision.

Additional R Boschloo Test Charts with Paired Explanations

The R heatmap and adjusted-residual image use the same published files already displayed in Python Charts 1 and 7, so those two images are not duplicated. The five additional R figures below provide distinct validation of percentages, confidence intervals, relative effects, p-value sensitivity and nuisance maximization. Each pair has a dedicated explanation box aligned with its chart.

R Boschloo Test chart pair 1
R Boschloo Test group outcome percentages
R within-group positive and negative percentages for the two independent samples.
R Boschloo Test proportions with confidence intervals
R positive-outcome proportions with Wilson confidence intervals.
R Interpretation

R Group Outcome Percentages

The R percentage chart reproduces 86.95% positive for female students and 81.20% for male students. Negative-outcome rates are 13.05% and 18.80%. Standardizing each bar to 100% confirms that the observed difference is not an artifact of the larger female sample.

Reporting value: Report each proportion with its own denominator and retain the event definition G3 ≥ 10.
R Interpretation

R Proportions with Confidence Intervals

The female estimate is 0.8695, 95% CI [0.8320, 0.8996], and the male estimate is 0.8120, 95% CI [0.7608, 0.8544]. These intervals quantify each group separately and show the plausible range of each population probability.

Reporting value: Do not use visual overlap between two separate intervals as the formal test of the between-group difference.
R Boschloo Test chart pair 2
R Boschloo Test relative effect measures
R risk ratio and odds ratio displayed against the null value of 1.
R Boschloo Test p-value comparison
R comparison of Boschloo, Fisher, Barnard and chi-square procedures.
R Interpretation

R Relative Effects

The male/female risk ratio is 0.9340, while the male/female odds ratio is 0.6486. The risk-ratio interval narrowly reaches above 1, whereas the odds-ratio interval narrowly remains below 1. The difference arises from scale and interval construction rather than from different observed counts.

Reporting value: State which group is in the numerator and distinguish risk, odds and absolute percentage-point difference.
R Interpretation

R P-Value Comparison

Boschloo p = 0.0514 and Fisher p = 0.0598 remain above .05. Pearson p = 0.0463 falls below .05, while Yates p = 0.0598 remains above it. The R chart reinforces that method specification matters most when evidence lies near a conventional threshold.

Reporting value: The prespecified primary test controls the main conclusion; comparison tests provide sensitivity information.
R Boschloo Test final validation chart
R Boschloo Test nuisance parameter profile
R unconditional tail-probability profile across the nuisance parameter.
R Interpretation

R Nuisance-Parameter Profile

The R profile confirms that the directional unconditional probability is maximized at an interior nuisance value rather than at an arbitrary fixed probability. The relevant maximum is approximately .025694, and doubling that smaller directional value gives the reported two-sided result of approximately .051387. The profile also makes clear why a reliable implementation needs a sufficiently fine numerical search.

Reporting value: name the two-sided convention, the R package and the numerical controls used for nuisance maximization.

Boschloo Test Assumptions and Diagnostics

Data Conditions

  • Two independent groups
  • One binary outcome
  • One record per observational unit
  • Independent Bernoulli responses
  • Fixed or treated-as-fixed group sizes
  • Correct group and event coding

Analysis Specifications

  • Prespecified alternative hypothesis
  • Declared two-sided convention
  • One-sided Fisher-p ordering
  • Global nuisance maximization
  • Adequate numerical resolution
  • Named software and version
Independence of observations

Each student should contribute one outcome to one group. Exact probability calculations do not correct for repeated measurements, matched observations, family clustering, classroom clustering or school-level dependence. If observations are correlated, the double-binomial probability model may understate uncertainty and a paired or cluster-aware method is required.

Fixed group sizes and nonfixed outcome totals

The two binomial sample sizes are 383 and 266. Boschloo Test allows the positive counts in both groups to vary under repeated samples and does not condition on the observed combined positive total of 549. If both margins were deliberately fixed by design, Fisher's conditional exact test has a more direct sampling interpretation.

Correct table orientation

Some software functions treat columns as the two binomial experiments, while conventional printed tables often place groups in rows. A correct implementation must use sample totals 383 and 266. A transposed table that instead treats the positive and negative totals as the samples changes the null sample space and can produce a misleading p-value.

Binary outcome definition

The positive outcome is G3 ≥ 10. The label “positive” is a coding choice, not a judgment of value. Reversing the outcome definition changes directional statistics and effect measures. The event category must be stated before the table is analysed so that the direction of every estimate is reproducible.

Two-sided convention

Discrete exact procedures do not have one universal two-sided definition. This article uses twice the smaller one-sided Boschloo p-value, clipped at 1. R packages can also provide central or minimum-likelihood conventions. When software packages use different rules, their p-values should not be expected to match exactly.

Nuisance-parameter optimization

The unconditional rejection probability changes across the common null probability π and can contain more than one local feature. A coarse grid can miss the supremum and report a p-value that is too small. Reliable software uses refined grids, global optimization or validated quasi-Monte Carlo sampling and checks stability as resolution increases.

Expected counts and exactness

Boschloo Test does not require expected counts above 5. In this table, the minimum expected count exceeds 40, so Pearson's chi-square approximation is numerically plausible. The exact procedure remains valid without relying on the approximation, and the cross-method difference comes from the reference rule rather than from sparse expected cells.

Effect intervals and the exact p-value

The risk-difference, risk-ratio and odds-ratio intervals shown in this post are conventional effect intervals. They are not exact inversions of the primary Boschloo Test. Consequently, one interval can touch or cross its null value at a slightly different boundary from the exact p-value. The interval construction should be named in formal reporting.

Dichotomization of G3

G3 is originally measured on a 0–19 scale. Converting it to G3 ≥ 10 versus G3 < 10 discards distance information: a grade of 10 and a grade of 19 receive the same binary code. The threshold should have a substantive interpretation, and a complete study can supplement the binary comparison with an analysis of the original quantitative grade.

Confounding and adjustment

The 2 × 2 table is unadjusted. School, prior grades, study time, failures, absences and other characteristics can be related to both sex and the outcome. Boschloo Test describes a marginal association; it does not remove confounding. Use Binary Logistic Regression when conditional or adjusted comparisons are required.

Multiple thresholds and subgroup analyses

Trying many G3 cutpoints or many subgroup tables and reporting only the smallest p-value inflates the chance of a false-positive conclusion. The primary outcome threshold, group comparison and alternative should be selected before analysis, or a multiplicity adjustment should be incorporated into the study plan.

Representativeness and causal claims

An exact p-value is exact for the stated probability model, not for every population claim. Generalization depends on how students entered the dataset, and causal conclusions require a suitable design. The current result should be described as an unadjusted association between sex and the G3 threshold outcome.

Boschloo Test in Python, R, SPSS and Excel

Python Boschloo Test Workflow

Python provides a direct exact procedure through SciPy. The array must contain nonnegative integer counts, and the two binomial samples are placed in columns.

  • Construct the table as [[333, 216], [50, 50]].
  • Select alternative="two-sided" for the primary analysis.
  • Increase the numerical sampling setting to verify stability.
  • Read the returned statistic as the Fisher-p ordering value.
  • Calculate effect estimates and intervals separately.

Expected result: statistic = 0.0304927910; p = 0.0513872452.

Boschloo Test R Workflow

R packages for exact 2 × 2 inference can calculate Boschloo-related unconditional tests and offer several two-sided conventions. The package, alternative, mid-p setting and two-sided rule must be stated.

  • Enter x1 = 333, n1 = 383, x2 = 216, n2 = 266.
  • Run greater and less one-sided versions when reproducing the doubled-tail convention.
  • Keep midp = FALSE for the full exact procedure.
  • Distinguish central, minimum-likelihood and doubled one-sided results.
  • Save the printed call and package version with the report.

Boschloo Test in SPSS

SPSS CROSSTABS supplies the observed table, row and column percentages, expected counts, standardized residuals, Fisher's exact test, chi-square comparisons, risk estimates and association measures. Boschloo Test itself can be added through a validated embedded-Python calculation.

  • Create a numeric two-level group variable.
  • Create a binary G3 ≥ 10 outcome variable.
  • Verify that the displayed counts are 333, 50, 216 and 50.
  • Request risk estimates, Fisher, chi-square and residual output.
  • Run the exact unconditional calculation without relabelling ordinary Fisher output.

The downloadable SPSS output includes a pure Python standard-library Boschloo calculation and reports statistic = 0.0304927910, p = 0.0513872452.

Boschloo Test in Excel

Excel has no single built-in Boschloo function, but a transparent workbook can reproduce the test through table enumeration. The calculation needs hypergeometric Fisher ordering values and double-binomial probabilities over a nuisance grid.

  • Enter the four observed counts and calculate the two group totals.
  • Enumerate all 102,528 possible positive-count pairs.
  • Calculate a one-sided Fisher p-value for every possible table.
  • Flag tables at least as extreme as the observed Fisher-p statistic.
  • Maximize the summed joint binomial probability across π.

The workbook should document its nuisance-grid resolution and two-sided rule so that the result can be checked in Python or R.

Cross-Software Reporting Standard

ElementValue to preserveWhy it matters
Observed tableFemale [333, 50]; Male [216, 50]Defines the complete data input.
Positive eventG3 ≥ 10Determines direction and effect estimates.
AlternativeTwo-sidedControls which tables count as extreme.
Fisher-p statistic0.0304927910Orders possible 2 × 2 tables.
Greater one-sided p0.0256936226Smaller directional Boschloo result.
Two-sided conventionTwice the smaller one-sided p-valueExplains the final p-value definition.
Two-sided Boschloo p0.0513872452Primary inferential result.
DecisionFail to reject at α = .05Formal conclusion under the selected rule.

Expandable Boschloo Test Code

Python: SciPy Boschloo Test
import numpy as np
from scipy.stats import boschloo_exact

# Rows are outcomes; columns are the two independent samples.
table = np.array([
    [333, 216],  # G3 >= 10
    [50, 50],  # G3 < 10
], dtype=int)

two_sided = boschloo_exact(
    table,
    alternative="two-sided",
    n=4096,
)

greater = boschloo_exact(
    table,
    alternative="greater",
    n=4096,
)

less = boschloo_exact(
    table,
    alternative="less",
    n=4096,
)

print("Fisher-p ordering statistic:", two_sided.statistic)
print("Two-sided Boschloo p-value:", two_sided.pvalue)
print("Greater one-sided p-value:", greater.pvalue)
print("Less one-sided p-value:", less.pvalue)
Python: proportions, effect estimates and comparison tests
import math
import numpy as np
from scipy import stats

table_groups = np.array([
    [333, 50],  # Female
    [216, 50],  # Male
], dtype=int)

p_female = 333 / 383
p_male = 216 / 266

risk_difference = p_male - p_female
risk_ratio = p_male / p_female
odds_ratio = (216 / 50) / (333 / 50)

fisher = stats.fisher_exact(table_groups, alternative="two-sided")
pearson = stats.chi2_contingency(table_groups, correction=False)
yates = stats.chi2_contingency(table_groups, correction=True)

print("Female proportion:", p_female)
print("Male proportion:", p_male)
print("Risk difference M-F:", risk_difference)
print("Risk ratio M/F:", risk_ratio)
print("Odds ratio M/F:", odds_ratio)
print("Fisher p:", fisher.pvalue)
print("Pearson p:", pearson.pvalue)
print("Yates p:", yates.pvalue)
R: reproduce the doubled one-sided Boschloo convention
# install.packages("exact2x2")
library(exact2x2)

greater_result <- boschloo(
  x1 = 333, n1 = 383,
  x2 = 216, n2 = 266,
  alternative = "greater",
  midp = FALSE
)

less_result <- boschloo(
  x1 = 333, n1 = 383,
  x2 = 216, n2 = 266,
  alternative = "less",
  midp = FALSE
)

two_sided_p <- min(
  1,
  2 * min(greater_result$p.value, less_result$p.value)
)

print(greater_result)
print(less_result)
cat("Two-sided Boschloo p-value:", two_sided_p, "\n")

R packages may also provide central or minimum-likelihood two-sided methods. The selected method must be named whenever results are compared across software.

SPSS: prepare the 2 × 2 table and comparison output
* Create the binary outcome.
COMPUTE boschloo_outcome = (G3 >= 10).
VALUE LABELS boschloo_outcome
  0 "G3 below 10"
  1 "G3 at least 10".

* Create the independent two-level group.
RECODE sex ("F"=0) ("M"=1) INTO boschloo_group.
VALUE LABELS boschloo_group
  0 "Female"
  1 "Male".
EXECUTE.

CROSSTABS
  /TABLES=boschloo_group BY boschloo_outcome
  /FORMAT=AVALUE TABLES
  /STATISTICS=CHISQ RISK PHI
  /CELLS=COUNT ROW COLUMN EXPECTED RESID SRESID
  /COUNT ROUND CELL.

* Add the Boschloo exact calculation through validated
* embedded Python. Ordinary Fisher output is not Boschloo.
Excel: exact enumeration and nuisance-profile structure
Observed inputs
B4 = 333   Female positive
C4 = 50   Female negative
B5 = 216   Male positive
C5 = 50   Male negative

For every possible positive-count pair (x1, x2):

1. Calculate the one-sided Fisher p-value with HYPGEOM.DIST.
2. Flag a table when Fisher p <= observed Fisher statistic.
3. For each nuisance probability p, calculate:
   BINOM.DIST(x1,n1,p,FALSE) *
   BINOM.DIST(x2,n2,p,FALSE)
4. Sum joint probabilities for flagged tables.
5. Take the maximum across the nuisance grid.
6. Repeat for both directions.
7. Return:
   MIN(1, 2*MIN(less maximum, greater maximum))

Validation target
Observed Fisher-p statistic = 0.0304927910
Greater one-sided Boschloo p = 0.0256936226
Two-sided Boschloo p = 0.0513872452

Advanced Boschloo Test Topics

Why Boschloo Test can outperform Fisher's exact test

Fisher's exact test conditions on the observed outcome total and evaluates a hypergeometric sample space. Boschloo Test uses the one-sided Fisher p-value only as an ordering statistic, then calibrates the rejection region with the unconditional double-binomial model. This construction retains exact size control while often reducing the conservatism caused by fixed-margin conditioning.

Central versus minimum-likelihood two-sided methods

Discrete exact procedures require a definition of two-sided extremeness. A central method combines directional tails, while a minimum-likelihood method includes tables whose probability or ordering statistic is no greater than the observed table's value. R packages can offer both options. Results should be compared only after confirming that the same convention is used.

Doubled one-sided Boschloo Test

The primary result in this article is twice the smaller one-sided Boschloo p-value, clipped at 1. The greater-direction probability is .025694, so the reported two-sided result is .051387. This definition is simple and reproducible, but it is not the only possible two-sided convention in discrete exact inference.

Mid-p Boschloo Test

A mid-p calculation reduces the contribution of the observed table, commonly by subtracting half its probability from a conventional exact tail. Mid-p values can be less conservative and more powerful, but they do not provide the same finite-sample size guarantee as the full exact procedure. A mid-p result should be clearly labelled and not mixed with the exact p-value reported here.

Boschloo Berger-Boos Test R searches

The search phrase boschloo berger boos test r combines two related but distinct unconditional strategies. Boschloo Test orders possible tables through Fisher p-values. A Berger-Boos procedure restricts nuisance maximization to a confidence set and adds a small adjustment parameter. R's exact 2 × 2 frameworks can provide both ideas, but they should not be treated as interchangeable names.

Confidence intervals associated with unconditional tests

An exact p-value does not automatically provide a matching interval for the risk difference, risk ratio or odds ratio. Unconditional exact frameworks can invert tests to construct intervals, but the target parameter, ordering and nuisance treatment must be specified. The intervals displayed in this article are effect-estimation intervals and are not claimed to be exact Boschloo inversions.

Nuisance optimization and numerical stability

The nuisance profile may contain interior peaks or flat regions. Reporting a maximum from a coarse grid without checking nearby values can underestimate the true supremum. A defensible workflow increases the number of sampling points, checks the stability of the p-value and records the numerical controls used by the software.

Zero cells and infinite effect estimates

Boschloo Test can analyse a table containing a zero cell because the exact probabilities remain defined. Ordinary odds ratios or risk ratios can become zero or infinite, and log-based confidence intervals may fail. Use a stated exact interval or a disclosed continuity correction for effect estimation rather than silently adding an arbitrary constant.

Unequal group sizes

Equal sample sizes are not required. The current totals are 383 and 266. The double-binomial model uses each denominator separately, so unequal allocation changes precision and power but does not invalidate the exact test. Sample-size planning should account for the intended allocation ratio.

Power and sample-size planning

Power depends on both sample sizes, the baseline probability, the true group difference, alpha, the alternative direction and the exact ordering rule. Exact power is calculated by summing alternative-distribution probabilities over the rejection region. See Statistical Power before selecting a sample size for a new study.

Relation to the two-proportion z-test

The Two-Proportion Z-Test standardizes the observed proportion difference and uses a normal reference distribution. Boschloo Test uses the finite double-binomial sample space. With large samples and probabilities away from boundaries, both methods may give similar conclusions, but the exact and asymptotic p-values are not mathematically identical.

Relation to logistic regression

A one-predictor logistic regression estimates a group odds ratio and can be extended with covariates, interactions and cluster terms. Boschloo Test provides an unadjusted exact comparison without a regression equation. Use Logistic Regression when explanation, adjustment or prediction is the research goal.

Equivalence and evidence of no meaningful difference

A nonsignificant Boschloo Test does not demonstrate that the two probabilities are practically equivalent. Equivalence requires a prespecified margin and an analysis designed to show that the entire plausible difference lies within that margin. The current risk-difference interval permits both a moderate female advantage and a value close to zero.

Multiple testing and selective thresholds

If several outcome cutpoints, group definitions or exact methods are tried, the chance of obtaining at least one favourable result increases. A transparent analysis defines the primary outcome and exact procedure before inspecting results and labels any additional calculations as sensitivity or exploratory analyses.

APA Reporting for Boschloo Test

APA reporting should make the design and exact procedure reproducible. Include the two independent groups, event definition, four observed counts, both proportions, alternative, Fisher-p ordering statistic, unconditional p-value, effect estimate, confidence interval method and a noncausal interpretation. Because the result is close to .05, retain three decimal places for the p-value rather than rounding it to .05.

Full APA-Style Result for the Worked Example

Female students reached G3 ≥ 10 in 333 of 383 cases (86.95%), compared with 216 of 266 male students (81.20%). A two-sided Boschloo unconditional exact test did not provide sufficient evidence that the two positive-outcome probabilities differed, Fisher-p ordering statistic = 0.0305, p = .051. The male-minus-female risk difference was -0.057, 95% CI [-0.115, 0.000], and Cramer's V was 0.078. The result represents a small unadjusted association and does not establish a causal effect.

Concise APA-Style Result

The G3 ≥ 10 proportions were 86.95% for female students and 81.20% for male students; Boschloo Test gave p = .051, risk difference = -0.057, Cramer's V = 0.078.

APA-Style Methods Sentence

A two-sided Boschloo unconditional exact test compared two independent binomial proportions. A one-sided Fisher exact p-value was used as the ordering statistic, and the final p-value was defined as twice the smaller one-sided unconditional p-value.

APA-Style Results Table

MeasureComplete valueAPA presentation
Female positive outcome333/383 = 0.869451697333/383 (86.95%)
Male positive outcome216/266 = 0.812030075216/266 (81.20%)
Fisher-p ordering statistic0.0304927910.0305
Two-sided Boschloo p-value0.0513872452.051
Risk difference, M − F-0.057421622−.057
Risk ratio, M/F0.933956513.934
Odds ratio, M/F0.648648649.649
Cramer's V0.078222103.078

Reusable APA Templates for Boschloo Test

How to use these templates: replace each highlighted field with values from the relevant 2 × 2 table. Keep statistical symbols italicized, name the two-sided convention and include an effect estimate rather than ending with a significance label.
Nonsignificant

Nonsignificant Two-Sided Boschloo Test

Sample

Group 1 had x₁/n₁ positive outcomes (p₁%), and Group 2 had x₂/n₂ (p₂%).

Test result

A two-sided Boschloo Test was not statistically significant, Fisher-p statistic = statistic, p = p-value.

Effect

The risk difference was estimate, 95% CI [lower, upper]. The analysis did not provide sufficient evidence of a difference; it did not prove equal probabilities.

Use when the prespecified two-sided p-value is at or above the selected alpha level.

Significant

Significant Two-Sided Boschloo Test

Sample

The positive-outcome proportion was p₁% in Group 1 and p₂% in Group 2.

Test result

A two-sided Boschloo Test indicated that the probabilities differed, Fisher-p statistic = statistic, p = p-value.

Effect

The absolute proportion difference was estimate percentage points, 95% CI [lower, upper], indicating a contextual effect description.

Describe the observed magnitude and uncertainty; do not use the p-value as an effect-size label.

One-Sided

Prespecified Directional Boschloo Test

Hypothesis

A one-sided Boschloo Test evaluated the prespecified hypothesis that Group 1 had a higher/lower positive-outcome probability than Group 2.

Test result

The directional result was statistically significant / not statistically significant, Fisher-p statistic = statistic, p = p-value.

Estimate

The observed proportions were p₁% and p₂%, with a directional risk difference of estimate.

Use one-sided wording only when the direction was selected before the table was examined.

APA Rounding and Interpretation Language

AvoidUse insteadReason
The groups were equal.The test did not detect sufficient evidence of a difference.Nonsignificance is not evidence of exact equality.
p = .05p = .051A borderline exact p-value needs adequate precision.
Boschloo statistic = .051Fisher-p statistic = .0305; Boschloo p = .051The ordering statistic and unconditional p-value are different quantities.
The effect was unimportant because p > .05.The observed difference was 5.74 percentage points and Cramer's V was .078.Magnitude and statistical evidence answer different questions.
Boschloo proved there was no sex effect.The unadjusted exact test did not cross the .05 threshold.The study is observational and the table is unadjusted.
Best final APA report: report 333/383 versus 216/266, Fisher-p statistic = .0305, Boschloo p = .051, risk difference = −.057, 95% CI [−.115, .000], and Cramer's V = .078.

Common Boschloo Test Mistakes and How to Correct Them

Common mistakeWhy it is a problemCorrect approach
Using Boschloo Test for a 2 × 4 tableThe standard procedure is defined for 2 × 2 tables.Use a larger-table exact method, multinomial model or scientifically justified recoding.
Calling the Fisher-p statistic the Boschloo p-valueThe statistic only orders tables; the final p-value is an unconditional maximum.Report the statistic and p-value separately.
Ignoring the two-sided conventionCentral, minimum-likelihood and doubled one-sided rules can differ.Name the convention in the methods and results.
Passing the table in the wrong orientationThe software may treat the outcome totals as sample sizes.Verify that the binomial sample totals are 383 and 266.
Choosing a one-sided alternative after viewing the proportionsThis increases false-positive risk.Prespecify the direction before analysing the table.
Relabelling Fisher's exact output as Boschloo TestConditional and unconditional calculations are not the same.Identify every exact procedure accurately.
Reporting only a p-valueThe observed magnitude and uncertainty remain unknown.Report both proportions, risk difference and confidence intervals.
Confusing odds ratio with risk ratioThe outcome is common, so odds and probability differ substantially.Lead with the absolute risk difference and define every ratio direction.
Interpreting nonsignificance as equalityFailure to reject does not establish identical probabilities.Interpret the confidence interval and consider equivalence methods when needed.
Claiming causation from the 2 × 2 tableThe comparison is observational and unadjusted.Use association language and discuss possible confounding.
Switching to a comparison method that crosses .05This is post-hoc method selection.Retain the prespecified primary procedure.
Ignoring the original G3 scaleDichotomization discards grade information.Justify the threshold and consider analysis of the quantitative outcome.
Best practice: define the design, report the Fisher-p ordering statistic and unconditional p-value separately, state the two-sided rule and interpret the effect estimates beside the exact result.

Boschloo Test Reports and Worked Excel Download

Download use: the reports provide software-specific output, while the workbook exposes the enumeration and nuisance-profile logic behind the exact calculator result.

Frequently Asked Questions About Boschloo Test

The Boschloo Test questions below address the statistic, assumptions, two-sided convention, R workflow, Berger-Boos searches, calculator logic, effect sizes and APA reporting without repeating the complete worked sections above.

What is Boschloo Test?

Boschloo Test is an exact unconditional procedure for comparing two independent binary-outcome probabilities in a 2 × 2 table.

What is Boschloo's Test statistic?

The statistic is a one-sided Fisher exact p-value used to order all possible tables in the fixed-sample-size space.

What is the null hypothesis?

The null states that the two groups have the same positive-outcome probability.

What is the Boschloo p-value in this example?

The two-sided unconditional p-value is 0.0513872452, normally reported as .051.

Was the two-sided result statistically significant?

No. The prespecified two-sided result did not cross alpha .05.

What was the one-sided greater p-value?

The greater-direction Boschloo p-value was 0.0256936226.

Why is the one-sided result significant but the two-sided result is not?

The two-sided convention doubles the smaller directional p-value. Doubling approximately .025694 gives approximately .051387.

When should Boschloo Test be used?

Use it for two independent binomial samples arranged in a 2 × 2 table when an exact unconditional comparison is desired.

Can Boschloo Test analyse a 2 × 4 table?

No. The standard procedure is defined for 2 × 2 tables. A larger table requires another method or a justified recoding.

Does Boschloo Test require expected counts above 5?

No. It uses exact probabilities. Expected counts are relevant to the chi-square comparison rather than to the validity of Boschloo Test.

Can it be used with unequal group sizes?

Yes. The current group totals are 383 and 266, and each denominator is retained in the double-binomial model.

Can Boschloo Test be used for paired data?

No. Paired or matched binary observations require a paired procedure because the independence assumption is violated.

Why is Boschloo Test often more powerful than Fisher's exact test?

It uses Fisher-p ordering but calibrates the rejection region unconditionally rather than conditioning on the observed outcome total.

Is Boschloo Test the same as Barnard's exact test?

No. Both are unconditional, but Boschloo uses Fisher-p ordering while Barnard commonly uses a score or Wald statistic.

Why did Pearson chi-square reject in this example?

Pearson uses an asymptotic reference and produced p = .0463. Boschloo Test uses a discrete unconditional reference and produced p = .0514.

What is the risk difference?

The male-minus-female risk difference is -0.057422, equivalent to approximately −5.74 percentage points.

What is the risk ratio?

The male/female risk ratio is 0.933957.

What is the odds ratio?

The male/female odds ratio is 0.648649.

What is Cramer's V?

Cramer's V is 0.078222, indicating a small unadjusted association.

What is the nuisance parameter?

It is the unknown common positive-outcome probability under the equality null.

Why must the nuisance parameter be maximized?

The unconditional rejection probability depends on the unknown common probability, so the test uses the largest null tail across the allowed range.

What two-sided convention is used in this post?

The result is twice the smaller one-sided Boschloo p-value, clipped at 1.

Can R return another two-sided Boschloo result?

Yes. R packages can offer central and minimum-likelihood conventions, so the software method must be stated.

What is a mid-p Boschloo Test?

It reduces the contribution of the observed table to decrease conservatism, but it is not the same as the full exact procedure.

What does Boschloo Berger-Boos test R mean?

It combines two related but distinct unconditional approaches. Berger-Boos is an adjustment framework, not another name for Boschloo Test.

How do I run Boschloo Test in Python?

Use scipy.stats.boschloo_exact with a nonnegative integer 2 × 2 table, alternative and numerical sampling setting.

How do I run Boschloo Test in R?

Use exact2x2::boschloo or another validated unconditional exact implementation and report its two-sided method.

How do I run Boschloo Test in SPSS?

Use CROSSTABS for the table and comparison measures, then add the exact procedure through validated embedded Python.

Can Excel calculate Boschloo Test?

Yes, but it requires explicit enumeration of possible tables, hypergeometric Fisher ordering and binomial nuisance-profile formulas.

Can Boschloo Test establish causation?

No. It tests an unadjusted association and does not remove confounding, selection bias or dependence.

How should a nonsignificant result be interpreted?

State that there was insufficient evidence of a difference. Do not claim that the two population probabilities are equal.

How should the result be reported in APA style?

Report both group counts and proportions, Fisher-p statistic, Boschloo p-value, risk difference, interval method and noncausal interpretation.

What is the main conclusion from this example?

The female positive-outcome proportion was higher, but the primary two-sided Boschloo result was borderline and nonsignificant at .05.

Boschloo Test Conclusion

Boschloo Test is an exact unconditional comparison of two independent binary-outcome probabilities. It uses a one-sided Fisher exact p-value to order possible 2 × 2 tables and maximizes the unconditional rejection probability over the unknown common null probability.

In the worked example, 333 of 383 female students and 216 of 266 male students had G3 ≥ 10. The observed proportions were 0.869452 and 0.812030. The Fisher-p ordering statistic was 0.030493, and the two-sided Boschloo p-value was 0.051387.

At α = .05, the equality null was not rejected. The male-minus-female risk difference was -0.057422, and Cramer's V was 0.078222. The evidence is borderline and the observed association is small, so the result should be reported with its effect estimates and uncertainty rather than reduced to a binary label.

Final reporting line: a two-sided Boschloo Test did not provide sufficient evidence that the G3 ≥ 10 probabilities differed between female and male students, Fisher-p statistic = .0305, p = .051, risk difference = −.057, Cramer's V = .078.

Back to top

Need help applying this to your own data?

Salar Cafe can help interpret output, clean datasets, review assumptions, build dashboards and explain statistical results ethically.

Need help interpreting your data analysis results?

Contact Salar Cafe
Engr. Muhammad Yar Saqib author profile photo

Engr. Muhammad Yar Saqib

Engr. Muhammad Yar Saqib is an electrical engineer educated at the University of Bradford, United Kingdom, a writer and poet, and an Assistant Education Officer in the School Education Department, Punjab, serving since July 2017. He writes practical guides on statistics, SPSS, data analysis, mathematics and educational technology, with an emphasis on transparent methods, reproducible calculations and ethical learning support.