離散従属変数を持つ回帰分析

限定従属変数と質的従属変数のための回帰モデル。このモジュールは現在、二値(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:                Thu, 03 Oct 2024   Pseudo R-squ.:                  0.3740
Time:                        16:08:45   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])

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

具体的な結果クラスは次のとおりです。

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

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

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[, ...])

切断ポアソン分布の結果クラス

TruncatedNegativeBinomialResults(model, mlefit)

切断負の二項分布の結果クラス

ConditionalResults(model, params, ...)

属性:

OrderedResults(model, mlefit)

順序モデルの結果クラス

DiscreteModelは、すべての離散回帰モデルのスーパークラスです。DiscreteResultsのサブクラスのインスタンスとして推定結果が返されます。二値、計数、多項の各カテゴリのモデルには、それぞれ独自のモデルと結果クラスの中間レベルがあります。この中間クラスは、主に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[, ...])

一般的なゼロ過剰モデル


最終更新日: 2024年10月3日