我正在分析离散选择实验中的数据,当我指定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
------------------------------------------------------------------------------
无论我在Stata(pweight
,iweight
或fweight
)中使用何种加权方案,我都会得到类似的结果,而不是R给我的结果。
然而,当我在任一程序中运行未加权的混合logit模型时,我得到相同的估计值。这让我觉得加权是一个明显的问题,但我无法弄清楚R在做什么。
帮助?
答案 0 :(得分:0)
这可能只有我看到,但如果有人碰到这个,问题不是加权。事实上,R命令(R = 10, tol = 10
)中的停止条件过于宽松。如果您将R
设置为较大而tol
设置为较小,则两个估算值会收敛。