br002a - math-koubou.jp · ivregress 操作変数法による ... boxcox...
TRANSCRIPT
BR002A
Stata13 コマンド解説書
【基盤機能編】多彩な推定法
Stataには数多くの推定法が用意されています。本解説書では
• 操作変数法による推定機能• 順序変数/名義変数用推定機能
• 一般化線形モデル (GLM)
• 一般化モーメント法 (GMM)
等、代表的な推定法について機能と用例を記述しました。
目 次
コマンド whitepaperタイトル ページ mwp番号
boxcox Box-Cox回帰 5 mwp-187
clogit 条件付きロジスティック回帰 15 mwp-182
clogit post clogit - 推定後機能 33 mwp-183
cnsreg 制約付き線形回帰 36 mwp-179
glm 一般化線形モデル 41 mwp-163
glm post glm - 推定後機能 62 mwp-164
blogit/bprobit/ ロジスティック/プロビット回帰 66 mwp-186
glogit/gprobit (グループデータ)
gmm 一般化モーメント法 75 mwp-173
gmm post gmm - 推定後機能 132 mwp-174
intreg 区間回帰 137 mwp-161
intreg post intreg - 推定後機能 145 mwp-202
ivregress 操作変数法による回帰 151 mwp-082
ivregress post ivregress - 推定後機能 163 mwp-196
logit ロジスティック回帰 172 mwp-193
logit post logit - 推定後機能 177 mwp-194
mlogit 多項ロジスティック回帰 188 mwp-090
mprobit 多項プロビット回帰 206 mwp-091
コマンド whitepaperタイトル ページ mwp番号
nl 非線形最小 2 乗推定 220 mwp-178
nl post nl - 推定後機能 233 mwp-203
ologit 順序ロジスティック回帰 238 mwp-088
ologit post ologit - 推定後機能 255 mwp-198
oprobit 順序プロビット回帰 258 mwp-089
oprobit post oprobit - 推定後機能 271 mwp-199
poisson ポアソン回帰 274 mwp-087
poisson post poisson - 推定後機能 295 mwp-197
probit プロビット回帰 302 mwp-184
probit post probit - 推定後機能 312 mwp-185
qreg/iqreg/ 分位点回帰 316 mwp-162
sqreg/bsqreg
reg3 3段階最小 2乗法 338 mwp-099
reg3 post reg3 - 推定後機能 352 mwp-201
sureg 見かけ上無関係な回帰 359 mwp-098
sureg post sureg - 推定後機能 368 mwp-200
tobit Tobit回帰 372 mwp-159
tobit post tobit - 推定後機能 378 mwp-160
マニュアルコード
Stataの英文マニュアル中ではマニュアル参照に際し次のようなコードが用いられています。本解説書の中で
もこの慣行が踏襲されています。
コード マニュアル
[GSM] Getting Started with Stata for Mac
[GSU] Getting Started with Stata for Unix
[GSW] Getting Started with Stata for Windows
[U] Stata User’s Guide
[R] Stata Base Reference Manual
[D] Stata Data Management Reference Manual
[G] Stata Graphics Reference Manual
[XT] Stata Longitudinal-Data/Panel-Data Reference Manual
[ME] Stata Multilevel Mixed-Effects Reference Manual
[MI] Stata Multiple-Imputation Reference Manual
[MV] Stata Multivariate Statistics Reference Manual
[PSS] Stata Power and Sample-Size Reference Manual
[P] Stata Programming Reference Manual
[SEM] Stata Structural Equation Modeling Reference Manual
[SVY] Stata Survey Data Reference Manual
[ST] Stata Survival Analysis and Epidemiological Tables Reference Manual
[TS] Stata Time-Series Reference Manual
[TE] Stata Treatment-Effects Reference Manual:
Potential Outcomes/Counterfactual Outcomes
[I] Stata Glossary and Index
[M] Mata Reference Manual
本解説書は StataCorp社の許諾のもとに作成したものです。
c⃝ 2013 Math工房
一部 c⃝ 2013 StataCorp LP
Math工房 web: www.math-koubou.jp
email: [email protected]
Stata13 whitepapers
mwp-187
boxcox - Box-Cox回帰
boxcoxコマンドは最尤法により、Box-Cox変換を伴う回帰モデルのフィットを行います。
1. Box-Cox変換
2. Thetaモデル Example 1
3. Lambdaモデル
4. LHS-onlyモデル Example 2
5. RHS-onlyモデル Example 3
6. 推定後機能
c⃝ Copyright Math工房; 一部 c⃝ Copyright StataCorp LP (used with permission)
5
Stata13 whitepapers
mwp-182
clogit - 条件付きロジスティック回帰
clogitコマンドはマッチングの取れた症例対照群を対象にした条件付きロジスティック回帰を実行します。
これはパネルデータを対象にした固定効果ロジットモデルと等価なものでもあります。なお、関連する機能で
あるMcFaddenの選択モデルについては [R] asclogit を参照ください。
1. 条件付きロジスティック回帰 Example 1
2. マッチングの取れた症例対照データ Example 2
3. 重みの使用 Example 3
4. 固定効果ロジット Example 4
c⃝ Copyright Math工房; 一部 c⃝ Copyright StataCorp LP (used with permission)
6
Stata13 whitepapers
mwp-183
clogit postestimation - 推定後機能
clogitコマンド実行後に利用できる postestimation機能の一覧については [R] clogit postestimation の
セクション“Description”をご参照ください。本 whitepaperでは predictコマンドについて、その機能概要
と用例を紹介します。
1. predictコマンド Example 1
c⃝ Copyright Math工房; 一部 c⃝ Copyright StataCorp LP (used with permission)
7
Stata13 whitepapers
mwp-179
cnsreg - 制約付き線形回帰
cnsregコマンドは制約付き線形回帰モデルをフィットさせます。
1. cnsregの用例 Example 1
Example 2
2. 推定後機能
c⃝ Copyright Math工房; 一部 c⃝ Copyright StataCorp LP (used with permission)
8
Stata13 whitepapers
mwp-163
glm - 一般化線形モデル
glmは一般化線形モデルのフィットを行います。推定の手法としては IRLSと Newton-Raphson法が選択で
きます。
1. 一般化線形モデル
2. glmの用例 Example 1
Example 2
3. 分散推定法 Example 3
Example 4
4. ユーザ定義関数
c⃝ Copyright Math工房; 一部 c⃝ Copyright StataCorp LP (used with permission)
9
Stata13 whitepapers
mwp-164
glm postestimation - 推定後機能
glmコマンド実行後に利用できる postestimation機能の一覧については [R] glm postestimation のセク
ション“Description”をご参照ください。本 whitepaper では predict コマンドについてその用例を紹介し
ます。
1. predictコマンド Example 1
c⃝ Copyright Math工房; 一部 c⃝ Copyright StataCorp LP (used with permission)
10
Stata13 whitepapers
mwp-186
blogit/bprobit/glogit/gprobit - ロジスティック/プロビット回帰(グループデータ)
blogit/bprobitコマンドはグルーピングされたデータに対して、最尤法によるロジスティック/プロビット
モデルのフィットを行います。これに対し glogit/gprobitコマンドは同じくグルーピングされたデータに
対して、重み付き最小 2乗法によるロジスティック/プロビットモデルのフィットを行います。
1. blogit/bprobitコマンド Example 1
Example 2
2. glogit/gprobitコマンド Example 3
Example 4
3. 推定後機能
c⃝ Copyright Math工房; 一部 c⃝ Copyright StataCorp LP (used with permission)
11
Stata13 whitepapers
mwp-173
gmm - 一般化モーメント法
gmm は一般化モーメント法による推定を行います。モーメント方程式は数式として記述するのが一般的です
が、プログラムとして規定することも可能です。
1. 一般化モーメント法
2. Substitutable expressions Example 1
Example 2
3. 加重行列と 2段階推定 Example 3
4. 標準誤差の算出
5. 指数(ポアソン)回帰モデル Example 4
Example 5
Example 6
6. 導関数の指定 Example 7
Example 8
7. パネルデータに対する指数回帰モデル Example 9
Example 10
Example 11
8. 合理的期待モデル Example 12
9. システム推定法 Example 13
10. 動的パネルデータモデル Example 14
Example 15
Example 16
Example 17
11. モーメント評価プログラム詳細
c⃝ Copyright Math工房; 一部 c⃝ Copyright StataCorp LP (used with permission)
12
Stata13 whitepapers
mwp-174
gmm postestimation - 推定後機能
gmm コマンド実行後に利用できる postestimation 機能の一覧については [R] gmm postestimation のセ
クション“Description”をご参照ください。本 whitepaperでは gmmに固有の estat overidコマンドについ
てその機能と用例を紹介します。
1. estat overidコマンド Example 1
c⃝ Copyright Math工房; 一部 c⃝ Copyright StataCorp LP (used with permission)
13
Stata13 whitepapers
mwp-161
intreg - 区間回帰
intreg は区間回帰 (interval regression) の機能を提供するコマンドで、tobit([R] tobit (mwp-159 ) 参
照)の概念をより一般化したものと言えます。
1. 区間回帰
2. intregの用例 Example 1
c⃝ Copyright Math工房; 一部 c⃝ Copyright StataCorp LP (used with permission)
14
Stata13 whitepapers
mwp-202
intreg postestimation - 推定後機能
intreg コマンド実行後に利用できる postestimation 機能の一覧については [R] intreg postestimation
のセクション“Description”をご参照ください。本 whitepaperでは predict コマンドと margins コマンド
について、その機能概要と用例を紹介します。
1. 推定後機能 Example 1
c⃝ Copyright Math工房; 一部 c⃝ Copyright StataCorp LP (used with permission)
15
Stata13 whitepapers
mwp-082
ivregress - 操作変数法による線形回帰
説明変数が誤差項と相関を持つ場合、OLS推定量には不偏性も一致性も期待できなくなります。そのような
場合には操作変数を用いた推定が必要となります。
1. OLSの前提条件
2. OLS推定量の性質
3. 確率的説明変数
4. 操作変数法
5. 2段階最小 2乗法
6. ivregressの用例 Example 1
Example 2
Example 3
Example 4
c⃝ Copyright Math工房; 一部 c⃝ Copyright StataCorp LP (used with permission)
16
Stata13 whitepapers
mwp-196
ivregress postestimation - 推定後機能
ivregress コマンド実行後に利用できる postestimation 機能の一覧については [R] ivregress postes-
timation のセクション“Description”をご参照ください。本 whitepaper では ivregress に固有の機能で
ある
◦ estat endogenous
◦ estat firststage
◦ estat overid
について、その機能概要と用例を紹介します。
1. estat endogenous Example 1
Example 2
2. estat firststage Example 3
Example 4
3. estat overid Example 5
c⃝ Copyright Math工房; 一部 c⃝ Copyright StataCorp LP (used with permission)
17
Stata13 whitepapers
mwp-193
logit - ロジスティック回帰
logitコマンドはロジスティック回帰モデルのフィットを行います。なお、ロジスティック回帰の基本的な考
え方、及び logisticコマンドとの違いについては mwp-039 をご参照ください。
1. logitの用例 Example 1
2. モデル識別 Example 2
c⃝ Copyright Math工房; 一部 c⃝ Copyright StataCorp LP (used with permission)
18
Stata13 whitepapers
mwp-194
logit postestimation - 推定後機能
logitコマンド実行後に利用できる postestimation機能の一覧については [R] logit postestimation のセ
クション“Description”をご参照ください。本 whitepaperでは predict コマンドと margins コマンドの用
例について解説します。
1. predictコマンド Example 1
2. marginsコマンド Example 2
c⃝ Copyright Math工房; 一部 c⃝ Copyright StataCorp LP (used with permission)
19
Stata13 whitepapers
mwp-090
mlogit - 多項ロジスティック回帰
従属変数が名義変数であった場合、それのモデル化には通常、多項ロジスティック回帰 (multinomial logistic
regression) が用いられます。本 whitepaper では多項ロジスティック回帰の機能を提供する mlogit コマン
ドの機能概要と用法について説明します。
1. 多項回帰モデル
2. mlogitの用例 – 共変量のない場合
3. mlogitの用例 – 共変量が離散変数の場合
4. ベースアウトカムの変更
5. mlogitの用例 – 共変量が連続変数の場合
6. mlogitの用例
7. 推定後機能の用例
補足1
c⃝ Copyright Math工房; 一部 c⃝ Copyright StataCorp LP (used with permission)
20
Stata13 whitepapers
mwp-091
mprobit - 多項プロビット回帰
従属変数が名義変数であった場合、それのモデル化に多項プロビット回帰 (multinomial probit regression)
を用いることもできます。本 whitepaperでは多項プロビット回帰の機能を提供する mprobitコマンドの機
能概要と用法について説明します。同様の機能である多項ロジスティック回帰については mwp-090 をご参照
ください。
1. 多項プロビット回帰モデル
2. mprobitの用例 – 共変量のない場合
3. mprobitの用例 – 共変量が離散変数の場合
4. ベースアウトカムの変更
5. mprobitの用例 – 共変量が連続変数の場合
6. mprobitの用例
7. 推定後機能の用例
補足1
c⃝ Copyright Math工房; 一部 c⃝ Copyright StataCorp LP (used with permission)
21
Stata13 whitepapers
mwp-178
nl - 非線形最小 2乗推定
nlコマンドは任意の非線形回帰関数を最小 2乗法によりフィットさせます。
1. 置換可能数式 Example 1
2. 置換可能数式プログラム
3. 組込み関数
4. lnlsq()オプション
5. その他の用途
6. 重み
7. エラーへの対処
8. 収束上の問題
9. 関数評価プログラム
c⃝ Copyright Math工房; 一部 c⃝ Copyright StataCorp LP (used with permission)
22
Stata13 whitepapers
mwp-203
nl postestimation - 推定後機能
nlコマンド実行後に利用できる postestimation機能の一覧については [R] nl postestimation のセクショ
ン“Description”をご参照ください。本 whitepaperでは predict コマンドと margins コマンドについてそ
の用例を紹介します。
1. 推定後機能 Example 1
c⃝ Copyright Math工房; 一部 c⃝ Copyright StataCorp LP (used with permission)
23
Stata13 whitepapers
mwp-088
ologit - 順序ロジスティック回帰
従属変数が順序変数であった場合、それのモデル化には通常、順序ロジスティック回帰 (ordered logistic
regression) や順序プロビット回帰 (ordered probit regression) が用いられます。本 whitepaperでは順序ロ
ジスティック回帰の機能を提供する ologitコマンドの機能概要と用法について説明します。なお、順序プロ
ビット回帰については mwp-089 をご参照ください。
1. 順序回帰モデル
2. ologitの用例 – 共変量のない場合
3. ologitの用例 – 共変量が 1つの場合
4. logitとの対比
5. ologitの用例 Example 1
Example 2
c⃝ Copyright Math工房; 一部 c⃝ Copyright StataCorp LP (used with permission)
24
Stata13 whitepapers
mwp-198
ologit postestimation - 推定後機能
ologit コマンド実行後に利用できる postestimation 機能の一覧については [R] ologit postestimation
のセクション“Description”をご参照ください。本 whitepaperでは predictコマンドについて、その機能概
要と用例を紹介します。
1. predict Example 1
c⃝ Copyright Math工房; 一部 c⃝ Copyright StataCorp LP (used with permission)
25
Stata13 whitepapers
mwp-089
oprobit - 順序プロビット回帰
従属変数が順序変数であった場合、それのモデル化には通常、順序ロジスティック回帰 (ordered logistic
regression) や順序プロビット回帰 (ordered probit regression) が用いられます。本 whitepaperでは順序プ
ロビット回帰の機能を提供する oprobitコマンドの機能概要と用法について説明します。なお、順序ロジス
ティック回帰については mwp-088 をご参照ください。
1. 順序プロビット回帰モデル
2. oprobitの用例 – 共変量のない場合
3. oprobitの用例 – 共変量が 1つの場合
4. probitとの対比
5. oprobitの用例 Example 1
c⃝ Copyright Math工房; 一部 c⃝ Copyright StataCorp LP (used with permission)
26
Stata13 whitepapers
mwp-199
oprobit postestimation - 推定後機能
oprobitコマンド実行後に利用できる postestimation機能の一覧については [R] oprobit postestimation
のセクション“Description”をご参照ください。本 whitepaperでは predictコマンドについて、その機能概
要と用例を紹介します。
1. predict Example 1
c⃝ Copyright Math工房; 一部 c⃝ Copyright StataCorp LP (used with permission)
27
Stata13 whitepapers
mwp-087
poisson - ポアソン回帰
従属変数がある事象の発生回数を表すカウントデータであった場合、それのモデル化には通常ポアソン回
帰(poisson regression) が用いられます。本 whitepaper では poisson コマンドの機能概要と用法について
説明します。なお、よりバラツキの大きいモデルをフィットさせたい場合には負の二項分布回帰 (negative
binomial regression) を選択する方法もあります。nbregコマンドについては [R] nbreg をご参照ください。
1. ポアソン分布
2. ポアソン回帰
3. 実験 1 – 共変量なしのケース
4. 実験 2 – 単一共変量のケース
5. exposure()オプション
6. poissonの用例 Example 1
Example 2
補足1
補足2
c⃝ Copyright Math工房; 一部 c⃝ Copyright StataCorp LP (used with permission)
28
Stata13 whitepapers
mwp-197
poisson postestimation - 推定後機能
poissonコマンド実行後に利用できる postestimation機能の一覧については [R] poisson postestimation
のセクション“Description”をご参照ください。本whitepaperでは poissonに固有の機能である estat gof
について、その機能概要と用例を紹介します。
1. estat gof Example 1
c⃝ Copyright Math工房; 一部 c⃝ Copyright StataCorp LP (used with permission)
29
Stata13 whitepapers
mwp-184
probit - プロビット回帰
probitコマンドは最尤法によりプロビットモデルのフィットを行います。グルーピングされたデータを対象
とする場合には bprobitコマンドを使用してください([R] glogit (mwp-186 ) 参照)。
1. プロビット回帰モデル Example 1
2. ロバストな標準誤差 Example 2
Example 3
3. モデル識別 Example 4
c⃝ Copyright Math工房; 一部 c⃝ Copyright StataCorp LP (used with permission)
30
Stata13 whitepapers
mwp-185
probit postestimation - 推定後機能
probit コマンド実行後に利用できる postestimation 機能の一覧については [R] probit postestimation
のセクション“Description”をご参照ください。本 whitepaperでは predictコマンドについて、その機能概
要と用例を紹介します。
1. predictコマンド Example 1
c⃝ Copyright Math工房; 一部 c⃝ Copyright StataCorp LP (used with permission)
31
Stata13 whitepapers
mwp-162
qreg/iqreg/sqreg/bsqreg - 分位点回帰
qregは中央値回帰の機能を含む分位点回帰 (quantile regression) モデルのフィットを行います。本 white-
paperでは qregの系統に属する iqreg/sqreg/bsqregコマンドの機能、用法についても解説します。
1. 中央値回帰 Example 1
Example 2
2. 一般的な分位点回帰 Example 3
3. bsqregの用例 Example 4
4. iqreg, sqregの用例 Example 5
5. パラメータの意味
6. 推定後機能の用例
補足1
c⃝ Copyright Math工房; 一部 c⃝ Copyright StataCorp LP (used with permission)
32
Stata13 whitepapers
mwp-099
reg3 - 3段階最小 2乗法
reg3は説明変数中に内生変数を含む多変量線形回帰モデルに対し 3段階最小 2乗法 (3SLS: three-stage least
squares) を適用し、モデルのフィットを行います。
1. 3段階最小 2乗法
2. reg3の用例 Example 1
Example 2
Example 3
Example 4
c⃝ Copyright Math工房; 一部 c⃝ Copyright StataCorp LP (used with permission)
33
Stata13 whitepapers
mwp-201
reg3 postestimation - 推定後機能
reg3コマンド実行後に利用できる postestimation機能の一覧については [R] reg3 postestimation のセ
クション“Description”をご参照ください。本 whitepaperでは predictコマンド、及び Stata13で新たにサ
ポートされた forecastコマンドについて、その用例を紹介します。
1. predictコマンド Example 1
2. forecastコマンド Example 2
c⃝ Copyright Math工房; 一部 c⃝ Copyright StataCorp LP (used with permission)
34
Stata13 whitepapers
mwp-098
sureg - 見かけ上無関係な回帰
suregは多変量線形回帰モデルに対し、見かけ上無関係な回帰 (SUR: seemingly unrelated regression) 機能
を提供します。説明変数中に内生変数が含まれる場合には reg3コマンド([R] reg3 (mwp-099 ) 参照)を使
用する必要があります。
1. SUR回帰
2. suregの用例 Example 1
Example 2
c⃝ Copyright Math工房; 一部 c⃝ Copyright StataCorp LP (used with permission)
35
Stata13 whitepapers
mwp-200
sureg postestimation - 推定後機能
suregコマンド実行後に利用できる postestimation機能の一覧については [R] sureg postestimation の
セクション“Description”をご参照ください。本 whitepaperでは predictコマンドについて、その機能概要
と用例を紹介します。
1. predictコマンド Example 1
Example 2
c⃝ Copyright Math工房; 一部 c⃝ Copyright StataCorp LP (used with permission)
36
Stata13 whitepapers
mwp-159
tobit - Tobit回帰
tobitは従属変数の値が左打切りや右打切りを伴う場合に線形回帰モデルのフィットを行います。
1. Tobit回帰
2. tobitの用例 Example 1
Example 2
Example 3
c⃝ Copyright Math工房; 一部 c⃝ Copyright StataCorp LP (used with permission)
37
Stata13 whitepapers
mwp-160
tobit postestimation - 推定後機能
tobitコマンド実行後に利用できる postestimation機能の一覧については [R] tobit postestimation の
セクション“Description”をご参照ください。本 whitepaper では margins コマンドの用例について解説し
ます。
1. 限界効果
2. marginsの用例 Example 1
c⃝ Copyright Math工房; 一部 c⃝ Copyright StataCorp LP (used with permission)
38