ここでは、浜中によるロス『石油の呪い』表3.6の再現実験の確認を行う。

データの読み込み

load("Replication data for The Oil Curse - Ross 2012.RData")

浜中コードの確認

# パッケージの読み込み
library(dplyr)
# 1行目(すべての国、全時代)の分析
t.test(x$tta_SD[x$oil_gas_value100==0],
       x$tta_SD[x$oil_gas_value100==1],alternative="greater")
# 収入別グループ作成
tdl<-filter(x,gdpcap2000_sup<5000)# 低収入国
tdh<-filter(x,gdpcap2000_sup>5000)# 高収入国
# 3行目(高収入国)の分析
t.test(tdh$tta_SD[tdh$oil_gas_value100==0],
       tdh$tta_SD[tdh$oil_gas_value100==1],alternative="greater")
# 2行目(低収入国)の分析
t.test(tdl$tta_SD[tdl$oil_gas_value100==0],
       tdl$tta_SD[tdl$oil_gas_value100==1],alternative="greater")
# 時代別グループ作成
tdb80<-filter(x,year<1980)# 1980年より前
tda80<-filter(x,year>1979)# 1980年以降
# 4行目(1960-1979)の分析
t.test(tdb80$tta_SD[tdb80$oil_gas_value100==0],
       tdb80$tta_SD[tdb80$oil_gas_value100==1],
       alternative="greater")
# 5行目(1980-2008)の分析
t.test(tda80$tta_SD[tda80$oil_gas_value100==0],
       tda80$tta_SD[tda80$oil_gas_value100==1],
       alternative="greater")
# 6行目(収入と時代)の分析
# 1980年以降で低収入国の抽出
develop80<-filter(x,gdpcap2000_sup<5000 & year>1979)
# 検定
t.test(develop80$ttd_SD[develop80$oil_gas_value100==0],
       develop80$ttd_SD[develop80$oil_gas_value100==1],
       alternative="less")

浜中コードでは表の2行目と3行目の分析順序が入れ替わっている点に注意。また、これまでの浜中コードと同様に等分散を前提としていないため、ロスの分析結果の違いを生んでいる。

6行目の分析には“ttd_SD”が用いられているが、これは誤りである。“ttd_SD”は表3.1で使用した「民主主義への移行」を示す変数である(transition to democracyから来ている?)。表3.6は「権威主義体制への移行」であり、他の行と同様に、6行目でも“tta_SD”(transition to autocracyから来ている?)を使用するのが正しい。また、浜中コードの6行目の検定では下側片側検定になっているが、正しくは上側片側検定を行う。

1行目(すべての国、全時代)の確認


    Welch Two Sample t-test

data:  x$tta_SD[x$oil_gas_value100 == 0] and x$tta_SD[x$oil_gas_value100 == 1]
t = 1.3722, df = 1146.1, p-value = 0.08514
alternative hypothesis: true difference in means is greater than 0
95 percent confidence interval:
 -0.001445111          Inf
sample estimates:
 mean of x  mean of y 
0.01900133 0.01176471 

平均値はロスの分析と同じだが、p値が異なる。ロスの分析ではp値は0.1155であり、表の通り有意ではないと判断されるが、浜中コードではp値が0.08514であり、10%水準で有意になる。

等分散を前提とし、“t.test”のコードを変更すると、以下のようになる。

t.test(tta_SD~oil_gas_value100,data = x,
       alternative="greater",var.equal = T)

    Two Sample t-test

data:  tta_SD by oil_gas_value100
t = 1.198, df = 2856, p-value = 0.1155
alternative hypothesis: true difference in means is greater than 0
95 percent confidence interval:
 -0.002702839          Inf
sample estimates:
mean in group 0 mean in group 1 
     0.01900133      0.01176471 

これでロスの分析結果と一致する。

2行目(低収入国)の確認


    Welch Two Sample t-test

data:  tdl$tta_SD[tdl$oil_gas_value100 == 0] and tdl$tta_SD[tdl$oil_gas_value100 == 1]
t = 0.2488, df = 222.01, p-value = 0.4019
alternative hypothesis: true difference in means is greater than 0
95 percent confidence interval:
 -0.01982557         Inf
sample estimates:
 mean of x  mean of y 
0.03327787 0.02976190 

1行目と同様、等分散の点で浜中コード(p値0.4019)とロスの分析結果(0.4054)は異なる。これまでと同様に“t.test”の書式を変更し、等分散を前提としたものに浜中コードを書き換えると、以下のようになる。

t.test(tta_SD~oil_gas_value100,data = tdl,
       alternative="greater",var.equal = T)

    Two Sample t-test

data:  tta_SD by oil_gas_value100
t = 0.23933, df = 1368, p-value = 0.4054
alternative hypothesis: true difference in means is greater than 0
95 percent confidence interval:
 -0.02066517         Inf
sample estimates:
mean in group 0 mean in group 1 
     0.03327787      0.02976190 

これでロスの分析結果と一致する。

3行目(高収入国)の確認


    Welch Two Sample t-test

data:  tdh$tta_SD[tdh$oil_gas_value100 == 0] and tdh$tta_SD[tdh$oil_gas_value100 == 1]
t = -0.13315, df = 688.16, p-value = 0.5529
alternative hypothesis: true difference in means is greater than 0
95 percent confidence interval:
 -0.005249239          Inf
sample estimates:
  mean of x   mean of y 
0.002139037 0.002531646 

3行目は、平均値もp値も異なるので、等分散だけでなく、これまでと同様にSTATAとRのサンプルの処理が異なると想定される。なお、“t.test”の書式と等分散の等質性を変更したものは以下の通り。

t.test(tta_SD~oil_gas_value100,data =tdh,
       alternative="greater",var.eqal=TRUE)

    Welch Two Sample t-test

data:  tta_SD by oil_gas_value100
t = -0.13315, df = 688.16, p-value = 0.5529
alternative hypothesis: true difference in means is greater than 0
95 percent confidence interval:
 -0.005249239          Inf
sample estimates:
mean in group 0 mean in group 1 
    0.002139037     0.002531646 

4行目(1960-1979)の確認


    Welch Two Sample t-test

data:  tdb80$tta_SD[tdb80$oil_gas_value100 == 0] and tdb80$tta_SD[tdb80$oil_gas_value100 == 1]
t = 2.8648, df = 420.43, p-value = 0.002191
alternative hypothesis: true difference in means is greater than 0
95 percent confidence interval:
 0.01255662        Inf
sample estimates:
  mean of x   mean of y 
0.037037037 0.007462687 

表では5%水準で有意となっているが、浜中コードでは1%水準で有意となっている(p値は0.002191)。ロスの分析では、p値は0.0381である。これの違いはこれまでと同様に、等分散を前提としているか否かの違いである。等分散を前提とし、“t.test”のコードを以下の通り変更する。

t.test(tta_SD~oil_gas_value100,data = tdb80,
       alternative="greater",var.equal = T)

    Two Sample t-test

data:  tta_SD by oil_gas_value100
t = 1.7758, df = 834, p-value = 0.03807
alternative hypothesis: true difference in means is greater than 0
95 percent confidence interval:
 0.002149604         Inf
sample estimates:
mean in group 0 mean in group 1 
    0.037037037     0.007462687 

これでロスの分析結果と一致する。

5行目(1980-2008)の確認


    Welch Two Sample t-test

data:  tda80$tta_SD[tda80$oil_gas_value100 == 0] and tda80$tta_SD[tda80$oil_gas_value100 == 1]
t = -0.36002, df = 702.94, p-value = 0.6405
alternative hypothesis: true difference in means is greater than 0
95 percent confidence interval:
 -0.01184506         Inf
sample estimates:
 mean of x  mean of y 
0.01089045 0.01301518 

浜中コードで表と同じ結果が出るが、p値はロスの分析結果と異なる(浜中コードで0.6405、ロスの分析結果は 0.6472)。これまでと同様に、等分散を前提とするコードに(そして“t.test”のコードを)以下の通り修正する。

t.test(tta_SD~oil_gas_value100,data = tda80,
       alternative="greater",var.equal=T)

    Two Sample t-test

data:  tta_SD by oil_gas_value100
t = -0.37781, df = 2020, p-value = 0.6472
alternative hypothesis: true difference in means is greater than 0
95 percent confidence interval:
 -0.01137925         Inf
sample estimates:
mean in group 0 mean in group 1 
     0.01089045      0.01301518 

これでロスの分析結果と一致する。

6行目(収入と時代)の確認


    Two Sample t-test

data:  develop80$ttd_SD[develop80$oil_gas_value100 == 0] and develop80$ttd_SD[develop80$oil_gas_value100 == 1]
t = 2.1461, df = 1913, p-value = 0.984
alternative hypothesis: true difference in means is less than 0
95 percent confidence interval:
      -Inf 0.0349329
sample estimates:
 mean of x  mean of y 
0.03369272 0.01392111 

平均値が表と異なるが、これはすでに指摘した通り、変数に“ttd_SD”を指定しているためであり、正しくは“tta_SD”を指定する。等分散を前提とし、これまでと同様に“t.test”のコードを書き換えると、以下のようになる。

t.test(tta_SD~oil_gas_value100,data = develop80,
       alternative="greater",var.equal=T)

    Two Sample t-test

data:  tta_SD by oil_gas_value100
t = -1.1659, df = 1058, p-value = 0.878
alternative hypothesis: true difference in means is greater than 0
95 percent confidence interval:
 -0.03534055         Inf
sample estimates:
mean in group 0 mean in group 1 
     0.01868132      0.03333333 

これでロスの分析結果と一致する。