離散従属変数を使用した回帰

限定的および質的従属変数に対する回帰モデル。このモジュールでは現在、バイナリデータ(Logit, Probit)、多項データ(MNLogit)、またはカウントデータ(Poisson, NegativeBinomial)を使用したモデルの推定が可能です。

バージョン0.9以降、これには新しいカウントモデルも含まれています。0.9では、NegativeBinomialP、GeneralizedPoisson、ゼロ膨張モデル、ZeroInflatedPoisson、ZeroInflatedNegativeBinomialP、ZeroInflatedGeneralizedPoisson はまだ実験中です。

コマンドと引数については、 モジュール リファレンス を参照してください。

# Load the data from Spector and Mazzeo (1980)
In [1]: import statsmodels.api as sm

In [2]: spector_data = sm.datasets.spector.load_pandas()

In [3]: spector_data.exog = sm.add_constant(spector_data.exog)

# Logit Model
In [4]: logit_mod = sm.Logit(spector_data.endog, spector_data.exog)

In [5]: logit_res = logit_mod.fit()
Optimization terminated successfully.
         Current function value: 0.402801
         Iterations 7

In [6]: print(logit_res.summary())
                           Logit Regression Results                           
==============================================================================
Dep. Variable:                  GRADE   No. Observations:                   32
Model:                          Logit   Df Residuals:                       28
Method:                           MLE   Df Model:                            3
Date:                Tue, 28 Jan 2025   Pseudo R-squ.:                  0.3740
Time:                        00:01:33   Log-Likelihood:                -12.890
converged:                       True   LL-Null:                       -20.592
Covariance Type:            nonrobust   LLR p-value:                  0.001502
==============================================================================
                 coef    std err          z      P>|z|      [0.025      0.975]
------------------------------------------------------------------------------
const        -13.0213      4.931     -2.641      0.008     -22.687      -3.356
GPA            2.8261      1.263      2.238      0.025       0.351       5.301
TUCE           0.0952      0.142      0.672      0.501      -0.182       0.373
PSI            2.3787      1.065      2.234      0.025       0.292       4.465
==============================================================================

詳細な例は次の場所にあります :

技術文書

現在、すべてのモデルは最尤法によって推定されており、独立同一分布の誤差を想定しています。

すべての離散回帰モデルは同じ方法を定義し、同じ構造に従います。これは回帰結果と似ていますが、いくつかの方法は離散モデルに固有です。さらに、それらのいくつかには、追加のモデル固有の方法と属性が含まれています。

参考文献

このクラスのモデルの一般的な参考資料は次のとおりです :

A.C. Cameron and P.K. Trivedi.  `Regression Analysis of Count Data`.
    Cambridge, 1998

G.S. Madalla. `Limited-Dependent and Qualitative Variables in Econometrics`.
    Cambridge, 1983.

W. Greene. `Econometric Analysis`. Prentice Hall, 5th. edition. 2003.

モジュールリファレンス

特定のモデル クラスは次のとおりです :

Logit(endog, exog[, offset, check_rank])

ロジットモデル

Probit(endog, exog[, offset, check_rank])

プロビットモデル

MNLogit(endog, exog[, check_rank])

多項ロジットモデル

Poisson(endog, exog[, offset, exposure, ...])

ポアソンモデル

NegativeBinomial(endog, exog[, ...])

負二項モデル

NegativeBinomialP(endog, exog[, p, offset, ...])

一般化負二項 (NB-P) モデル

GeneralizedPoisson(endog, exog[, p, offset, ...])

一般化ポアソンモデル

ZeroInflatedPoisson(endog, exog[, ...])

ポアソンゼロ膨張モデル

ZeroInflatedNegativeBinomialP(endog, exog[, ...])

ゼロ膨張一般化負二項モデル

ZeroInflatedGeneralizedPoisson(endog, exog)

ゼロ膨張一般化ポアソンモデル

HurdleCountModel(endog, exog[, offset, ...])

カウントデータのハードルモデル

TruncatedLFNegativeBinomialP(endog, exog[, ...])

カウントデータの切り捨てられた一般化負の二項モデル

TruncatedLFPoisson(endog, exog[, offset, ...])

カウントデータの切り捨てられたポアソンモデル

ConditionalLogit(endog, exog[, missing])

条件付きロジスティック回帰モデルをグループ化されたデータに適合させます。

ConditionalMNLogit(endog, exog[, missing])

条件付き多項ロジット モデルをグループ化されたデータに適合させます。

ConditionalPoisson(endog, exog[, missing])

条件付きポアソン回帰モデルをグループ化されたデータに当てはめます。

順序従属変数の累積リンク モデルは、GenericLikelihoodModel のサブクラスとして現在、miscmodels に含まれています。これは将来のバージョンで変更される予定です。

OrderedModel(endog, exog[, offset, distr])

ロジスティック分布または正規分布に基づく順序モデル

Logit Model の結果クラス :

LogitResults(model, mlefit[, cov_type, ...])

Logit Model の結果クラス

ProbitResults(model, mlefit[, cov_type, ...])

プロビットモデルの結果クラス

CountResults(model, mlefit[, cov_type, ...])

カウントデータの結果クラス

MultinomialResults(model, mlefit)

多項データの結果クラス

NegativeBinomialResults(model, mlefit[, ...])

負二項 1および2の結果クラス

GeneralizedPoissonResults(model, mlefit[, ...])

一般化ポアソンの結果クラス

ZeroInflatedPoissonResults(model, mlefit[, ...])

ゼロ膨張ポアソンの結果クラス

ZeroInflatedNegativeBinomialResults(model, ...)

ゼロ膨張一般化負二項式の結果クラス

ZeroInflatedGeneralizedPoissonResults(model, ...)

ゼロ膨張一般化ポアソンの結果クラス

HurdleCountResults(model, mlefit, ...[, ...])

ハードルモデルの結果クラス

TruncatedLFPoissonResults(model, mlefit[, ...])

切り捨てられたPoissonの結果クラス

TruncatedNegativeBinomialResults(model, mlefit)

切り捨てられた負二項式の結果クラス

ConditionalResults(model, params, ...)

属性:

OrderedResults(model, mlefit)

OrderedModelの結果クラス

DiscreteModel は、すべての離散回帰モデルのスーパークラスです。推定結果は、 DiscreteResults のサブクラスの1つのインスタンスとして返されます。モデルの各カテゴリ(バイナリ、カウント、多項)には、独自の中間レベルのモデルクラスと結果クラスがあります。この中間クラスは、主に DiscreteModelDiscreteResults で定義されたメソッドと属性の実装を容易にするためのものです。

DiscreteModel(endog, exog[, check_rank])

離散選択モデルの抽象クラス。

DiscreteResults(model, mlefit[, cov_type, ...])

離散従属変数モデルの結果クラス。

BinaryModel(endog, exog[, offset, check_rank])

属性:

BinaryResults(model, mlefit[, cov_type, ...])

二値データの結果クラス

CountModel(endog, exog[, offset, exposure, ...])

属性:

MultinomialModel(endog, exog[, offset, ...])

属性:

GenericZeroInflated(endog, exog[, ...])

汎用ゼロ膨張モデル


最終更新日: 2025年01月28日