* log using "OPEC.log", replace * set more off * use http://www.bol.ucla.edu/~blaydes/OPECFINAL.DTA, clear use http://www.people.fas.harvard.edu/~goodrich/Research/PE/OPEC.dta, clear drop if year == . tsset cnum year, yearly gen interact=saudi_dummy*post1986 * Table 1 Model 3 * Replication of OLS results xtpcse lgcrdprd lprres lcapita sqlcapita l.crdprd estimates store t1m3 * The error is that lgcrdprd is logged and l.crdprd is not * Model 3 was intended to be xtpcse lgcrdprd lprres lcapita sqlcapita l.lgcrdprd estimates store t1m3implied * Table 1 Model 6 * Replication of OLS results xtpcse lgcrdprd lprres lcapita sqlcapita lgcrdprd_1 saudi_dummy post1986 interact estimates store t1m6 * The error is that lgcrdprd_1 was created when the data were not sorted * To see run the following command * list country year lgcrdprd l.lgcrdprd lgcrdprd_1 if country=="Algeria" * Model 6 was intended to be xtpcse lgcrdprd lprres lcapita sqlcapita l.lgcrdprd saudi_dummy post1986 interact estimates store t1m6implied * Table 1 Model 8 * Replication of OLS results xtpcse lgcrdprd lprres unstable lgcrdprd_1 estimates store t1m8 * Again lgrcdprd_1 was created when the data were not sorted * Also unstable is misinterpreted as indicating a regime transition in year t * To see run the following command list country year unstable sttr if country == "Nigeria" | country == "Venezuela" * Model 8 was intended to be gen unstable2 = d.sttr replace unstable2 = 0 if unstable == . * This fixes the LDV and unstable xtpcse lgcrdprd lprres unstable2 l.lgcrdprd if unstable !=. estimates store t1m8implied * Table 1 Model 12 * Model 12 is not replicatable * The numbers are close but not identical to this model xtpcse lgcrdprd lprres sttr sqsttr lgcrdprd_1 estimates store t1m12 * The error is that the data were not sorted when lcrdprd_1 was created * Model 12 implies this model: xtpcse lgcrdprd lprres sttr sqsttr l.lgcrdprd estimates store t1m12implied * This is MY table 1 estimates table t1*, stats( N r2 ) b(%10.3f) se(%10.3f) stfmt(%10.3g) style(nolines) * The code for table 2 is below; it needs some estimates from table 3 * Table 3 Model 3 revised * Between estimator (sqlcapita is excluded) xtreg lgcrdprd lprres lcapita, be estimates store t3m3be */ This creates fixed effects for each country (except one) xi i.country * A fixed effects estimator xtpcse lgcrdprd lprres lcapita sqlcapita l.lgcrdprd _I* estimates store t3m3fe1 */ This makes dummy variables for various events gen D_iran_revolution = 1 if year == 1979 & country == "Iran" replace D_iran_revolution =0 if D_iran_revolution == . gen D_iran_iraq_war = 1 if year > 1979 & year < 1989 & (country == "Iran" | country == "Iraq") replace D_iran_iraq_war = 0 if D_iran_iraq_war ==. gen D_persian_gulf_war = 1 if year > 1989 & year < 1992 & (country == "Iraq" | country == "Kuwait") replace D_persian_gulf_war = 0 if D_persian_gulf_war ==. gen D_iraq_sanctions = 1 if year > 1990 & country == "Iraq" replace D_iraq_sanctions = 0 if D_iraq_sanctions ==. * This creates fixed effects for each year (except one) xi I.year, prefix(_Y) * Dropping the 1986 variable and adding a 1960 variable makes interpretation easier drop _Yyear_1986 gen _Yyear_1960 = 1 if year == 1960 replace _Yyear_1960 = 0 if year > 1960 * The _Yyear_1960 is not used in models with lagged dependent variables * A fixed effects estimator with these four world event dummy variables and year dummy variables xtpcse lgcrdprd lprres lcapita sqlcapita l.lgcrdprd D* _I* _Yyear_1961-_Yyear_1995 estimates store t3m3fe2 * Table 3 Model 6 revised * A fixed effects estimator xtpcse lgcrdprd lprres lcapita sqlcapita l.lgcrdprd saudi_dummy post1986 interact _I* estimates store t3m6fe1 * A fixed effects estimator with the four world event dummy variables and year dummy variables xtpcse lgcrdprd lprres lcapita sqlcapita l.lgcrdprd saudi_dummy interact D* _I* _Yyear_1961-_Yyear_1995 estimates store t3m6fe2 * This is MY table 3 estimates table t3*, stats( N r2 ) b(%10.3f) se(%10.3f) stfmt(%10.3g) style(nolines) * This is MY table 2 estimates restore t1m6implied nlcom (LongRun1: (_b[interact] - _b[post1986]) / (1 - _b[l.lgcrdprd])) estimates restore t3m6fe1 nlcom (LongRun2: (_b[interact] - _b[post1986]) / (1 - _b[l.lgcrdprd])) estimates restore t3m6fe2 nlcom (LongRun3: (9*_b[interact] - _b[_Yyear_1987] - _b[_Yyear_1988] - _b[_Yyear_1989] - _b[_Yyear_1990] - _b[_Yyear_1991] - _b[_Yyear_1992] - _b[_Yyear_1993] - _b[_Yyear_1994] - _b[_Yyear_1995] ) / (9 - 9*_b[l.lgcrdprd])) * Stuff that does not appear in the paper * Model 1 uses OLS rather than GLS * Replication of OLS results xtpcse lgcrdprd lprres lcapita * Switch to GLS as in Beck and Katz 1995 (but not 1996) xtpcse lgcrdprd lprres lcapita, correlation(ar1) * Stata does not handle fixed effects correctly in GLS * Residuals are NOT mean zero for each country xtpcse lgcrdprd lprres lcapita _I*, correlation(ar1) * This produces the right coefficients, but not PCSEs xtregar lgcrdprd lprres lcapita, fe rhotype(regress) lbi * If you move the residuals, the RHS matrix, and cnum into R, * This function will calculate PCSEs * Hacked from a better version by Simon Jackman * pcse <- function(e = residuals, X = RHS_matrix, group = cnum){ * id <- unique(group) * n <- length(id) * J <- length(e)/n * u <- matrix(NA,J,n) * for(i in 1:n){ * u[,i] <- e[group==id[i]] * } * Sigma <- crossprod(u)/J ## MLE * k <- dim(X)[2] * V1 <- matrix(0,k,k) * V2 <- matrix(0,k,k) * for(i in 1:n){ ## loop over units * oki <- group==id[i] * V1 <- V1 + crossprod(X[oki,]) ## accumulate x-products * for(j in 1:n){ ## loop again for correlations * okj <- group==id[j] * V2 <- V2 + (Sigma[i,j] * t(X[oki,])%*%X[okj,]) ## the "middle matrix" * } * } * iV1 <- solve(V1) * V <- iV1%*%V2%*%iV1 * print("Here are the PCSEs: \n") * print(sqrt(diag(V))) * V * } * Model 2 uses OLS rather than GLS * Replication of OLS results xtpcse lgcrdprd lprres lcapita sqlcapita * Swith to GLS as in Beck and Katz 1995 (but not 1996) xtpcse lgcrdprd lprres lcapita sqlcapita, correlation(ar1) * Stata does not handle fixed effects correctly in GLS * Residuals are NOT mean zero for each country xtpcse lgcrdprd lprres lcapita sqlcapita _I*, correlation(ar1) * This produces the right coefficients, but not PCSEs * See above for pcse function in R xtregar lgcrdprd lprres lcapita sqlcapita, fe rhotype(regress) lbi * Model 3 is in MY table 1 * Model 4 uses OLS rather than GLS * Replication of OLS results xtpcse lgcrdprd lprres saudi_dummy post1986 interact * Switch to GLS as in Beck and Katz 1995 (but not 1996) xtpcse lgcrdprd lprres saudi_dummy post1986 interact, correlation(ar1) *Stata does not handle fixed effects correctly in GLS * Residuals are NOT mean zero for each country xtpcse lgcrdprd lprres saudi_dummy post1986 interact _I*, correlation(ar1) * This produces the right coefficients, but not PCSEs * See above for the pcse function in R xtregar lgcrdprd lprres post1986 interact, fe rhotype(regress) lbi * Model 5 uses the unsorted lagged dependent variable * Replication of OLS results xtpcse lgcrdprd lprres lgcrdprd_1 saudi_dummy post1986 interact * Model 5 implies this model: xtpcse lgcrdprd lprres l.lgcrdprd saudi_dummy post1986 interact * A fixed effects version of Model 5: xtpcse lgcrdprd lprres l.lgcrdprd saudi_dummy post1986 interact _I* * Model 6 is in MY table 1 * Model 7 uses OLS rather than GLS * Replication of OLS results xtpcse lgcrdprd lprres unstable * The unstable variable was misinterpreted; switch to unstable2 xtpcse lgcrdprd lprres unstable2 if unstable !=. * Switch to GLS as in Beck and Katz 1995 (but not 1996) xtpcse lgcrdprd lprres unstable2 if unstable !=., correlation(ar1) *Stata does not handle fixed effects correctly in GLS * Residuals are NOT mean zero for each country xtpcse lgcrdprd lprres unstable2 _I* if unstable !=., correlation(ar1) * This produces the right coefficients, but not PCSEs * See above for the pcse function in R xtregar lgcrdprd lprres unstable2 if unstable !=., fe rhotype(regress) lbi * Model 8 is in MY table 1 * Model 9 uses OLS rather than GLS * Replication of OLS results xtpcse lgcrdprd lprres sttr * Switch to GLS as in Beck and Katz 1995 (but not 1996) xtpcse lgcrdprd lprres sttr, correlation(ar1) * Stata does not handle fixed effects correctly in GLS * Residuals are NOT mean zero for each country xtpcse lgcrdprd lprres sttr _I*, correlation(ar1) * This produces the right coefficients, but not PCSEs * See above for the pcse function in R xtregar lgcrdprd lprres sttr, fe rhotype(regress) lbi * Model 10 uses OLS rather than GLS * Replication of OLS results xtpcse lgcrdprd lprres sttr sqsttr * Switch to GLS as in Beck and Katz 1995 (but not 1996) xtpcse lgcrdprd lprres sttr sqsttr, correlation(ar1) * Stata does not handle fixed effects correctly in GLS * Residuals are NOT mean zero for each country xtpcse lgcrdprd lprres sttr sqsttr _I*, correlation(ar1) * This produces the right coefficients, but not PCSEs * See above for the pcse function in R xtregar lgcrdprd lprres sttr sqsttr, fe rhotype(regress) lbi * Model 11 uses the unsorted lagged dependent variable * Replication of OLS results xtpcse lgcrdprd lprres sttr lgcrdprd_1 * Model 11 implies this model: xtpcse lgcrdprd lprres sttr l.lgcrdprd * A fixed effects version of Model 11: xtpcse lgcrdprd lprres sttr l.lgcrdprd _I* * Model 12 is in MY table 1 * Do all the above again, adding the four world event dummies (D*) and year dummies (_Y*) * Model 1 with OLS (for reference) xtpcse lgcrdprd lprres lcapita D* _Y* * Switch to GLS as in Beck and Katz 1995 (but not 1996) xtpcse lgcrdprd lprres lcapita D* _Y*, correlation(ar1) * Stata does not handle fixed effects correctly in GLS * Residuals are NOT mean zero for each country xtpcse lgcrdprd lprres lcapita D* _I* _Yyear_1961-_Yyear_1995, correlation(ar1) * This produces the right coefficients, but not PCSEs xtregar lgcrdprd lprres lcapita D* _Yyear_1961-_Yyear_1995, fe rhotype(regress) lbi * Model 2 with OLS (for reference) xtpcse lgcrdprd lprres lcapita sqlcapita D* _Y* * Swith to GLS as in Beck and Katz 1995 (but not 1996) xtpcse lgcrdprd lprres lcapita sqlcapita D* _Y*, correlation(ar1) * Stata does not handle fixed effects correctly in GLS * Residuals are NOT mean zero for each country xtpcse lgcrdprd lprres lcapita sqlcapita D* _I* _Yyear_1961-_Yyear_1995, correlation(ar1) * This produces the right coefficients, but not PCSEs * See above for pcse function in R xtregar lgcrdprd lprres lcapita sqlcapita D* _Yyear_1961-_Yyear_1995, fe rhotype(regress) lbi * Model 3 xtpcse lgcrdprd lprres lcapita sqlcapita l.lgcrdprd D* _Y* * Model 4 with OLS (for reference) xtpcse lgcrdprd lprres saudi_dummy interact D* _Y* * Switch to GLS as in Beck and Katz 1995 (but not 1996) xtpcse lgcrdprd lprres saudi_dummy interact D* _Y*, correlation(ar1) *Stata does not handle fixed effects correctly in GLS * Residuals are NOT mean zero for each country xtpcse lgcrdprd lprres saudi_dummy interact D* _I* _Yyear_1961-_Yyear_1995, correlation(ar1) * This produces the right coefficients, but not PCSEs * See above for the pcse function in R xtregar lgcrdprd lprres interact D* _Yyear_1961-_Yyear_1995, fe rhotype(regress) lbi * Model 5 with OLS (for reference) xtpcse lgcrdprd lprres l.lgcrdprd saudi_dummy interact D* _Y* * A fixed effects version of Model 5: xtpcse lgcrdprd lprres l.lgcrdprd saudi_dummy interact _I* D* _Yyear_1961-_Yyear_1995 * Model 6 xtpcse lgcrdprd lprres lcapita sqlcapita l.lgcrdprd saudi_dummy interact D* _Y* * Model 7 with OLS (for reference) xtpcse lgcrdprd lprres unstable2 D* _Y* if unstable !=. * Switch to GLS as in Beck and Katz 1995 (but not 1996) xtpcse lgcrdprd lprres unstable2 D* _Y* if unstable !=., correlation(ar1) *Stata does not handle fixed effects correctly in GLS * Residuals are NOT mean zero for each country xtpcse lgcrdprd lprres unstable2 D* _I* _Yyear_1961-_Yyear_1995 if unstable !=., correlation(ar1) * This produces the right coefficients, but not PCSEs * See above for the pcse function in R xtregar lgcrdprd lprres unstable2 D* _Yyear_1961-_Yyear_1995 if unstable !=., fe rhotype(regress) lbi * Model 8 xtpcse lgcrdprd lprres unstable2 l.lgcrdprd D* _Y* if unstable !=. * Model 9 with OLS (for reference) xtpcse lgcrdprd lprres sttr D* _Y* * Switch to GLS as in Beck and Katz 1995 (but not 1996) xtpcse lgcrdprd lprres sttr D* _Y*, correlation(ar1) * Stata does not handle fixed effects correctly in GLS * Residuals are NOT mean zero for each country xtpcse lgcrdprd lprres sttr D* _I* _Yyear_1961-_Yyear_1995, correlation(ar1) * This produces the right coefficients, but not PCSEs * See above for the pcse function in R xtregar lgcrdprd lprres sttr D* _Yyear_1961-_Yyear_1995, fe rhotype(regress) lbi * Model 10 with OLS (for reference) xtpcse lgcrdprd lprres sttr sqsttr D* _Y* * Switch to GLS as in Beck and Katz 1995 (but not 1996) xtpcse lgcrdprd lprres sttr sqsttr D* _Y*, correlation(ar1) * Stata does not handle fixed effects correctly in GLS * Residuals are NOT mean zero for each country xtpcse lgcrdprd lprres sttr sqsttr D* _I* _Yyear_1961-_Yyear_1995, correlation(ar1) * This produces the right coefficients, but not PCSEs * See above for the pcse function in R xtregar lgcrdprd lprres sttr sqsttr D* _Yyear_1961-_Yyear_1995, fe rhotype(regress) lbi * Model 11 xtpcse lgcrdprd lprres sttr l.lgcrdprd D* _Y* * A fixed effects version of Model 11: xtpcse lgcrdprd lprres sttr l.lgcrdprd D* _I* _Yyear_1961-_Yyear_1995 * Model 12 xtpcse lgcrdprd lprres sttr sqsttr l.lgcrdprd D* _Y* * Check the fixed effects models for autocorrelation * using the LM test in Beck and Katz 1996 estimates restore t3m3fe1 predict xb if e(sample) gen res = lgcrdprd-xb gen l_res = l.res replace l_res = 0 if l_res ==. & res !=. xtpcse res l_res lprres lcapita sqlcapita l.lgcrdprd _I* * Autocorrelation is substantial but not that precise here drop xb res l_res estimates restore t3m3fe2 predict xb if e(sample) gen res = lgcrdprd-xb gen l_res = l.res replace l_res = 0 if l_res ==. & res !=. xtpcse res l_res lprres lcapita sqlcapita l.lgcrdprd D* _I* * Autocorrelation is substantial but not that precise here drop xb res l_res estimates restore t3m6fe1 predict xb if e(sample) gen res = lgcrdprd-xb gen l_res = l.res replace l_res = 0 if l_res ==. & res !=. xtpcse res l_res lprres lcapita sqlcapita l.lgcrdprd saudi_dummy post1986 interact _I* * Autocorrelation is substantial but not that precise here drop xb res l_res estimates restore t3m6fe2 predict xb if e(sample) gen res = lgcrdprd-xb gen l_res = l.res replace l_res = 0 if l_res ==. & res !=. xtpcse res l_res lprres lcapita sqlcapita l.lgcrdprd saudi_dummy post1986 interact D* _I* * Autocorrelation is substantial but not that precise here * To do all this properly, we need to test the ARDL(1,1) model * recommended in Beck and Katz 1996 which nests GLS and LDV * Goodrich 2005 shows the general model is only sensible with fixed effects * Make lagged variables gen l_lgcrdprd = l.lgcrdprd gen l_lprres = l.lprres gen l_lcapita = l.lcapita gen l_sqlcapita = l.sqlcapita * Investigation for table 3, first FE model xtpcse lgcrdprd lprres lcapita sqlcapita l_* _I* * Can't support partial adjustment model testparm l_lprres l_lcapita l_sqlcapita * Can't support GLS either testnl (_b[l_lprres] = -1*_b[l_lgcrdprd]*_b[lprres]) (_b[l_lcapita] = -1*_b[l_lgcrdprd]*_b[lcapita]) (_b[l_sqlcapita] = -1*_b[l_lgcrdprd]*_b[sqlcapita]), mtest(noadjust) * But the results from the general model do not support Blaydes hypothesis lincom lcapita + l_lcapita * Investigation for table 3, second FE model xtpcse lgcrdprd lprres lcapita sqlcapita l_* D* _I* * Can't support partial adjustment model testparm l_lprres l_lcapita l_sqlcapita * Can't support GLS either testnl (_b[l_lprres] = -1*_b[l_lgcrdprd]*_b[lprres]) (_b[l_lcapita] = -1*_b[l_lgcrdprd]*_b[lcapita]) (_b[l_sqlcapita] = -1*_b[l_lgcrdprd]*_b[sqlcapita]), mtest(noadjust) * But the results from the general model do not support Blaydes hypothesis lincom lcapita + l_lcapita * Investigation for table 3, third FE model xtpcse lgcrdprd lprres lcapita sqlcapita l_* saudi_dummy post1986 interact _I* * Can't support partial adjustment model testparm l_lprres l_lcapita l_sqlcapita * Can't support GLS either testnl (_b[l_lprres] = -1*_b[l_lgcrdprd]*_b[lprres]) (_b[l_lcapita] = -1*_b[l_lgcrdprd]*_b[lcapita]) (_b[l_sqlcapita] = -1*_b[l_lgcrdprd]*_b[sqlcapita]), mtest(noadjust) * The results from the general model support Blaydes' hypothesis weakly nlcom (LongRun4: (_b[interact] - _b[post1986]) / (1 - _b[l_lgcrdprd])) * Investigation for table 3, fourth FE model xtpcse lgcrdprd lprres lcapita sqlcapita l_* saudi_dummy post1986 interact D* _I* * Can't support partial adjustment model testparm l_lprres l_lcapita l_sqlcapita * Can't support GLS either testnl (_b[l_lprres] = -1*_b[l_lgcrdprd]*_b[lprres]) (_b[l_lcapita] = -1*_b[l_lgcrdprd]*_b[lcapita]) (_b[l_sqlcapita] = -1*_b[l_lgcrdprd]*_b[sqlcapita]), mtest(noadjust) * The results from the general model support Blaydes' hypothesis weakly nlcom (LongRun5: (_b[interact] - _b[post1986]) / (1 - _b[l_lgcrdprd])) * Other investigations * Make lagged unstable2 gen l_unstable2 = l.unstable2 xtpcse lgcrdprd lprres lcapita unstable2 l_lgcrdprd l_lprres l_lcapita l_unstable2 D* _I* if unstable !=. * Could support partial adjustment model testparm l_lprres l_lcapita l_unstable2 * Could support GLS as well testnl (_b[l_lprres] = -1*_b[l_lgcrdprd]*_b[lprres]) (_b[l_lcapita] = -1*_b[l_lgcrdprd]*_b[lcapita]) (_b[l_unstable2] = -1*_b[l_lgcrdprd]*_b[unstable2]), mtest(noadjust) * But the results are not supportive of Blaydes' hypothesis either way * Make lagged variables gen l_sttr = l.sttr gen l_sqsttr = l.sqsttr xtpcse lgcrdprd lprres lcapita sttr sqsttr l_lgcrdprd l_lprres l_lcapita l_sttr l_sqsttr D* _I* if unstable !=. * Could support partial adjustment model testparm l_lprres l_sttr l_sqsttr * Could support GLS as well testnl (_b[l_lprres] = -1*_b[l_lgcrdprd]*_b[lprres]) (_b[l_lcapita] = -1*_b[l_lgcrdprd]*_b[lcapita]) (_b[l_sttr] = -1*_b[l_lgcrdprd]*_b[sttr]) (_b[l_sqsttr] = -1*_b[l_lgcrdprd]*_b[sqsttr]), mtest(noadjust) * But the results from either model do not support Blaydes hypothesis * log close