【发布时间】:2021-08-06 14:55:54
【问题描述】:
我目前正在使用 R 中的 mlogit 包进行(条件)多项逻辑回归分析。这些模型的标准输出是系数、标准误差及其显着性水平。由于这些系数可能难以解释,我还使用包中包含的 effects() 函数计算边际效应。然而,effects() 函数只提供边际效应(或弹性),而没有提供其他信息。理想情况下,我还会提供一些关于显着性和置信区间的信息。 有没有一种函数或简单的方法可以计算通过 effects() 计算的边际效应的标准误和显着性水平?
使用 mlogit 包中包含的 MC 数据集的示例
# loading packages
library(mlogit)
library(Formula)
# loading dataset on mode of travel from mlogit package
data("ModeCanada", package = "mlogit")
# only include choice sets with all four alternatives
MC <- dfidx(ModeCanada, subset = noalt == 4)
# formula of a multinomial model with income as a predictor of
# the mode of travel
ml.MC1 <- mlogit(choice ~ 1 | income | 1, MC)
# calculate model
summary(ml.MC1)
# output includes coefficients of the model but also standard
# error, z-values, and level of significance
Coefficients :
Estimate Std. Error z-value Pr(>|z|)
(Intercept):air -1.5035093 0.1963055 -7.6590 1.865e-14 ***
(Intercept):bus -1.7715605 0.6643887 -2.6665 0.007666 **
(Intercept):car 0.7371313 0.1572490 4.6877 2.763e-06 ***
income:air 0.0414857 0.0034315 12.0896 < 2.2e-16 ***
income:bus -0.0510644 0.0181427 -2.8146 0.004884 **
income:car 0.0053445 0.0029496 1.8120 0.069991 .
---
Signif. codes:
0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Log-Likelihood: -2779.2
# calculate marginal effects (an absolute increase of predictor as absolute
# change in predicted outcome probability)(at sample means).
# However, the output only includes the marginal effect of changes in
# income, but no info on standard errors, etc.
effects(ml.MC1, covariate = "income", type = "aa")
train air bus car
-0.0029162845 0.0086781323 -0.0001209537 -0.0056408941
【问题讨论】:
标签: r multinomial mlogit