-------------------------------------------------------------------------------
help: r2reg3                                                        dialog: r2r
> eg3
-------------------------------------------------------------------------------

+-------+ ----+ Title +------------------------------------------------------------

r2reg3: Overall System R2 - Adjusted R2 - F Test - Chi2 Test

+--------+ ----+ Syntax +-----------------------------------------------------------

r2reg3

+-------------+ ----+ Description +------------------------------------------------------

r2reg3 computes overall system R-squared (R2), Adjusted R2, and the overall significance of F-Test, and Chi2-Test, after: - (3SLS) Three-Stage Least Squares reg3 for systems of simultaneous equations. - (SUR) Seemingly Unrelated Regression sureg for sets of equations.

r2reg3 used Four types of criteria and tests, as discussed in: McElroy(1977), Judge et al(1985), Dhrymes(1974), Greene(1993), and Berndt(1991). see eq.12.1.33-36 in Judge et al(1985, p.477).

1- Berndt System R2 = 1-|E'E| / |Yb'Yb| 2- McElroy System R2 = 1-(U'W*U)/ (Y'W*Y) 3- Judge System R2 = 1-(U'U) / (Y'Y) Q 4- Dhrymes System R2 = Sum [R2i (yi' Dt yi']/[Y(I(Q) # Dt)Y] i=1 5- Greene System R2 = 1-(Q/trace(inv(Sig))*SYs)

Judge and Dhrymes are identical results.

From each type of these system R2's, r2reg3 can calculate Adjusted R2, F-Test, and Chi2-Test:

Adjusted R2 = 1-(1-R2)*((QN-Q)/(QN-K)) F-Test = R2/(1-R2)*[(QN-K)/(K-Q)] Chi2-Test = -N*(log(1-R2))

where |E'E| = determinant of residual matrix (NxQ) |Yb'Yb| = determinant of dependent variables matrix in deviation from mean (Nx > Q) yi = dependent variable of eq. i (Nx1) Y = stacked vector of dependent variables (QNx1) U = stacked vector of residuals (QNx1) W = variance-covariance matrix of residuals (W=inv(Omega) # I(N)) N = number of observations K = Number of Parameters Q = Number of Equations R2i = R2 of eq. i Dt = I(N)-JJ'/N, with J=(1,1,...,1)' (Nx1) SYs = (Yb1*Yb2*...Ybq)/N Sig = Sigma hat Matrix Degrees of Freedom F-Test = (K-Q), (QN) Degrees of Freedom Chi2-Test = (K-Q) Log Determinant of Sigma = log|Sigma matrix| Log Likelihood Function LLF =-(N*Q/2)*(1+log(2*_pi))-(N/2*abs(log(Sigma)))

+---------------+ ----+ Saved Results +----------------------------------------------------

r2reg3 saves the following in r():

Scalars r(N) Number of Observations r(k) Number of Parameters r(k_eq) Number of Equations r(chi_df) DF chi-squared r(f_df1) F-Test DF1 Numerator r(f_df2) F-Test DF2 Denominator r(r2_b) Berndt R-squared r(r2_j) Judge R-squared r(r2_m) McElroy R-squared r(r2_d) Dhrymes R-squared r(r2_g) Greene R-squared r(r2a_b) Berndt Adjusted R-squared r(r2a_j) Judge Adjusted R-squared r(r2a_m) McElroy Adjusted R-squared r(r2a_d) Dhrymes Adjusted R-squared r(r2a_g) Greene Adjusted R-squared r(f_b) Berndt F Test r(f_j) Judge F Test r(f_m) McElroy F Test r(f_d) Dhrymes F Test r(f_g) Greene F Test r(chi_b) Berndt Chi2 Test r(chi_j) Judge Chi2 Test r(chi_m) McElroy Chi2 Test r(chi_d) Dhrymes Chi2 Test r(chi_g) Greene Chi2 Test r(lsig2) Log Determinant of Sigma r(llf) Log Likelihood Function

+----------+ ----+ Examples +---------------------------------------------------------

clear all

sysuse r2reg3.dta , clear

* (1) SUR Model:

sureg (y1 y2 x1 x2) (y2 y1 x3 x4)

r2reg3

return list

* (2) 3SLS Model:

reg3 (y1 y2 x1 x2) (y2 y1 x3 x4) , exog(x1 x2 x3 x4)

r2reg3

return list

* If you want to use dialog box: Press OK to compute r2reg3

db r2reg3

. sysuse r2reg3.dta , clear . reg3 (y1 y2 x1 x2) (y2 y1 x3 x4) , exog(x1 x2 x3 x4) . r2reg3

======================================================== * Overall System R2 - Adjusted R2 - F Test - Chi2 Test * ======================================================== +---------------------------------------------------------------------------- > + | Name | R2 | Adj_R2 | F | P-Value | Chi2 | P-Value > | |----------+----------+----------+----------+----------+----------+---------- > | | Berndt | 0.9191 | 0.9004 | 49.2299 | 0.0000 | 42.7469 | 0.0000 > | | McElroy | 0.8042 | 0.7590 | 17.7985 | 0.0000 | 27.7216 | 0.0001 > | | Judge | 0.8228 | 0.7819 | 20.1180 | 0.0000 | 29.4159 | 0.0001 > | | Dhrymes | 0.8228 | 0.7819 | 20.1180 | 0.0000 | 29.4159 | 0.0001 > | | Greene | 0.8104 | 0.7666 | 18.5204 | 0.0000 | 28.2672 | 0.0001 > | +---------------------------------------------------------------------------- > + Number of Parameters = 8 Number of Equations = 2 Degrees of Freedom F-Test = (6, 34) Degrees of Freedom Chi2-Test = 6 Log Determinant of Sigma = 9.2772 Log Likelihood Function = -127.1003

+------------+ ----+ References +-------------------------------------------------------

Berndt, Ernst R. (1991) "The practice of econometrics: Classical and contemporary", Addison-Wesley Publishing Company; 468.

Dhrymes, Phoebus J. (1974) "Econometrics: Statistical Foundations and Applications", 2ed edition Springer- Verlag New York, USA..

Greene, William (1993) "Econometric Analysis", 2nd ed., Macmillan Publishing Company Inc., New York, USA.; 490-491.

Judge, Georege, W. E. Griffiths, R. Carter Hill, Helmut Lutkepohl, & Tsoung-Chao Lee(1985) "The Theory and Practice of Econometrics", 2nd ed., John Wiley & Sons, Inc., New York, USA; 477-478.

Kmenta, Jan (1986) "Elements of Econometrics", 2nd ed., Macmillan Publishing Company, Inc., New York, USA; 645.

McElroy, Marjorie B. (1977) "Goodness of Fit for Seemingly Unrelated Regressions: Glahn's R2y,x and Hooper's r~2", Journal of Econometrics, 6(3), November; 381-387.

+-----------------+ ----+ Acknowledgments +--------------------------------------------------

I would like to thank the authors of the following Stata modules:

- Nicholas J. Cox: for writing Stata programs about various matrix tasks matod > d. - Philip Ryan: for writing Stata programs about product of observations rprod.

+--------+ ----+ Author +-----------------------------------------------------------

Emad Abd Elmessih Shehata Assistant Professor Agricultural Research Center - Agricultural Economics Research Institute - Eg > ypt Email: emadstat@hotmail.com WebPage: http://emadstat.110mb.com/stata.htm WebPage at IDEAS: http://ideas.repec.org/f/psh494.html WebPage at EconPapers: http://econpapers.repec.org/RAS/psh494.htm

+-----------------+ ----+ r2reg3 Citation +--------------------------------------------------

Shehata, Emad Abd Elmessih (2011) r2reg3: "Stata Module to Compute Overall System R2, Adj. R2, F-Test, and Chi2-Test after reg3 or sureg"

http://ideas.repec.org/c/boc/bocode/s457322.html

http://econpapers.repec.org/software/bocbocode/s457322.htm