Categorical TrendThe underlying model family class (e.g. GLM, linear model, categorical matrix, log-linear).Parametric ReferenceStatistical methods that assume a specific probability distribution family (typically normal).12-stage workflow
Cochran-Armitage Test of Trend
Test for linear trend in proportions across ordered exposure categories; equivalent to Mantel-Haenszel trend test..
Model familyCategorical Trend
Hypothesistwo-tailed
Aliases*None*
G1
association
G2
description
1
What is it?
Cochran-Armitage Test for Trend tests whether success proportions increase or decrease linearly across an ordered categorical factor.
2
When to use it
Ordered Indep. Groups: e.g. Dose Low, Med, High levels.
Binary Outcome: Success vs. Failure (categorical rates).
3
Core Idea
We fit a linear score (e.g., 1, 2, 3) to the categories and determine whether there is a significant directional slope in proportions:
X2_trend = T2 / Var(T)
This partitions the standard Pearson chi-square into a linear trend component and a remaining non-linear departure component.
4
Hypotheses
H0:Proportions of success are equal across all ordered levels (slope = 0).
Ha:A linear trend exists in success proportions across the levels.
5
How it works
Assign linear scores (x_i) to categories.
Calculate the mean score and sum of squares of x.
Calculate the numerator T (linear covariance).
Divide T^2 by its variance under H0 to obtain X2_trend. df = 1.
6
Assumptions
📊 Linear Trend: Assumes any relationship between proportions and level is linear.
👤 Independent Counts: Observations are collected independently.
7
Advantage
By focusing on 1 degree of freedom (trend), it has significantly higher statistical power than the general independence test when a trend exists.
8
Quick Example
Ordered Group
Success Rate
Counts (S/F)
Level 1
20%
10 / 40
Level 2
44%
22 / 28
Level 3
58%
35 / 15
Interactive Sandbox
Cochran-Armitage Live Laboratory
Adjust successes and failures across ordered categories to watch the success proportion slope change in real-time.
L1 Success (N=50)10
L1 Failure40
L2 Success (N=50)22
L2 Failure28
L3 Success (N=50)35
L3 Failure15
Group Level (1, 2, 3) vs. Success proportion (%)Blue line shows trend fit
Calculations Output
Metric
Value
Total Sample Size (N)
150
Trend Chi-Square (X2_trend)
25.2877
Degrees of Freedom (df)
1
p-value (Trend)
0.0000
Trend Verdict
Significant Trend Success rates display a statistically significant linear trend across groups (p = 0.0000).
01Hypothesis test logic
Hypotheses
Pragmatic null and alternative hypotheses defined in mathematical notation.
A hypothesis is a question sharpened to a point. Ambiguity is the enemy of inference.
Logic Core
Null · H₀
H₀: No effect / no difference / no association
Alternative · Hₐ
Hₐ: Effect / difference / association exists
Why it matters two-tailed
Specific hypotheses depend on research question and test design.
02Model diagnostics
Assumptions
The core mathematical criteria needed to ensure that statistical testing remains unbiased and valid.
Build your analysis on rock, not sand. Verify the mathematical foundation before building the model.
Integrity Shield
6
Assumptions
0
Critical / High Severity
How to check
Verify that categories represent ordinal scale with logical progression. Ensure ordering reflects increasing/decreasing exposure intensity or severity.
If violated
Reorder categories to reflect true progression. If categories lack natural ordering, use standard chi-square test of independence instead of trend test.
How to check
Plot observed proportions vs. category scores. Visually assess whether points approximate a straight line. Test for non-linearity using polynomial contrasts.
If violated
If trend is clearly non-linear, use logistic regression with polynomial terms, stratified analysis, or standard chi-square test without trend assumption.
How to check
Review study design for potential dependencies: paired data, family members, repeated assessments, hierarchical sampling (e.g., patients within hospitals).
If violated
Use GEE (generalized estimating equations) or mixed-effects logistic regression for clustered data. Ensure proper randomization for independent sampling.
How to check
Confirm outcome has exactly two levels. If multiple levels exist, decide whether to collapse into binary or use different test.
If violated
For multinomial outcomes, use ordinal logistic regression or proportional odds models. For count data, use Poisson regression.
How to check
Calculate expected frequencies: E_ij = (row_i_total × col_j_total) / grand_total for each cell. Count cells with E < 5.
If violated
Combine adjacent sparse categories, increase sample size, or use exact tests (e.g., exact Cochran-Armitage via permutation).
How to check
Consider whether equal spacing is reasonable. For dose-response, use actual dose values. For ordinal scales, ensure scores reflect meaningful intervals.
If violated
Assign scores based on actual exposure values (e.g., mg of drug) or midpoints of categories. Sensitivity analysis with different scoring schemes recommended.
03Residual Forensics
Diagnostics
Checking residual plots and indices to examine model deviations and ensure standard error integrity.
Trust, but verify. The outliers often hold more truth than the averages.
System Health
Essential checks
Plot success proportion vs. ordered category
Assess linearity of trend
Check expected frequencies in each cell (≥5 rule)
Examine residuals for non-linear patterns
Recommended checks
Sensitivity analysis with different score assignments
Compare trend test vs. general chi-square test
Test for departure from linearity using contrast tests
Assess influence of outlier categories
04Live Instances
Applied Minds
Review concrete study examples, data layout guidelines, and copy executable syntax scripts.
Theory is the map. Practice is the terrain. Simulation bridges the gap.
Applied Wisdom
Example 01
Smoking Exposure and Lung Cancer Risk
Epidemiological case-control study examining whether lung cancer risk increases linearly with smoking dose categories. Testing for monotonic dose-response relationship across ordered exposure levels.
05Tactical Pivots
Alternatives
Structured fallback pathways for choosing alternative tests when normality or slopes requirements fail.
When the path is blocked, pivot. Rigor is not rigidity; it is the intelligent adaptation to reality.
Adaptive Strategy
Measurement Precision Ladder Ideal · Ordered Nominal x Binary
Ratio
Consider Logistic Regression if the dose/time is continuous. Trend tests bin the predictor, potentially hiding the 'True' slope.
Data Flattening
Ordinal Predictor
Maintain Cochran-Armitage logic. Exploit the rank-order to maximize power for monotonic shifts.
Peak Signal
Nominal
Abandon Trend Strike. Use Chi-Square Independence if categories lack a natural, ordered direction.
Logic Failure
Temporal Trajectory Audit Static Ordered Snapshot
Static Dose-Response
Single point trend.
Stay with Cochran-Armitage. The elite standard for discovering 'Progressive' effects.
Repeated Trends
Time as dose.
Pivot to Cochran's Q or GEE to account for within-subject temporal clustering.
Significance is noise. Magnitude is the signal. Measure the impact, not just the probability.
Impact Magnitude
calculation
Exponentiate logistic regression coefficient OR = exp(β)
interpretation
Multiplicative change in odds for each unit increase in score
example
OR = 1.25 per 10 pack-years means 25% increase in odds per 10 pack-years
note
Most interpretable and widely reported effect size for trend tests
calculation
Logistic regression coefficient for score variable
interpretation
Change in log-odds per unit increase in score
scale
Log-odds scale; exponentiate for OR interpretation
calculation
Difference in proportions between highest and lowest exposure
interpretation
Percentage point increase in outcome across exposure range
clinical utility
Used to calculate number needed to treat (NNT = 1/ARD)
Recommended Metric: Odds ratio per unit score increase
Small 0.2
Medium 0.5
Large 0.8
0.50
Odds ratio per unit score increase
Recommended Measure
4
Available Metrics
ReportUse Odds ratio per unit score increase to represent clinical impact magnitude.
08Statistical Power
Sample Size
Guidelines for minimum sample requirements and power analysis parameters.
An underpowered study is an ethical failure. Respect the data by collecting enough of it.
Power Protocol
Floor Requirements
The 'Trend Precision' Minimum: A minimum of 30 participants per ordinal category is recommended. Trend tests require enough density in each level to stabilize the slope of the proportions.
Effect Size
Parameters
Required n
Small Effect
w=0.10 (Small)
n ≈ 600 total
Medium Effect
w=0.30 (Medium)
n ≈ 75 total
Large Effect
w=0.50 (Large)
n ≈ 30 total
Key considerations
Monotonic Mandate: Power is maximized when the proportions move in a single direction (increase or decrease). If the trend is 'U-shaped', the Cochran-Armitage strike will miss the signal entirely.
G*Power StrategyBenchmark: χ² tests → Cochran-Armitage Trend. Parameters: Number of groups (k), Linear slope magnitude, α = .05, Power = .80. The 'Directional Advantage': Trend tests are 30% more powerful than standard Chi-Square for ordered categories.
09APA narrative blueprint
Reporting
How to compile statistical results into publication prose matching APA and journal style guides.
Data does not speak for itself. It requires a translator. Be clear, be precise, be honest.
Narrative Arc
Worked APA paragraph example
A Cochran-Armitage trend test was conducted to examine the dose-response relationship between smoking exposure and lung cancer risk across four ordered categories (never, light, moderate, heavy smokers; n = 500). Exposure scores were assigned based on midpoint pack-years (0, 10, 30, 50). All expected cell frequencies exceeded 5, satisfying the test assumption. The analysis revealed a highly significant linear trend (Z = 6.73, p < .001), with lung cancer prevalence increasing systematically from 10.0% in never-smokers to 71.3% in heavy smokers. The odds ratio was 2.85 per 10 pack-years (95% CI: 2.23-3.65), indicating that each 10 pack-year increase in smoking exposure was associated with nearly a threefold increase in lung cancer odds. Visual inspection confirmed linearity of the dose-response relationship (r = .99), and no significant departure from linearity was detected (χ²departure = 0.01, df = 2, p = .995). These findings provide strong evidence for a causal relationship between smoking intensity and lung cancer risk, consistent with established biological mechanisms.
Reusable template
A Cochran-Armitage trend test revealed a significant linear trend in outcome proportions across exposure categories (Z = X.XX, p = .XXX). The odds ratio was X.XX (95% CI: X.XX-X.XX) per unit increase in exposure score, indicating a dose-response relationship. Visual inspection confirmed approximate linearity, with no significant departure from linearity (χ²departure = X.XX, p = .XXX).
10Exhibit Builder
Manuscript Lab
Copy standard summary tables and forensic reporting grids to outline analysis details.
Table 1: Cochran-Armitage Trend Test for Dose-Response Efficacy
70% at HighPowerful Linear Dose-Response. The probability of recovery increases by approximately 30% for each dosage increment.
Header glossary
The Directional Force. Tests if the proportion of success consistently increases (or decreases) as the dose increases.
Linear Probability. The chance that the observed linear pattern is random noise.
11Algorithmic Logic
Command Center
Syntax libraries and function parameters for executing calculations in stats packages.
Code is the modern laboratory. Clean execution ensures reproducible discovery.
Execution Engine
# 1. Execute Cochran-Armitage Trend Test
DescTools::CochranArmitageTest(table(df$dose, df$recovered))
Library stack
R
DescTools
Python
statsmodels.stats.contingency_tables
Elite Forensic Strike
Don't just use Chi-Square for ordered categories. You lose 'Directional Power'. The Trend test is 20-30% more powerful for detecting dose-response effects.
# Compare Chi-Square vs Trend Test p-values.
12The Over-adjustment Trap
Common Mistakes
Analytical caveats and corrections to maintain modeling integrity.
Wisdom is learning from the failures of others. Anticipate the error before it occurs.
Defensive Logic
Why it's wrong
Default scores (0,1,2,3...) assume equal intervals between categories, which may not reflect true exposure levels. For example, dose categories of 10mg, 25mg, 100mg have unequal spacing. Using (0,1,2) instead of actual values (10,25,100) underestimates dose-response slope and reduces power by 30-50%.
The correction
Use actual exposure values (e.g., dose mg, pack-years, years of education) or category midpoints as scores. Example: for categories '<10', '10-20', '20-40', '>40' pack-years, use midpoints (5, 15, 30, 50). Conduct sensitivity analysis comparing different scoring schemes and report robustness.
Why it's wrong
The test statistic increases with sample size even for trivial trends. Statistical significance does not indicate practical importance. With n=10,000, a clinically irrelevant OR=1.02 per dose level can yield p < .001, misleading interpretation.
The correction
Always report odds ratios or absolute risk differences as effect sizes. Report: 'Significant trend (Z=4.2, p<.001) with OR=1.35 per 10mg dose (95% CI: 1.20-1.52), indicating 35% increase in odds per dose increment.' Interpret clinical/practical significance separately from statistical significance.
Why it's wrong
Small expected frequencies (< 5) in any cell inflate Type I error rates to 8-12% (vs. nominal 5%), similar to standard chi-square tests. Software rarely warns about this violation, silently producing invalid p-values.
The correction
Calculate expected frequencies for all cells: E_ij = (n_i+ × n_+j) / n. If any < 5, combine adjacent categories (e.g., merge 'low' and 'moderate'), increase sample size, or use exact permutation tests (coin::chisq_test() in R with distribution='exact').
Why it's wrong
The test assumes linear trend on log-odds scale; U-shaped, threshold, or plateau effects violate this assumption and severely reduce power (loss of 40-70%). Test may miss important non-linear relationships like hormesis or threshold effects common in toxicology.
The correction
ALWAYS plot proportions vs. scores before testing. If non-linearity suspected (visual inspection shows curve), compare χ²_trend (1 df) vs. χ²_general (k-1 df) and test for departure from linearity: χ²_departure = χ²_general - χ²_trend (k-2 df). If p_departure < .05, use logistic regression with polynomial terms or splines.
Why it's wrong
Cochran-Armitage requires ordinal exposure variable with meaningful progression. Using it with nominal categories (e.g., different drug classes A, B, C with no dose relationship) is statistically invalid and produces uninterpretable results.
The correction
Verify categories have meaningful progression (low→medium→high, never→former→current, stage I→II→III). For nominal variables with no inherent ordering, use standard chi-square test of independence (k-1 df) instead.
Why it's wrong
Stating only 'significant trend exists' (p=.003) without indicating whether outcome increases or decreases with exposure, or by how much, provides no actionable information. Reader cannot assess clinical relevance or compare to other studies.
The correction
Report direction (increasing/decreasing), magnitude (OR per meaningful unit), and clinical interpretation. Example: 'Lung cancer risk increased significantly with smoking (Z=6.2, p<.001). OR=2.8 per 10 pack-years (95% CI: 2.2-3.6), meaning nearly 3-fold higher odds for each 10 pack-year increase.' Include plot showing trend pattern with confidence bands.
Why it's wrong
Observed trends may reflect confounding (e.g., age, SES, comorbidities) rather than causal relationships. Trend tests do not adjust for covariates. Example: observed alcohol-disease association may be confounded by smoking if heavy drinkers smoke more.
The correction
Use multivariable logistic regression to adjust for confounders when assessing dose-response: glm(outcome ~ dose_score + age + sex + confounders). Cochran-Armitage is appropriate for unadjusted bivariate screening, but adjusted analysis required for causal inference. Report both unadjusted and adjusted ORs.
Why it's wrong
Specifying alternative='increasing' or 'decreasing' when direction is uncertain inflates Type I error by testing only one tail. If true effect is opposite direction, test has zero power. Pre-registration of direction is rare, making post-hoc one-sided tests questionable.
The correction
Use two-sided tests (alternative='two.sided') unless direction is pre-specified based on strong theory before seeing data. If using one-sided test, explicitly state a priori hypothesis and biological rationale. Report: 'We hypothesized increasing trend based on prior meta-analysis (Smith 2020), thus used one-sided test (α=.05)'.
13Academic Lineage
References
Scholarly lineage and citation keys grounding the statistical framework.
We stand on the shoulders of giants. Honor the source of the method.
Academic Lineage
[1]
[2]
[3]
[4]
[5]
14Model Ecosystem
Related Tests
Bridges to simpler, more complex, non-parametric, or alternative versions.
No model exists in isolation. Understanding the family tree reveals the true nature of the test.