Stata/二元結果模型
外觀
< Stata
- 分類因變數的迴歸模型 Long 和 Freese。示例資料集和程式可在 此網頁 上找到
- 邏輯斯蒂模型可以使用 logit 或 glm 估計,而機率模型可以使用 probit 或 glm 估計。
. clear . set obs 10000 obs was 0, now 10000 . gen u = invnorm(uniform()) . gen x = invnorm(uniform()) . gen ystar = x + u . gen y = (ystar > 0) . eststo clear . eststo : qui : reg ystar x (est1 stored) . eststo : qui : glm y x, family(binomial) link(logit) (est2 stored) . eststo : qui : logit y x (est3 stored) . eststo : qui : glm y x, family(binomial) link(probit) (est4 stored) . eststo : qui : probit y x (est5 stored) . esttab , se
- Scobit(偏斜邏輯斯蒂迴歸)由 Jonathan Nagler 於 1994 年開發(美國政治科學雜誌)。其思想是估計基礎分佈的偏斜引數。
. global N = 2000
. global alpha = 1
. clear
. set obs $N
obs was 0, now 2000
. gen u = ln(uniform()^(-1/$alpha) - 1)
. gen x = uniform()
. global beta = 2
. gen y = ($beta * x + u > 0)
.
. scobit y x
Fitting logistic model:
Iteration 0: log likelihood = -1190.598
Iteration 1: log likelihood = -1126.9573
Iteration 2: log likelihood = -1125.9604
Iteration 3: log likelihood = -1125.9597
Iteration 4: log likelihood = -1125.9597
Fitting full model:
Iteration 0: log likelihood = -1125.9597
Iteration 1: log likelihood = -1125.9459
Iteration 2: log likelihood = -1125.8543
Iteration 3: log likelihood = -1125.8241
Iteration 4: log likelihood = -1125.8008
Iteration 5: log likelihood = -1125.7376
Iteration 6: log likelihood = -1125.731
Iteration 7: log likelihood = -1125.724
Iteration 8: log likelihood = -1125.7185
Iteration 9: log likelihood = -1125.7158
Iteration 10: log likelihood = -1125.7144
Iteration 11: log likelihood = -1125.714
Iteration 12: log likelihood = -1125.7139
Iteration 13: log likelihood = -1125.7139
Skewed logistic regression Number of obs = 2000
Zero outcomes = 565
Log likelihood = -1125.714 Nonzero outcomes = 1435
------------------------------------------------------------------------------
y | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
x | 4.290739 7.563589 0.57 0.571 -10.53362 19.1151
_cons | 1.737008 4.256165 0.41 0.683 -6.604923 10.07894
-------------+----------------------------------------------------------------
/lnalpha | -1.068748 1.993377 -0.54 0.592 -4.975694 2.838198
-------------+----------------------------------------------------------------
alpha | .3434382 .6846017 .0069037 17.08495
------------------------------------------------------------------------------
Likelihood-ratio test of alpha=1: chi2(1) = 0.49 Prob > chi2 = 0.4832
note: Likelihood-ratio tests are recommended for inference with scobit models.