```-------------------------------------------------------------------------------
help: r2sem                                                        dialog: r2se
> m
-------------------------------------------------------------------------------

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

r2sem: Overall SEM R2 - Adjusted R2 - F Test - Chi2 Test

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

r2sem

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

r2sem computes overall system R-squared (R2), Adjusted R2, and the overall
significance of F-Test, and Chi2-Test, after:
- (SEM) Structural Equation Modeling sem for systems of simultaneous
equations.

r2sem used Four types of criteria and tests, as discussed in:
McElroy(1977), Judge et al(1985), 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)
4- Greene  System R2 = 1-(Q/trace(inv(Sig))*SYs)

From each type of these system R2's, r2sem 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|

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

r2sem 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_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_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_g)         Greene F Test
r(chi_b)       Berndt Chi2 Test
r(chi_j)       Judge Chi2 Test
r(chi_m)       McElroy Chi2 Test
r(chi_g)       Greene Chi2 Test
r(lsig2)       Log Determinant of Sigma
r(llf)         Log Likelihood Function

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

in this example FIML will be used as follows:

clear all

sysuse r2sem.dta , clear

sem (y1 <- y2 x1 x2) (y2 <- y1 x3 x4), cov(e.y1*e.y2)

r2sem

return list

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

db r2sem

. sysuse r2sem.dta , clear
. sem (y1 <- y2 x1 x2) (y2 <- y1 x3 x4), cov(e.y1*e.y2)

Structural equation model                       Number of obs      =        17
Estimation method  = ml
Log likelihood     = -363.34588
------------------------------------------------------------------------------
|                 OIM
|      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
Structural   |
y1 <-      |
y2 |   .2425937   .2106232     1.15   0.249    -.1702201    .6554075
x1 |   .2568409    .462485     0.56   0.579     -.649613    1.163295
x2 |  -1.037016   .3154059    -3.29   0.001      -1.6552   -.4188317
_cons |   147.0826    54.4491     2.70   0.007     40.36431    253.8009
-----------+----------------------------------------------------------------
y2 <-      |
y1 |  -.6282929   .6148239    -1.02   0.307    -1.833326    .5767398
x3 |  -.5226661   .3235637    -1.62   0.106    -1.156839    .1115071
x4 |     3.4208   1.440664     2.37   0.018     .5971513    6.244449
_cons |   62.44495   42.36071     1.47   0.140    -20.58052    145.4704
-------------+----------------------------------------------------------------
Variance     |
e.y1 |   80.17577   28.99122                      39.46865    162.8673
e.y2 |   142.4478   80.80501                      46.86006    433.0208
-------------+----------------------------------------------------------------
Covariance   |
e.y1       |
e.y2 |   25.62619   53.75243     0.48   0.634    -79.72665     130.979
------------------------------------------------------------------------------
LR test of model vs. saturated: chi2(2)   =      0.12, Prob > chi2 = 0.9408

. r2sem
==============================================================================
* Structural Equation Modeling: SEM - Method(ml)
* Overall System R2 - Adjusted R2 - F-Test - Chi2-Test
==============================================================================

+----------------------------------------------------------------------------+
|     Name |       R2 |   Adj_R2 |        F |  P-Value |     Chi2 |  P-Value |
|----------+----------+----------+----------+----------+----------+----------|
|   Berndt |   0.9189 |   0.8962 |  40.4497 |   0.0000 |  42.6990 |   0.0000 |
|  McElroy |   0.8043 |   0.7495 |  14.6785 |   0.0000 |  27.7303 |   0.0002 |
|    Judge |   0.8227 |   0.7731 |  16.5746 |   0.0000 |  29.4107 |   0.0001 |
|   Greene |   0.8096 |   0.7563 |  15.1863 |   0.0000 |  28.1969 |   0.0002 |
+----------------------------------------------------------------------------+
Number of Parameters         =           9
Number of Equations          =           2
Degrees of Freedom F-Test    =      (7, 34)
Degrees of Freedom Chi2-Test =           7
Log Determinant of Sigma     =      9.2840
Log Likelihood Function      =   -363.3459

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

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

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.

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

Emad Abd Elmessih Shehata
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

+----------------+
----+ r2sem Citation +---------------------------------------------------

Shehata, Emad Abd Elmessih (2012)
R2SEM: "Stata Module to Compute Overall R2, Adj. R2, F-Test, and
Chi2-Test after Structural Equation Modeling (SEM) Regressions"