我正在分析来自离散选择实验的数据,我无法弄清楚mlogit
指定时使用的权重weights
以下代码:
mlogit(formula = RES ~ -1 + V1 + V2, data = data,
reflevel = 1, rpar = c(V1 = "n", V2 = "n"), weights = Weight1, correlation = FALSE,
halton = NA, panel = TRUE, seed = 1234567890, method = "bfgs")
产生以下估计:
Frequencies of alternatives:
1 2
0.22987 0.77013
bfgs method
19 iterations, 0h:15m:34s
g'(-H)^-1g = 4.29E-08
gradient close to zero
Coefficients :
Estimate Std. Error t-value Pr(>|t|)
V1 0.859789 0.019076 45.072 < 2.2e-16 ***
V2 2.705395 0.039205 69.006 < 2.2e-16 ***
sd.V1 0.483573 0.023502 20.576 < 2.2e-16 ***
sd.V2 3.916796 0.062557 62.612 < 2.2e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Log-Likelihood: -9297.9
random coefficients
Min. 1st Qu. Median Mean 3rd Qu. Max.
V1 -Inf 0.53362451 0.8597892 0.8597892 1.185954 Inf
V2 -Inf 0.06355681 2.7053955 2.7053955 5.347234 Inf
但是,当我在 Stata 中运行相同的混合 logit 模型时,以下命令:
mixlogit res [pweight=weight1], group(str) id(id) rand(V1 V2) ln(0)
给我以下估计:
Mixed logit model Number of obs = 41,154
Wald chi2(2) = 395.55
Log likelihood = -9089.7906 Prob > chi2 = 0.0000
------------------------------------------------------------------------------
| Robust
res | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
Mean |
V1 | 1.207748 .0774815 15.59 0.000 1.055887 1.359608
V2 | 4.458814 .2356245 18.92 0.000 3.996998 4.920629
-------------+----------------------------------------------------------------
SD |
V1 | 1.107036 .0765884 14.45 0.000 .9569252 1.257146
V2 | 4.444472 .3586858 12.39 0.000 3.741461 5.147483
------------------------------------------------------------------------------
pweight
无论我在 Stata ( 、iweight
或)中使用什么加权方案fweight
,我都会得到类似的结果,而不会得到 R 给我的结果。
但是,当我在任一程序中运行未加权混合 logit 模型时,我得到相同的估计值。这让我觉得权重是显而易见的问题,但我不知道 R 在做什么。
帮助?