分段回归的公式

时间:2018-06-27 09:47:35

标签: statistics regression formula linear

我正在使用具有多个(!)断点的分段回归,并且必须根据预测的Y设置公式(例如Y_i = a + b * x_i + epsilon_i)。

下面是一个示例:Click

到目前为止,我还没有成功。有人可以帮我吗?如果公式易于理解,那就更好了。我没有发现任何文学方面的好东西。

1 个答案:

答案 0 :(得分:1)

segmented linear regression 既然您需要一个公式,我想可以用乳胶代码(上面的编译结果)来回答:

\documentclass[]{article}
\usepackage{amsmath}
\begin{document}
Using the indicator function
$$ \mathbf{1}_{c_i}(x) = \begin{cases}1 , \text{ for } x >= c_i \\ 0, \text{ else } \end{cases} $$
and the k breakpoints $c_i$ where $ i \in \left[ 1,...,k \right]$
you can write
$$ y = \alpha + \beta_0 \cdot x + \left(\sum_{i=1}^{k} \mathbf{1}_{c_i}(x) \cdot \beta_i \cdot x  \right)+ \epsilon $$
so for the left outer most segment you get the standard linear model
$$ y = \alpha + \beta_0 \cdot x +  \epsilon$$
with it's predictor:
$$ \hat{y} = \hat{\alpha} + \hat{\beta_0} \cdot x $$
for the second segment $c_1 <= x <c_2 $ you get 
$$ \hat{y} = \hat{\alpha} + \hat{\beta_0} \cdot x  + \hat{\beta_1} \cdot x  = \hat{y} = \hat{\alpha} + (\hat{\beta_0}+\hat{\beta_1}) \cdot x $$
and for the third segment
$$ \hat{y} = \hat{\alpha} + \hat{\beta_0} \cdot x  + \hat{\beta_1} \cdot x + \hat{\beta_2} \cdot x = \hat{y} = \hat{\alpha} + (\hat{\beta_0}+\hat{\beta_1}+\hat{\beta_2}) \cdot x $$
you get the picture...\\
The advantage of this formulations is that your model is not making any jumps, so you do not need to formulate the constaint 
$$ \lim_{x \rightarrow c_i-0} \hat{y}(x) = \lim_{x \rightarrow c_i+0} \hat{y}(x) $$
explicitly.
\end{document}