library("sandwich")
library("zoo")
library("lmtest")
library("MASS")
library("pscl")
library("LogisticDx")
library("ucminf")
library("ordinal")
library("reshape")
library("generalhoslem")
# install.packages("devtools")
library("devtools")
library(devtools)
# install_version("oglmx", version = "3.0.0.0",
# repos = "http://cran.us.r-project.org")
library("oglmx")
library("aod")
library("brant")
library(dplyr)We illustrate the ordered probit and logit techniques with a model of
corporate bond ratings. The dataset ratings.csv contains
information on 98 U.S. corporations’ bond ratings and financial
characteristics where the bond ratings are AAA (excellent) to C (poor).
The integer codes underlying the ratings increase in the quality of the
firm’s rating, such that an increase in the response variable indicates
that the firm’s bonds are a more attractive investment opportunity. The
bond rating variable (rating83c) is coded as integers 2–5,
with 5 corresponding to the highest quality (AAA) bonds to the lowest.
We model the 1983 bond rating as a function of the firm’s
income-to-asset ratio in 1983 (ia83: roughly, return on
assets) and the change in that ratio from 1982 to 1983
(dia).
rating83c.ia83 and dia jointly significant?rating83c.rat <- read.csv(file = "Ratings.csv", header = TRUE, sep = ",")
rat %>%
dplyr::select(rating83c, ia83, dia) %>%
as_tibble()## # A tibble: 98 × 3
## rating83c ia83 dia
## <chr> <dbl> <dbl>
## 1 BA_B_C 14.4 5.23
## 2 BAA 1.70 -4.80
## 3 AA_A 14.6 0.434
## 4 AAA 2.16 -10.8
## 5 AAA 16.5 -2.52
## 6 AAA 8.57 2.41
## 7 BAA 12.3 0.319
## 8 AAA 17.5 0.112
## 9 BAA 10.2 4.21
## 10 AA_A 21.2 -1.96
## # ℹ 88 more rows
##
## AA_A AAA BA_B_C BAA
## 15 29 26 28
rr <- rep(0, 98)
rr[which(rat$rating83c == "BA_B_C")] <- 2
rr[rat$rating83c == "BAA"] <- 3
rr[rat$rating83c == "AA_A"] <- 4
rr[rat$rating83c == "AAA"] <- 5数据预处理,这是回归分析前的关键步骤。
rat %>% dplyr::select(...)
用于从原始数据集 rat 中提取建模所需的三个变量:目标变量
rating83c(1983年评级)和自变量
ia83(收益资产比)、dia(收益资产比的变化)。rating83c
原始数据可能是字符型(如 “AAA”, “BAA”),代码通过创建一个向量
rr 并使用索引赋值,将其转化为 2, 3, 4, 5
的整数序列。# Estimate ordered logit for \texttt{rating83c}.
# polr from MASS package
# polr 是 "proportional odds logistic regression"(比例优势逻辑回归)的缩写
ologit <- polr(as.factor(rr) ~ ia83 + dia, data = rat)
summary(ologit)## Call:
## polr(formula = as.factor(rr) ~ ia83 + dia, data = rat)
##
## Coefficients:
## Value Std. Error t value
## ia83 0.09392 0.02962 3.171
## dia -0.08669 0.04498 -1.927
##
## Intercepts:
## Value Std. Error t value
## 2|3 -0.1853 0.3571 -0.5188
## 3|4 1.1857 0.3882 3.0544
## 4|5 1.9084 0.4165 4.5822
##
## Residual Deviance: 254.5429
## AIC: 264.5429
polr 函数:全称是 Proportional Odds
Logistic
Regression。它专门用于估计因变量为有序分类(Ordinal)的模型。as.factor(rr):这是关键步骤。因变量必须转化为因子(Factor)类型,R
才能识别出这是一个分类任务,而非普通的线性回归。这里的 rr
对应 2-5 的信用评级。ia83 + dia:自变量。ia83
是 1983 年的收入资产比,dia 是该比例的年度变化。这部分展示了自变量对潜在倾向值(Latent Score)的影响。
ia83 (Value = 0.09392):系数为正且
t 值 (3.171)
较大。这表明企业的收入资产比越高,其债券评级上升(向更高数值 5
移动)的可能性显著增加。dia (Value =
-0.08669):系数为负,t 值 (-1.927)
接近显著性临界值(通常为
1.96)。这意味着收入资产比的增长(变动额)对评级可能有负向影响,但在 5%
的置信水平下略显勉强。在有序模型中,这些被称为 Cutpoints(通常记为 \(\zeta\))。它们将连续的潜在变量划分为不同的观察等级:
这些值随着评级升高而递增,符合逻辑。
0.09392
并不直接代表概率的变化,而是代表
Log-Odds(对数几率)的变化。若要解释为几率比(Odds
Ratio),需要计算 \(\exp(0.09392) \approx
1.098\),即 ia83
每增加一个单位,评级提升一个等级的几率增加约 9.8%。polr 的
==输出默认不提供p值== 。通常需要根据 t value 进行判断:如果
\(|t| > 1.96\),则在 5%
水平下显著。ia83
每提高一个单位,公司评级上调的几率增加
9.8%。这是评级的“加分项”。dia
绝对值大),评级机构可能认为公司经营不稳或风险偏好上升。这是评级的“潜在扣分项”。对债券评级而言,“现在的赚钱能力”比“增长速度”重要得多。评级机构更看重公司当下的厚实程度(ia83),而对业绩的剧烈波动(dia)持谨慎甚至负面态度。
coeftest
系数显著性检验##
## t test of coefficients:
##
## Estimate Std. Error t value Pr(>|t|)
## ia83 0.093918 0.029620 3.1708 0.002059 **
## dia -0.086694 0.044979 -1.9274 0.056977 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
这段输出是使用 lmtest 包中的 coeftest
函数对有序 Logit
模型进行的系数显著性检验。它为每个变量提供了精确的
\(p\)
值,让我们能更科学地判断变量是否“入流”。
coeftest(ologit):
该函数的主要作用是计算模型系数的** \(z\) 检验**(输出中标记为 \(t\)
test,但在大样本逻辑回归中通常遵循正态分布)。summary: 之前的
summary(ologit) ==默认不提供 \(p\) 值==,只给 \(t\) 值。coeftest
补齐了这一环,方便直接判断变量是否在统计学上显著。表格中的四列数据分别对应:
R 语言用小符号直观标注了显著程度:
**:代表极显著(\(p <
0.01\))。.:代表勉强显著或趋势性显著(\(p < 0.1\))。通过这组检验,我们可以确信:
“赚钱效率 (ia83)” 是评级机构打分的铁证,绝对不容忽视。而 “赚钱能力的变动 (dia)” 虽然有一定的负向趋势,但在数据证据上还没有达到“板上钉钉”的程度(未过 0.05 门槛)。
ia83 and dia jointly significant?# Are \texttt{ia83} and \texttt{dia} jointly significant?
# Likelihood ratio test
ologit.restricted <- polr(as.factor(rr) ~ 1, data = rat)
lrtest(ologit, ologit.restricted)## Likelihood ratio test
##
## Model 1: as.factor(rr) ~ ia83 + dia
## Model 2: as.factor(rr) ~ 1
## #Df LogLik Df Chisq Pr(>Chisq)
## 1 5 -127.27
## 2 3 -133.04 -2 11.542 0.003117 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
这段输出展示了对 ia83 和 dia
进行的联合显著性检验(Joint Significance
Test),通常使用似然比检验(Likelihood Ratio Test,
LRT)。
ologit.restricted:
这是一个受限模型(Restricted
Model)。它只包含截距项(~ 1),不包含任何自变量。其假设(原假设
\(H_0\))是:ia83 和
dia 的系数均为 0。lrtest(ologit, ologit.restricted):
该函数比较“全模型”(包含自变量)与“受限模型”的对数似然值(Log-Likelihood)。它判断增加这两个自变量是否显著提升了模型的解释能力。ia83
和 dia)。由于 \(p\) 值(0.0031)远小于常用的显著性水平 0.01,我们拒绝原假设。
这意味着 ia83(赚钱效率)和
dia(效率变化)联合起来对债券评级具有显著的影响。即使在之前的单项检验中
dia
表现一般,但作为一个财务特征组合,它们共同显著地改善了模型对企业信用状况的预测能力。
##
## Lipsitz goodness of fit test for ordinal response models
##
## data: formula: as.factor(rr) ~ ia83 + dia
## LR statistic = 12.514, df = 9, p-value = 0.1859
在有序 Logit 模型中,传统的 \(R^2\) 并不适用,因此我们使用专门的拟合优度检验(Goodness-of-Fit Tests)。这段输出展示了 Lipsitz 检验的结果。
lipsitz.test(ologit):
这是专门为有序响应模型设计的拟合优度检验。由于 \(p\) 值(0.1859)较大,我们无法拒绝原假设(即接受原假设)。
这意味着:该模型对债券评级的拟合是恰当的。
换句话说,模型中设定的函数形式(有序
Logit)以及选取的变量(ia83 和
dia)能够较好地描述数据的内在结构,没有明显的证据表明模型存在严重的设定偏误(Misspecification)。
拟合优度检验在高级计量中通常作为“体检报告”。如果 \(p\) 值很小(比如 < 0.05),说明你的模型漏掉了重要的非线性项,或者有序 Logit 的分布假设不成立,需要调整模型结构。而在你给出的结果中,模型已经顺利通过了这项“体检”。
The Lipsitz test was performed to evaluate the overall fit of the ordered logit model. This test assesses whether the model’s predicted probabilities align significantly with the observed frequencies in the data.
The null hypothesis (\(H_0\)) for the Lipsitz test is that the model fits the data well. Since the p-value (0.1859) is greater than the standard significance level of 0.05, we fail to reject the null hypothesis.
This indicates that there is no evidence of significant lack-of-fit.
The ordered logit functional form, using ia83 and
dia as predictors, is appropriate for modeling the
corporate bond ratings in this dataset.
##
## Hosmer and Lemeshow test (ordinal model)
##
## data: rat$rating83c, fitted(ologit)
## X-squared = 88.61, df = 11, p-value = 0.0000000000000312
这段输出展示了另一种拟合优度检验:Hosmer-Lemeshow (H-L) 检验(针对有序模型)。有趣的是,这个结果与之前的 Lipsitz 检验截然相反。
logitgof(...): 该函数来自
generalhoslem 包,用于执行 Hosmer-Lemeshow
拟合优度检验。rat$rating83c:观测到的实际债券评级。fitted(ologit):模型预测的每个评级类别的概率。g = 5:将样本按预测概率分成 5
组(Groups)。ord = TRUE:明确告诉函数这是一个有序(Ordinal)响应模型,而非普通的多项
Logit。由于 \(p\) 值接近于零,我们强烈拒绝“模型拟合良好”的原假设。
这里出现了一个非常典型的计量经济学现象:不同的检验给出了矛盾的结论。
为什么会这样?
g):H-L 检验对分组数
g 的选择非常敏感。如果样本量较小(如本案中的 98
个观测值),分组可能导致某些单元格频数过低,从而使统计量失真。The Hosmer-Lemeshow test was conducted to check the goodness-of-fit for the ordered logit model.
## --------------------------------------------
## Test for X2 df probability
## --------------------------------------------
## Omnibus 68.74 4 0
## ia83 14.24 2 0
## dia 1.1 2 0.58
## --------------------------------------------
##
## H0: Parallel Regression Assumption holds
在有序 Logit 模型中,Brant 检验是判断模型设定是否正确的“终极大考”。它测试的是有序模型最核心的假设:平行线假设(Parallel Regression Assumption)。
brant(ologit): 该函数来自
brant 包,专门用于检验 polr
模型是否违反了比例几率(Proportional Odds)假设。ia83)对不同等级之间转移的影响是一致的。例如,“从评级 2 到
3”的影响应等于“从评级 4 到
5”的影响。如果不一致(线条不平行),模型就会失效。表格提供了整体检验和单个变量的拆解:
ia83(赚钱效率)是导致模型违规的主要原因。这意味着它对“低评级向中评级跨越”的影响,与对“高评级向极高评级跨越”的影响显著不同。dia 符合平行线假设。模型失败了。尽管之前的拟合优度检验(Lipsitz)勉强通过,但 Brant 检验揭示了深层问题:对于债券评级,收益资产比(ia83)在不同档位的作用力是不均匀的。
当 Brant 检验失败时,通常不能再直接使用简单的 Ordered Logit。你可能需要: 1. 使用 广义有序 Logit(Generalized Ordered Logit)。 2. 使用 多项 Logit(Multinomial Logit),它允许每个类别有独立的系数。
The Brant’s test was performed to verify the Parallel Regression Assumption.
ia83 violates the
assumption (\(p=0\)), while
dia satisfies it (\(p=0.58\)).ia83 varies across different rating thresholds. A more
flexible model, such as a Generalized Ordered Logit or Multinomial
Logit, should be considered.这是一个非常深刻的计量经济学问题。当 Brant 检验
失败(\(p <
0.05\)),意味着你的“梯子”每级高度不相等——即 ia83
对从“等级 2 升到 3”的拉动力,和从“等级 4 升到
5”的拉动力在统计上显著不同。
针对这种情况,通常有以下三种处理方案,按推荐程度排序:
这是最直接的对症下药。普通的 Ordered Logit 强制所有等级共享同一个 \(\beta\),而 Generalized Ordered Logit (gologit2) 允许系数随等级变化。
ia83)释放约束,让它在每个阈值处都有独立的系数
\(\beta_j\)。vgam 包中的
vglm 函数,设置
family = cumulative(parallel = FALSE)。如果你发现只有 ia83 违反假设,而 dia
是守规矩的(正如你的 Brant 检验结果:dia 的 \(p=0.58\)),你可以使用这种折中方案。
ia83
的系数随等级变化,而强迫 dia
的系数在所有等级间保持一致。如果排序信息不再重要,或者你认为不同评级之间完全是“质变”而非“量变”。
multinom 函数。它完全不考虑
2, 3, 4, 5 的先后顺序,把它们看作四个独立的类别。有时候违反平行线假设是因为非线性关系。
ia83 取对数 \(\ln(ia83)\)、加入平方项 \(ia83^2\),或者进行标准化处理。在学术论文或高级计量作业中,最标准的做法是:
“由于 Brant 检验显著拒绝了平行线假设,说明标准有序 Logit 存在设定偏误。我们应转而采用广义有序 Logit (Generalized Ordered Logit) 模型,以允许关键变量
ia83在不同评级门槛间具有异质性影响。”
## fitting null model for pseudo-r2
## llh llhNull G2 McFadden r2ML r2CU
## -127.2714574 -133.0422446 11.5415743 0.0433756 0.1111006 0.1189762
在非线性模型(如 Ordered Logit)中,由于不存在最小二乘法中的剩余方差概念,传统的 \(R^2\) 无法计算。因此,我们使用 Pseudo-\(R^2\)(伪 \(R^2\)) 来衡量模型的拟合优度。
pR2(ologit): 该函数来自
pscl 包。它通过比较全模型(Full
Model)和仅含截距项的空模型(Null
Model)的对数似然值,计算出多种伪 \(R^2\) 指标。输出提供了四种主流的伪 \(R^2\) 计算结果:
r2ML 进行了修正,确保最大值可以达到 1。
虽然模型在统计上是显著的(由之前的 LR 检验可知),但从伪 \(R^2\) 来看,其解释力较为有限。
ia83(赚钱能力)和
dia(变化趋势)外,还受到债务规模、行业环境、宏观经济、公司治理等诸多因素影响。仅用两个变量解释
12%
的变异在金融研究中其实是正常现象,但也暗示了模型可能遗漏了其他重要的解释变量。f) Calculate and interpret pseudo-\(R^2\) statistics.
Several pseudo-\(R^2\) metrics were calculated to assess the model’s explanatory power.
Interpretation: While the model is statistically
significant, the explanatory power is relatively modest. The Nagelkerke
\(R^2\) suggests that the financial
variables ia83 and dia account for
approximately 11.9% of the variation in corporate bond
ratings. The low McFadden value (4.3%) indicates that many other
unobserved factors likely influence a firm’s creditworthiness beyond
simple income-to-asset ratios.
Let’s analyse variable coding health status of respondents (hstatus). The variable takes three values:
Covariates for the dependent variable are:
Questions:
Why shouldn’t we use a logit/probit model for this problem?
Estimate an ordered logit for health status with covariates mentioned above.
Determine and interpret pseudo-\(R^2\) statistics.
Are variables in the model jointly significant?
The parameter next to income is equal to \(-3.39 \times 10^{-5}\).
Are we allowed to conclude on the basis of the value that
income is insignificant?
Having parameters estimated determine signs of marginal effects for female and famsize for the alternative good health.
Perform goodness-of-fit tests.
Determine and interpret marginal effects for the alternative moderate health.
Determine and interpret marginal effects for the alternative good health.
Verify hypothesis that income affects respondents’ health linearly against the alternative that income has nonlinear, cubic impact. Use likelihood ratio test.
标准的 Logit 或 Probit 模型仅适用于二元因变量 (Binary dependent variables),即只有两个类别(如 0 和 1) 。
本题情况: 这里的因变量 hstatus 是一个有 3 个等级的排序变量 (3-value ordered variable)(差、中、优) 。
排序性 (Ordinal nature): 虽然我们可以用 1, 2, 3 来编码,但这些数字仅代表排序 (Ordering),而不具备数量意义 (Quantitative interpretation)。例如,状态“3”比“1”好,但并不代表它正好是“1”的三倍好,也不意味着 1+2=3 。
因此,使用排序选择模型 (Ordered Choice Models)(如 Ordered Logit/Probit)更为合适。
rd = read.csv(file="Randdata.csv", header=TRUE, sep=",")
rd$health = 0
rd$health[rd$hlthp==1]=1
rd$health[rd$hlthf==1]=2
rd$health[rd$hlthg==1]=3
indeksy = which(rd$health==0)
rd = rd[-indeksy,]
rd$health = as.factor(rd$health)代码逻辑:
hstatus(此处为
health)是一个典型的排序变量,将状态编码为
1(差)、2(中)、3(优)。as.factor()
至关重要,因为排序 Logit/Probit 模型(如 MASS 包中的
polr
函数)要求因变量必须是因子类型,以便程序能够识别其类别顺序并估计相应的阈值
(Thresholds),,。# Estimate ordered logit for hstatus.
ologit = ologit.reg(health~income+female+num, data=rd)
summary(ologit)## Ordered Logit Regression
## Log-Likelihood: -5294.072
## No. Iterations: 5
## McFadden's R2: 0.02912101
## AIC: 10598.14
## Estimate Std. error t value Pr(>|t|)
## income 0.0001157821 0.0000070506 16.4217 < 0.00000000000000022 ***
## female -0.1412207117 0.0535073206 -2.6393 0.008308 **
## num 0.0293452983 0.0126663105 2.3168 0.020515 *
## ----- Threshold Parameters -----
## Estimate Std. error t value Pr(>|t|)
## Threshold (1->2) -2.580795 0.092750 -27.8254 < 0.00000000000000022 ***
## Threshold (2->3) -0.528933 0.077969 -6.7839 0.0000000000117 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
这份 R 语言输出展示了一个排序 Logit 回归 (Ordered Logit Regression) 的估计结果。该模型用于分析具有自然顺序但没有定量解释的离散因变量。
这段代码执行了排序 Logit 模型的估计与结果展示:
ologit = ologit.reg(health ~ income + female + num, data = rd):使用
rd 数据集估计模型。因变量是
health(1=差,2=中,3=优),自变量包括
income(收入)、female(性别虚拟变量)和
num(家庭人数)。summary(ologit):提取并显示模型的详细统计摘要。在输出的顶部,提供了衡量模型拟合程度的关键统计量:
这部分展示了每个解释变量对潜变量 \(y^*\)(隐藏的健康倾向)的影响:
In an Ordered Logit Model, the regression coefficients (\(\beta\)) represent the relationship between the explanatory variables and the latent variable (\(y^*\)), which is the underlying, unobservable continuous propensity for a specific outcome. 在有序Logit模型中,回归系数(β)表示解释变量与潜在变量(y∗)之间的关系,潜在变量是特定结果的潜在、不可观测的连续倾向。
Here is a breakdown of how to interpret these coefficients in an English-language academic context:
The sign of the coefficient indicates the direction of the change in the latent propensity.
While the coefficient directly affects the latent variable, its impact on the observed probabilities of specific categories follows a specific logic:
The “Value” or “Estimate” of the coefficient should not be interpreted in isolation; it must be checked for statistical significance using the t-value or p-value.
income has a p-value of
< 2.2e-16, indicating it is highly significant.income) may appear small, but this does not mean the
variable is “insignificant”; it simply reflects the unit of measurement
for that specific variable.It is important to remember that in a standard Ordered Logit model,
these coefficients are assumed to be constant across all
thresholds. This is known as the Parallel Regression
Assumption, meaning the effect of a variable like
income is assumed to be the same regardless of whether you
are moving from Category 1 to 2 or Category 2 to 3.
| Percent | 10% | 5% | 1% | ||
|---|---|---|---|---|---|
| Point | \(\ll\) 1.645 | 1.645 | 1.96 | 2.58 | \(\gg 2.58\) |
| Conclusion | ✅ fail to reject | ❌ | ❌ | ❌ | Strongly Reject❌❌ |
polr
for Ordinal logit/probitologit <- polr(as.factor(rr) ~ ia83 + dia, data = rat)
## Coefficients:
## Value Std. Error t value
## ia83 0.09392 0.02962 3.171
## dia -0.08669 0.04498 -1.927系数解释:这里的 0.09392
并不直接代表概率的变化,而是代表
Log-Odds(对数几率)的变化。若要解释为几率比(==Odds
Ratio==),需要计算 \(\exp(0.09392) \approx
1.098\),即 ia83
每增加一个单位,评级提升一个等级的几率增加约 9.8%。
ia83 (Value =
0.09392):系数为正且 t 值
(3.171) 较大。这表明企业的收入资产比越高,其债券评级上升(向更高数值
5 移动)的可能性显著增加。
dia (Value:
-0.08669):系数为负,t 值
(-1.927) ==先取绝对值== 接近显著性临界值(通常为
1.96)。这意味着收入资产比的增长(变动额)对评级可能有负向影响,但在 5%
的置信水平下略显勉强。
coeftest 系数显著性检验coeftest(ologit)
##
## t test of coefficients:
##
## Estimate Std. Error t value Pr(>|t|)
## ia83 0.093918 0.029620 3.1708 0.002059 **
## dia -0.086694 0.044979 -1.9274 0.056977 . summary(ologit) 默认不提供 𝑝 值,只给 𝑡
值。coeftest
补齐了这一环,方便直接判断变量是否在统计学上显著。ologit.restricted <- polr(as.factor(rr) ~ 1, data = rat)
lrtest(ologit, ologit.restricted)
## Likelihood ratio test
##
## Model 1: as.factor(rr) ~ ia83 + dia
## Model 2: as.factor(rr) ~ 1
## #Df LogLik Df Chisq Pr(>Chisq)
## 1 5 -127.27
## 2 3 -133.04 -2 11.542 0.003117 **~ 1: 只包含截距项, 不包含任何自变量
\(H_0\): ia83 和
dia 的系数均为 0。
lrtest(ologit, ologit.restricted):
该函数比较“全模型”与“受限模型”的对数似然值(Log-Likelihood)。判断增加这两个自变量是否显著提升了模型的解释能力。
LogLik (对数似然值):越大(接近 0),说明拟合效果更好。
\(P\ge 0.05\): fail to reject H0, Jointly Significant;
\(P \ll 0.05\): Reject H0, strongly reject h0, Jointly In-Significant.
lipsitz.test goodness-of-fit testslipsitz.test(ologit)
##
## Lipsitz goodness of fit test for ordinal response models
##
## data: formula: as.factor(rr) ~ ia83 + dia
## LR statistic = 12.514, df = 9, p-value = 0.1859logitgof Hosmer-Lemeshow (H-L)拟合优度检验logitgof(rat$rating83c, fitted(ologit), g = 5, ord = TRUE)
brant
平行线检测brant(ologit)
## --------------------------------------------
## Test for X2 df probability
## --------------------------------------------
## Omnibus 68.74 4 0
## ia83 14.24 2 0
## dia 1.1 2 0.58
## --------------------------------------------
##
## H0: Parallel Regression Assumption holdspolr 模型是否违反了比例几率(Proportional
Odds)假设。ia83)对不同等级之间转移的影响是一致的。例如,“从评级 2 到
3”的影响应等于“从评级 4 到
5”的影响。如果不一致(线条不平行),模型就会失效。# Pseudo-R2 statistics
pR2(ologit)
## fitting null model for pseudo-r2
## llh llhNull G2 McFadden r2ML r2CU
## -127.2714574 -133.0422446 11.5415743 0.0433756 0.1111006 0.11897620.2 到 0.4
之间就被认为模型拟合得非常优秀了。ologit.reg Ordered Logit Regressionologit = ologit.reg(health~income+female+num, data=rd)
summary(ologit)
## Ordered Logit Regression
## Log-Likelihood: -5294.072
## No. Iterations: 5
## McFadden's R2: 0.02912101
## AIC: 10598.14
## Estimate Std. error t value Pr(>|t|)
## income 0.0001157821 0.0000070506 16.4217 < 0.00000000000000022 ***
## female -0.1412207117 0.0535073206 -2.6393 0.008308 **
## num 0.0293452983 0.0126663105 2.3168 0.020515 * 有序 Logit 模型中,系数(Estimate)代表:在其他变量保持不变时,自变量每增加一个单位,因变量进入更高健康等级(更好健康状况)的==对数几率(Log Odds)==的变化。
The sign of the coefficient indicates the direction of the change in the latent propensity.
Positive Coefficient (𝛽>0): As the independent variable increases, the latent propensity (𝑦∗) also increases. This moves the individual toward higher ordered categories (e.g., from “Moderate Health” toward “Good Health”).
Negative Coefficient (𝛽<0): As the independent variable increases, the latent propensity decreases, making lower ordered categories more likely.
income (1.1578e-04):
female (-1.4122e-01):
num (2.9345e-02):