# 分段回归

分段回归是一种统计方法，用于拟合预测变量与结局之间的分段线性关系，并将断点位置和各段斜率作为模型的一部分进行估计。它回答关系在何处以及如何改变斜率的问题：拟合结果不是一条直线，而是一组相接的直线，同时给出每个断点处斜率差的估计、其标准误，以及是否存在任何变化的检验。<sup>[1](https://journal.r-project.org/articles/RN-2008-004/RN-2008-004.pdf)</sup> 由于断点是真正的模型参数，该方法不同于对预先指定的子组分别拟合回归；它也是卫生与政策评估中中断时间序列分析主流方法的基础。<sup>[2](https://pmc.ncbi.nlm.nih.gov/articles/PMC10925407/)</sup>

| 关键事实 | 详情 |
|---|---|
| 模型形式 | \( \beta_{1} z_{i} + \beta_{2}(z_{i} - \psi)_{+} \)，其中左段斜率为 \( \beta_{1} \)，斜率差为 \( \beta_{2} \)，断点为 \( \psi \)<sup>[1](https://journal.r-project.org/articles/RN-2008-004/RN-2008-004.pdf)</sup> |
| 估计 | 迭代线性化，只需为断点提供起始值；自助重启可防止陷入局部极小值<sup>[3](https://spout.ussg.indiana.edu/CRAN/web/packages/segmented/segmented.pdf)</sup> |
| 检验 | 原假设下断点不存在，因此Wald检验会将p值低估约三到五倍；改用Davies型检验<sup>[1](https://journal.r-project.org/articles/RN-2008-004/RN-2008-004.pdf)</sup> |
| 断点不确定性 | Delta法标准误，或平滑得分/梯度剖面置信区间<sup>[4](https://link.springer.com/article/10.1007/s10651-024-00605-x)</sup><sup> • </sup><sup>[3](https://spout.ussg.indiana.edu/CRAN/web/packages/segmented/segmented.pdf)</sup> |
| 断点数量 | 由BIC类准则或序贯检验（selgmented）选择；模拟中gBIC优于AIC和BIC<sup>[5](https://search.r-project.org/CRAN/refmans/segmented/html/selgmented.html)</sup><sup> • </sup><sup>[4](https://link.springer.com/article/10.1007/s10651-024-00605-x)</sup> |
| 主要软件 | R包segmented（v2.2-1）和Python包piecewise-regression<sup>[3](https://spout.ussg.indiana.edu/CRAN/web/packages/segmented/segmented.pdf)</sup><sup> • </sup><sup>[6](https://piecewise-regression.readthedocs.io/en/master/index.html)</sup> |
| 主要应用 | 中断时间序列分析，这是评估时间序列数据中干预措施的最广泛使用方法<sup>[2](https://pmc.ncbi.nlm.nih.gov/articles/PMC10925407/)</sup> |

## 工作原理

对于单个断点，模型将分段项写为 \( \beta_{1} z_{i} + \beta_{2}(z_{i} - \psi)_{+} \)，其中 \( (z_{i} - \psi)_{+} = (z_{i} - \psi) \times I(z_{i} > \psi) \)，而 \( I(\cdot) \) 为指示函数。这里 \( \beta_{1} \) 是左段斜率，\( \beta_{2} \) 是斜率差，\( \psi \) 是断点；两条拟合直线在 \( \psi \) 处相接。<sup>[1](https://journal.r-project.org/articles/RN-2008-004/RN-2008-004.pdf)</sup> 该表述适用于任何具有线性预测器的回归模型，因此可复用已有的线性模型和GLM软件，并允许将阈值建模为解释变量的函数。<sup>[7](https://onlinelibrary.wiley.com/doi/10.1002/sim.1545)</sup>

估计利用线性化：算法迭代地拟合一个加入“间隙”参数 \( \gamma \) 的线性模型，并通过 \( \hat{\psi} = \tilde{\psi} + \hat{\gamma}/\hat{\beta}_{2} \) 更新断点。断点标准误通过对比值 \( \hat{\gamma}/\hat{\beta}_{2} \) 应用Delta法得到；当 \( \hat{\gamma} = 0 \) 时简化为 \( SE(\hat{\gamma})/|\hat{\beta}_{2}| \)。<sup>[1](https://journal.r-project.org/articles/RN-2008-004/RN-2008-004.pdf)</sup><sup> • </sup><sup>[4](https://link.springer.com/article/10.1007/s10651-024-00605-x)</sup>

检验断点是否存在是非标准的，因为原假设下断点参数消失，所以标准似然理论不适用。<sup>[8](https://onlinelibrary.wiley.com/doi/10.1002/bimj.200390035)</sup> 经典Wald检验的p值被严重低估，经验水平约为名义水平的三到五倍，因此改用Davies型检验。<sup>[1](https://journal.r-project.org/articles/RN-2008-004/RN-2008-004.pdf)</sup>

## 如何实施

segmented算法是迭代过程，而非网格搜索，并且只需为断点参数提供起始值；自0.2-9.0版起，该包实现自助重启，使算法对这些起始值不那么敏感。<sup>[3](https://spout.ussg.indiana.edu/CRAN/web/packages/segmented/segmented.pdf)</sup> 断点数量由selgmented选择：可通过BIC或AIC，且对 \( K_{max} \) 几乎没有上界；也可通过限于 \( K_{max} = 2 \) 的序贯得分检验或Davies检验。当断点间距不均匀时，将数据分成 \( G = 3 \) 或4个子区间可改进搜索。<sup>[5](https://search.r-project.org/CRAN/refmans/segmented/html/selgmented.html)</sup> 断点位置的置信区间来自Delta法，或在诱导平滑下对平滑得分或梯度统计量做剖面。<sup>[3](https://spout.ussg.indiana.edu/CRAN/web/packages/segmented/segmented.pdf)</sup> Python包piecewise-regression实现同样的迭代算法，包含自助重启、Davies检验和基于BIC的模型选择。<sup>[6](https://piecewise-regression.readthedocs.io/en/master/index.html)</sup>

## 起源

这一谱系始于理查德·E·匡特（Richard E. Quandt）1958年发表于《美国统计协会杂志》的论文，该文研究服从两种不同区制的线性回归系统的估计，提出在每个候选转换点条件下最大化似然，并用似然比检验无转换的原假设。<sup>[9](https://doi.org/10.1080/01621459.1958.10501484)</sup><sup> • </sup><sup>[10](https://www.nber.org/system/files/chapters/c9938/c9938.pdf)</sup> 德里克·J·哈德森（Derek J. Hudson）1966年发表于JASA的论文处理连接点需要估计的分段曲线拟合。<sup>[11](https://doi.org/10.1080/01621459.1966.10482198)</sup> 戴维·V·欣克利（David V. Hinkley）1971年发表于JASA的论文发展了两相回归中的推断，<sup>[12](https://doi.org/10.1080/01621459.1971.10482337)</sup> 保罗·I·费德（Paul I. Feder）1975年发表于《统计学年鉴》的论文给出了预测变量定义域不同区域具有不同解析形式的模型中最小二乘估计量的渐近分布理论。<sup>[13](https://doi.org/10.1214/aos/1176342999)</sup><sup> • </sup><sup>[13](https://doi.org/10.1214/aos/1176342999)</sup> 道格拉斯·M·霍金斯（Douglas M. Hawkins）1976年发表于《应用统计学》的论文提出了分段多元回归模型的动态规划拟合，<sup>[14](https://doi.org/10.2307/2346519)</sup> P. M. 勒曼（P. M. Lerman）1980年的论文描述了用网格搜索拟合分段回归模型。<sup>[15](https://doi.org/10.2307/2346413)</sup> 在计量经济学中，白聚山（Jushan Bai）和皮埃尔·佩龙（Pierre Perron）1998年发表于《计量经济学》的论文处理了具有多个结构变化的线性模型的估计与检验。<sup>[16](https://doi.org/10.2307/2998540)</sup>

现代计算形式来自维托·M·R·穆杰奥（Vito M. R. Muggeo）2003年发表于《医学统计学》的论文，该文引入了将断点作为模型参数来拟合分段项的线性化技术；<sup>[7](https://onlinelibrary.wiley.com/doi/10.1002/sim.1545)</sup> 也来自2008年在R News中描述的segmented R包。<sup>[1](https://journal.r-project.org/articles/RN-2008-004/RN-2008-004.pdf)</sup>

## 变体

若干有名称的方法共享分段思想，但各自假设不同。segmented包拟合相接的直线，所有参数同时估计，并且对分段变量或变点的数量几乎没有限制；strucchange包则拟合结构断点模型，每个区间使用一组不同的参数，且不要求拟合直线相接。<sup>[1](https://journal.r-project.org/articles/RN-2008-004/RN-2008-004.pdf)</sup> Joinpoint回归由金贤珠（Hyune-Ju Kim）、迈克尔·P·费伊（Michael P. Fay）、埃里克·J·福伊尔（Eric J. Feuer）和道格拉斯·N·米德图恩（Douglas N. Midthune）在2000年发表于《医学统计学》的论文中提出，并用置换检验确定连接点数量，广泛用于癌症率应用。<sup>[17](https://doi.org/10.1002/%28sici%291097-0258%2820000215%2919:3<335::aid-sim336>3.0.co;2-z)</sup> 在生态学中，朱迪思·D·汤姆斯（Judith D. Toms）和玛丽·L·莱斯佩兰斯（Mary L. Lesperance）2003年发表于《生态学》的论文推广了分片回归（piecewise regression），包括折棍模型，用于识别生态阈值。<sup>[18](https://doi.org/10.1890/02-0472)</sup> 在segmented包内部，自2.0-0版起已可实现阶梯分段关系（stepmented relationships，即分段常数，用于突变）和约束斜率；自1.6-0版起可实现带随机变点的分段混合模型。<sup>[19](https://rdrr.io/cran/segmented/man/segmented-package.html)</sup><sup> • </sup><sup>[20](https://doi.org/10.1177/1471082x13504721)</sup>

## 应用

分段回归是分析中断时间序列数据的最广泛使用方法；在中断时间序列中，一项干预将序列分为干预前和干预后两个时期。<sup>[2](https://pmc.ncbi.nlm.nih.gov/articles/PMC10925407/)</sup> 在生态学中，它是定位响应序列阈值的标准工具，如汤姆斯和莱斯佩兰斯所述。<sup>[18](https://doi.org/10.1890/02-0472)</sup>

在ITS设计中，模型包含干预前和干预后的截距与斜率，因此干预效应分解为水平变化（干预时的跳跃）和斜率变化（趋势差异）。来自瓦格纳（Wagner）等和伯纳尔（Bernal）等的两种常用参数化表示同一个模型，但干预指示变量系数的含义不同：在瓦格纳参数化下，即时效应直接由系数 \( \beta_{W2} \) 给出；在伯纳尔参数化下，则为 \( \beta_{B2} + \beta_{3} \cdot \delta \)，而伯纳尔的截距系数在文献中有时被误读。<sup>[2](https://pmc.ncbi.nlm.nih.gov/articles/PMC10925407/)</sup> 影响模型应事先提出；从结局数据中选择它会增加把随机波动误判为效应的可能性。<sup>[21](https://pmc.ncbi.nlm.nih.gov/articles/PMC5407170/)</sup>

## 局限与替代方法

分段模型中的似然可能不是凹的，因此不能保证算法找到全局最大值；建议从不同起始值运行以评估稳定性。<sup>[1](https://journal.r-project.org/articles/RN-2008-004/RN-2008-004.pdf)</sup> 该方法假设拟合关系在断点处连续，即相接的直线在该处汇合；与连续性的微小偏离可能扭曲估计，而允许断点处跳跃的模型不由标准表述处理。<sup>[25](https://onlinelibrary.wiley.com/doi/epdf/10.1002/sim.1545)</sup><sup> • </sup><sup>[22](https://www.mdpi.com/2227-7390/11/24/4959)</sup> 自相关是一个实际混杂因素：在至少100个点的公共卫生ITS数据集中，一阶自相关的中位数为0.23（四分位距IQR 0.08至0.57），OLS未考虑它，ARIMA给出的标准误系统性地大于OLS、Newey-West、Prais-Winsten和REML，而REML估计在不同序列长度下稳定。<sup>[23](https://link.springer.com/article/10.1186/s12874-021-01306-w)</sup>

与替代方法相比，回归样条能很好地逼近平滑函数以用于预测，但其系数可能并不度量对响应的影响，也不具有显式可解释性；而分片回归用可解释的参数定位变点。<sup>[22](https://www.mdpi.com/2227-7390/11/24/4959)</sup> 美国国家卫生统计中心（NCHS）指南建议在使用Joinpoint之前先用多项式回归筛查趋势数据，同时指出这些模型彼此不同：二次模型刻画跨越时间的宽泛曲线，分片回归刻画一个或多个时间点上的斜率变化，而分段模型常因更易解释、更灵活而更受青睐。<sup>[24](https://www.ncbi.nlm.nih.gov/books/NBK619731/)</sup> 已发表文献尚未确定segmented包每段最少观测数的指导原则、与双重差分设计的直接比较，或专门针对剂量-反应应用的建议。

## References

1. [segmented: An R Package to Fit Regression Models with Broken-Line Relationships (Muggeo, R News 2008)](https://journal.r-project.org/articles/RN-2008-004/RN-2008-004.pdf)
2. [Interpretation of coefficients in segmented regression for interrupted time series analyses (BMC Medical Research Methodology, 2024/2025)](https://pmc.ncbi.nlm.nih.gov/articles/PMC10925407/)
3. [segmented: Regression Models with Break-Points/Change-Points Estimation (CRAN manual v2.2-1, 2026-01-29)](https://spout.ussg.indiana.edu/CRAN/web/packages/segmented/segmented.pdf)
4. [Sequential hypothesis testing for selecting the number of changepoints in segmented regression models (Environmental and Ecological Statistics, 2024)](https://link.springer.com/article/10.1007/s10651-024-00605-x)
5. [selgmented: Selecting the number of breakpoints in segmented regression (segmented documentation)](https://search.r-project.org/CRAN/refmans/segmented/html/selgmented.html)
6. [piecewise-regression (aka segmented regression) in Python](https://piecewise-regression.readthedocs.io/en/master/index.html)
7. [Estimating regression models with unknown break-points (Muggeo, Statistics in Medicine 2003)](https://onlinelibrary.wiley.com/doi/10.1002/sim.1545)
8. [Inference for the Break Point in Segmented Regression with Application to Longitudinal Data (Piepho & Ogutu, Biometrical Journal 2003)](https://onlinelibrary.wiley.com/doi/10.1002/bimj.200390035)
9. [Richard E. Quandt (1958). The Estimation of the Parameters of a Linear Regression System Obeying Two Separate Regimes. Journal of the American Statistical Association.](https://doi.org/10.1080/01621459.1958.10501484)
10. [The Estimation of Structural Shifts by Switching Regressions (Goldfeld and Quandt, NBER)](https://www.nber.org/system/files/chapters/c9938/c9938.pdf)
11. [Derek J. Hudson (1966). Fitting Segmented Curves Whose Join Points Have to Be Estimated. Journal of the American Statistical Association.](https://doi.org/10.1080/01621459.1966.10482198)
12. [David V. Hinkley (1971). Inference in Two-Phase Regression. Journal of the American Statistical Association.](https://doi.org/10.1080/01621459.1971.10482337)
13. [Paul I. Feder (1975). On Asymptotic Distribution Theory in Segmented Regression Problems-- Identified Case. The Annals of Statistics.](https://doi.org/10.1214/aos/1176342999)
14. [Douglas M. Hawkins (1976). Point Estimation of the Parameters of Piecewise Regression Models. Journal of the Royal Statistical Society Series C (Applied Statistics).](https://doi.org/10.2307/2346519)
15. [P. M. Lerman (1980). Fitting Segmented Regression Models by Grid Search. Journal of the Royal Statistical Society Series C (Applied Statistics).](https://doi.org/10.2307/2346413)
16. [Jushan Bai, Pierre Perron (1998). Estimating and Testing Linear Models with Multiple Structural Changes. Econometrica.](https://doi.org/10.2307/2998540)
17. [Permutation tests for joinpoint regression with applications to cancer rates (Statistics in Medicine, 2000)](https://doi.org/10.1002/%28sici%291097-0258%2820000215%2919:3<335::aid-sim336>3.0.co;2-z)
18. [Judith D. Toms, Mary L. Lesperance (2003). PIECEWISE REGRESSION: A TOOL FOR IDENTIFYING ECOLOGICAL THRESHOLDS. Ecology.](https://doi.org/10.1890/02-0472)
19. [segmented-package documentation (version 2.1-4, 2025-02-26)](https://rdrr.io/cran/segmented/man/segmented-package.html)
20. [Vito MR Muggeo and colleagues (2014). Segmented mixed models with random changepoints: a maximum likelihood approach with application to treatment for depression study. Statistical Modelling.](https://doi.org/10.1177/1471082x13504721)
21. [Interrupted time series regression for the evaluation of public health interventions: a tutorial (Int J Epidemiol)](https://pmc.ncbi.nlm.nih.gov/articles/PMC5407170/)
22. [An Advanced Segmentation Approach to Piecewise Regression Models (Mathematics, MDPI, 2023)](https://www.mdpi.com/2227-7390/11/24/4959)
23. [Comparison of six statistical methods for interrupted time series studies: empirical evaluation of 190 published series (BMC Med Res Methodol)](https://link.springer.com/article/10.1186/s12874-021-01306-w)
24. [Polynomial Versus Piecewise Regression: Similarities and Differences (NCHS Vital and Health Statistics Series 2, No. 213, September 2025)](https://www.ncbi.nlm.nih.gov/books/NBK619731/)
25. [Sim.1545 (onlinelibrary.wiley.com)](https://onlinelibrary.wiley.com/doi/epdf/10.1002/sim.1545)

---
*Initially written Sep 29, 2026 · Reviewed: Sep 30, 2026 · Edited: Sep 30, 2026; Oct 15, 2026 · Last review: Sep 30, 2026*

Topic: 物质世界与数学 › 数学与统计学 › 统计学与概率论 › Statistical inference, estimation, sampling, and testing › Regression analysis › Linear and multiple regression

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/segmented-regression

English original: https://www.edgepedia.org/segmented-regression
