```-------------------------------------------------------------------------------
help: r2nlsur                                                        dialog: r2
> nlsur
-------------------------------------------------------------------------------

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

r2nlsur: Overall NL-SUR System R2 - Adjusted R2 - F Test - Chi2 Test

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

r2nlsur

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

r2nlsur computes Overall Nonlinear Seemingly Unrelated Regression (NL-SUR)
System R2, Adj. R2, F-Test, and Chi2-Test after:
- (NL-SUR) Nonlinear Seemingly Unrelated Regression nlsur for sets of
equations.

r2nlsur 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, r2nlsur can calculate Adjusted R2,
F-Test, and Chi2-Test:

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 +----------------------------------------------------

r2nlsur 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(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

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

Berndt, Ernst R. (1991) "The practice of econometrics: Classical and

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.

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

clear all

sysuse r2nlsur.dta , clear

nlsur (y1={B10}+{B11}*y2+{B12}*x1+{B13}*x2) (y2={B20}+{B21}*y1+{B22}*x3+{B23}*
> x4)
r2nlsur

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

return list

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

db r2nlsur

. sysuse r2nlsur.dta , clear
. nlsur (y1 = {B10} + {B11}*x1+ {B12}*x2) (y2 = {B20} + {B21}*x3+ {B22}*x4)

FGNLS regression
---------------------------------------------------------------------
Equation |       Obs  Parms       RMSE      R-sq     Constant
----------------+----------------------------------------------------
1           y1 |        17      3   9.056705    0.8555          B10
2           y2 |        17      3   10.75922    0.8318          B20
---------------------------------------------------------------------

------------------------------------------------------------------------------
|      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
/B10 |   183.5815   43.95101     4.18   0.000     97.43906    269.7239
/B11 |   .4956588   .4326135     1.15   0.252     -.352248    1.343566
/B12 |  -1.370874   .1363473   -10.05   0.000     -1.63811   -1.103638
/B20 |   37.62409   30.21636     1.25   0.213    -21.59888    96.84706
/B21 |  -.3675841   .2675172    -1.37   0.169    -.8919083      .15674
/B22 |   2.288538   .8959307     2.55   0.011     .5325456     4.04453
------------------------------------------------------------------------------

. r2nlsur
==============================================================================
* Overall NL-SUR System R2 - Adjusted R2 - F Test - Chi2 Test (fgnls)
==============================================================================

+----------------------------------------------------------------------------+
|     Name |       R2 |   Adj_R2 |        F |  P-Value |     Chi2 |  P-Value |
|----------+----------+----------+----------+----------+----------+----------|
|   Berndt |   0.9293 |   0.9192 |  92.0573 |   0.0000 |  45.0464 |   0.0000 |
|  McElroy |   0.8315 |   0.8074 |  34.5394 |   0.0000 |  30.2724 |   0.0000 |
|    Judge |   0.8425 |   0.8200 |  37.4452 |   0.0000 |  31.4219 |   0.0000 |
|  Dhrymes |   0.8425 |   0.8200 |  37.4452 |   0.0000 |  31.4219 |   0.0000 |
|   Greene |   0.8133 |   0.7866 |  30.4844 |   0.0000 |  28.5263 |   0.0000 |
+----------------------------------------------------------------------------+
Number of Parameters         =           6
Number of Equations          =           2
Degrees of Freedom F-Test    =      (4, 34)
Degrees of Freedom Chi2-Test =           4
Log Determinant of Sigma     =      9.1462
Log Likelihood Function      =   -125.9864
-------------------------------------------------------------------------------

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

Assistant Professor
Agricultural Research Center - Agricultural Economics Research Institute - Eg
> ypt
WebPage at IDEAS:       http://ideas.repec.org/f/psh494.html
WebPage at EconPapers:  http://econpapers.repec.org/RAS/psh494.htm

+------------------+
----+ r2nlsur Citation +-------------------------------------------------