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.