0
点赞
收藏
分享

微信扫一扫

定序回归模型

上古神龙 2022-03-31 阅读 42

文章目录

什么是定序回归

定序回归的因变量是定序变量,数据类型是顺序数据。比如不满意,一般,满意;不合格,合格,优秀等。

模型构建

假设因变量是评分,先由单变量回归说起,则普通的线性回归模型为:
s c o r e = β 0 + β 1 × x 1 + ϵ \mathrm{score}=\beta_0+\beta_1\times x_1+\epsilon score=β0+β1×x1+ϵ
若上式中score不是连续变量,而是分类变量(例如取值为1,2,3,4)。这样等式两边的数据类型不统一,直接进行回归是没有意义的。我们考虑引入连续变量Z, 先让Z进行普通线性回归。
Z = β 0 + β 1 × x 1 + ϵ . Z=\beta_0+\beta_1\times x_1+\epsilon. Z=β0+β1×x1+ϵ.
并定义Z和score之间存在下面的关系:
s c o r e = { 1 , if Z < c 1 ; 2 , if c 1 ≤ Z < c 2 ; 3 , if c 2 ≤ Z < c 3 ; 4 , if c 3 ≤ Z . \mathrm{score}=\begin{cases} 1, \quad \text{if} \quad Z<c_1;\\ 2, \quad \text{if} \quad c_1\leq Z<c_2;\\ 3, \quad \text{if} \quad c_2\leq Z<c_3;\\ 4, \quad \text{if} \quad c_3\leq Z.\\ \end{cases} score=1,ifZ<c1;2,ifc1Z<c2;3,ifc2Z<c3;4,ifc3Z.
进一步可得:
Pr ⁡ ( s c o r e ≤ k ) = Pr ⁡ ( Z ≤ c k ) = Pr ⁡ ( β 0 + β 1 × x 1 + ϵ ) = F ϵ ( α k − β 1 × x 1 ) , \begin{aligned} \Pr(\mathrm{score}\leq k)&=\Pr(Z\leq c_k)\\ &=\Pr(\beta_0+\beta_1\times x_1+\epsilon)\\ &=F_\epsilon(\alpha_k-\beta_1\times x_1), \end{aligned} Pr(scorek)=Pr(Zck)=Pr(β0+β1×x1+ϵ)=Fϵ(αkβ1×x1),
其中, F ϵ ( ⋅ ) F_\epsilon(\cdot) Fϵ()表示 ϵ \epsilon ϵ的分布函数。

通过不同连接函数对 F ϵ ( ⋅ ) F_\epsilon(\cdot) Fϵ()进行建模可以得到不同形式的回归模型。

若用正态分布的分布函数 Φ ( ⋅ ) \Phi(\cdot) Φ()表示 F ϵ ( ⋅ ) F_\epsilon(\cdot) Fϵ(), 可得到定序回归的Probit模型:
Pr ⁡ ( s c o r e ≤ k ) = Φ ( α k − β 1 × x 1 ) . \Pr(\mathrm{score}\leq k)=\Phi(\alpha_k-\beta_1\times x_1). Pr(scorek)=Φ(αkβ1×x1).
进一步,有
Φ − 1 { Pr ⁡ ( s c o r e ≤ k ) } = α k − β 1 × x 1 . \Phi^{-1}\{\Pr(\mathrm{score}\leq k)\}=\alpha_k-\beta_1\times x_1. Φ1{Pr(scorek)}=αkβ1×x1.
上式左边可以通过计算得到,右边即为线性表达式。需要注意的是,与OLS相比,截距项 α k \alpha_k αk是有k个。

若用Logist连接函数来表示表示 F ϵ ( ⋅ ) F_\epsilon(\cdot) Fϵ(), 可得到定序回归的Logist模型:
Pr ⁡ ( s c o r e ≤ k ) = exp ⁡ ( α k − β 1 × x 1 ) 1 + exp ⁡ ( α k − β 1 × x 1 ) . \Pr(\mathrm{score}\leq k)=\frac{\exp(\alpha_k-\beta_1\times x_1)}{1+\exp(\alpha_k-\beta_1\times x_1)}. Pr(scorek)=1+exp(αkβ1×x1)exp(αkβ1×x1).
进一步,有
l o g i t { Pr ⁡ ( s c o r e ≤ k ) } = log ⁡ ( Pr ⁡ ( s c o r e ≤ k ) 1 − Pr ⁡ ( s c o r e ≤ k ) ) = α k − β 1 × x 1 . \mathrm{logit}\{\Pr(\mathrm{score}\leq k)\}=\log\left(\frac{\Pr(\mathrm{score}\leq k)}{1-\Pr(\mathrm{score}\leq k)}\right)=\alpha_k-\beta_1\times x_1. logit{Pr(scorek)}=log(1Pr(scorek)Pr(scorek))=αkβ1×x1.

随后可以利用极大似然估计,得到参数 α ^ 1 , α ^ 2 , . . . , α ^ 4 , β ^ 1 \hat{\alpha}_1,\hat{\alpha}_2,...,\hat{\alpha}_4,\hat{\beta}_1 α^1,α^2,...,α^4,β^1.
α ^ 1 , α ^ 2 , . . . , α ^ 4 , β ^ 1 = arg max ⁡ α 1 , . . , α 4 , β 1 ∏ i = 1 n p ( α 1 , . . , α 4 , β 1 ; x i ) , \hat{\alpha}_1,\hat{\alpha}_2,...,\hat{\alpha}_4,\hat{\beta}_1=\argmax_{\alpha_1,..,\alpha_4,\beta_1}\prod_{i=1}^n p(\alpha_1,..,\alpha_4,\beta_1;x_i), α^1,α^2,...,α^4,β^1=α1,..,α4,β1argmaxi=1np(α1,..,α4,β1;xi),
其中
p ( x i ) = { F ( α 1 − β 1 × x 1 ) , if k = 1 ; F ( α k − β 1 × x 1 ) − F ( α k − 1 − β 1 × x 1 ) , if 1 < k < 4 ; 1 − F ( α 3 − β 1 × x 1 ) , if k = 4. p(x_i)=\begin{cases} F(\alpha_1-\beta_1\times x_1),\quad \text{if}\quad k=1;\\ F(\alpha_k-\beta_1\times x_1)-F(\alpha_{k-1}-\beta_1\times x_1),\quad \text{if}\quad 1<k<4;\\ 1-F(\alpha_3-\beta_1\times x_1),\quad \text{if}\quad k=4. \end{cases} p(xi)=F(α1β1×x1),ifk=1;F(αkβ1×x1)F(αk1β1×x1),if1<k<4;1F(α3β1×x1),ifk=4.

R语言实现

举报

相关推荐

0 条评论