|
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: RE: question re: calculation of Shea partial R2 in ivreg2
From |
Shawn Bauldry <[email protected]> |
To |
[email protected] |
Subject |
Re: st: RE: question re: calculation of Shea partial R2 in ivreg2 |
Date |
Thu, 20 Mar 2008 19:07:23 -0400 |
Mark,
Thanks for your helpful responses. In working through my problem using
your code, I realized that my error was in using the stata command
regress to obtain the OLS s.e. as opposed to ivreg2 with no endogenous
variables specified. I didn't realize that these two approaches would
not produce equivalent s.e.'s.
Best,
Shawn
Schaffer, Mark E wrote:
Shawn,
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of
Shawn Bauldry
Sent: 20 March 2008 20:23
To: [email protected]
Subject: Re: st: RE: question re: calculation of Shea partial
R2 in ivreg2
Mark,
I appreciate your willingness to look at this.
Below is a portion of a log file that has the following: (1)
the 2SLS results with the Shea partial R2; (2) OLS results to
obtain the inputs for the direct calculation; (3) the
calculation of the Shea partial R2 following Godfrey's formula.
I think it's probably a mistake in the R2 for IV that you're calculating
by hand. When I use the R2s saved by -ivreg2- and Godfrey's formula, I
reproduce the reported Shea R2:
. sysuse auto
(1978 Automobile Data)
. qui ivreg2 price (mpg foreign = weight trunk turn length), ffirst
. mat list e(first)
e(first)[6,2]
mpg foreign
sheapr2 .10855718 .06782192
pr2 .66219852 .41371357
F 33.815496 12.172479
df 4 4
df_r 69 69
pvalue 1.307e-15 1.527e-07
. mat viv=e(V)
. scalar viv1=viv[1,1]
. scalar r2iv=e(r2)
. qui ivreg2 price mpg foreign
. mat vols=e(V)
. scalar vols1=vols[1,1]
. scalar r2ols=e(r2)
. di vols1/viv1*(1-r2iv)/(1-r2ols)
.10855718
--Mark
Prof. Mark Schaffer
Director, CERT
Department of Economics
School of Management & Languages
Heriot-Watt University, Edinburgh EH14 4AS
tel +44-131-451-3494 / fax +44-131-451-3296
email: [email protected]
web: http://www.sml.hw.ac.uk/ecomes
Best,
Shawn
. *** 2sls model
. ivreg2 y5 (y1 x1 = y2 y3 y4 x2 x3), first
First-stage regressions
-----------------------
First-stage regression of y1:
Ordinary Least Squares (OLS) regression
---------------------------------------
Number
of obs =
75
F( 5,
69) =
21.28
Prob >
F =
0.0000
Total (centered) SS = 509.0138607 Centered R2 =
0.6066
Total (uncentered) SS = 2748.707483 Uncentered R2 =
0.9272
Residual SS = 200.2393343 Root MSE =
1.704
--------------------------------------------------------------
----------------
y1 | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+------------------------------------------------
----------
-------------+------
y2 | .1383487 .0727181 1.90 0.061 -.0067199
.2834172
y3 | .3186926 .0767732 4.15 0.000 .1655342
.471851
y4 | .231242 .1018089 2.27 0.026 .0281388
.4343452
x2 | .0954845 .2584685 0.37 0.713 -.4201462
.6111151
x3 | -.0905941 .2699537 -0.34 0.738 -.6291371
.4479489
_cons | 1.619292 .7153105 2.26 0.027 .1922861
3.046297
--------------------------------------------------------------
----------------
Partial R-squared of excluded instruments: 0.6066
Test of excluded instruments:
F( 5, 69) = 21.28
Prob > F = 0.0000
First-stage regression of x1:
Ordinary Least Squares (OLS) regression
---------------------------------------
Number
of obs =
75
F( 5,
69) =
62.97
Prob >
F =
0.0000
Total (centered) SS = 39.74900527 Centered R2 =
0.8202
Total (uncentered) SS = 1955.758701 Uncentered R2 =
0.9963
Residual SS = 7.145301922 Root MSE =
.3218
--------------------------------------------------------------
----------------
x1 | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+------------------------------------------------
----------
-------------+------
y2 | -.0245964 .0137366 -1.79 0.078 -.0520001
.0028072
y3 | .0048132 .0145026 0.33 0.741 -.0241187
.033745
y4 | .0384214 .0192319 2.00 0.050 .0000549
.076788
x2 | .3542929 .0488251 7.26 0.000 .2568894
.4516963
x3 | .069175 .0509947 1.36 0.179 -.0325566
.1709066
_cons | 3.012472 .1351233 22.29 0.000 2.742908
3.282035
--------------------------------------------------------------
----------------
Partial R-squared of excluded instruments: 0.8202
Test of excluded instruments:
F( 5, 69) = 62.97
Prob > F = 0.0000
Summary results for first-stage regressions
-------------------------------------------
Shea
Variable | Partial R2 | Partial R2 F( 5, 69)
P-value
y1 | 0.5606 | 0.6066 21.28
0.0000
x1 | 0.7580 | 0.8202 62.97
0.0000
Underidentification tests:
Chi-sq(4)
P-value
Anderson canon. corr. likelihood ratio stat. 61.62
0.0000
Cragg-Donald N*minEval stat. 95.55
0.0000
Ho: matrix of reduced form coefficients has rank=K-1 (underidentified)
Ha: matrix has rank>=K (identified)
Weak identification statistics:
Cragg-Donald (N-L)*minEval/L2 F-stat 17.58
Anderson-Rubin test of joint significance of endogenous
regressors B1 in main equation, Ho:B1=0
F(5,69)= 17.18 P-val=0.0000
Chi-sq(5)= 93.35 P-val=0.0000
Number of observations N = 75
Number of regressors K = 3
Number of instruments L = 6
Number of excluded instruments L2 = 5
Instrumental variables (2SLS) regression
----------------------------------------
Number
of obs =
75
F( 2,
72) =
53.22
Prob >
F =
0.0000
Total (centered) SS = 505.1010621 Centered R2 =
0.6276
Total (uncentered) SS = 2483.682344 Uncentered R2 =
0.9243
Residual SS = 188.0785007 Root MSE =
1.584
--------------------------------------------------------------
----------------
y5 | Coef. Std. Err. z P>|z| [95% Conf.
Interval]
-------------+------------------------------------------------
----------
-------------+------
y1 | .7242857 .1014416 7.14 0.000 .5254638
.9231076
x1 | 1.123234 .3121788 3.60 0.000 .5113746
1.735093
_cons | -4.498983 1.423827 -3.16 0.002 -7.289633
-1.708332
--------------------------------------------------------------
----------------
Anderson canon. corr. LR statistic (identification/IV
relevance test):
61.616
Chi-sq(4) P-val =
0.0000
--------------------------------------------------------------
----------------
Sargan statistic (overidentification test of all instruments):
0.801
Chi-sq(3) P-val =
0.8492
--------------------------------------------------------------
----------------
Instrumented: y1 x1
Excluded instruments: y2 y3 y4 x2 x3
--------------------------------------------------------------
----------------
.
. *** ols model
. regress y5 y1 x1
Source | SS df MS
Number of obs =
75
-------------+------------------------------ F( 2,
72) =
63.89
Model | 323.070276 2 161.535138 Prob
F =
0.0000
Residual | 182.030786 72 2.52820536
R-squared =
0.6396
-------------+------------------------------ Adj
R-squared =
0.6296
Total | 505.101062 74 6.82569003 Root
MSE =
1.59
--------------------------------------------------------------
----------------
y5 | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+------------------------------------------------
----------------
y1 | .6102657 .0762614 8.00 0.000 .4582413
.76229
x1 | 1.179284 .2729019 4.32 0.000 .6352644
1.723304
_cons | -4.159203 1.292575 -3.22 0.002 -6.735903
-1.582502
--------------------------------------------------------------
----------------
.
. *** parameters
. * ols: se(x1) = 0.2729019; R2 = 0.6396
. * 2sls: se(x1) = 0.3121788; TSS = 505.1010621; RSS = 188.0785007;
.
. *** calculating Shea partial R2 for x1
. dis (0.2729019^2)/(0.3121788^2)*(188.0785007/505.1010621)/(1-0.6396)
.78955501
.
.
. capture log close
Schaffer, Mark E wrote:
Shawn,
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of
Shawn Bauldry
Sent: 20 March 2008 18:34
To: [email protected]
Subject: st: question re: calculation of Shea partial R2 in ivreg2
I have a question about how ivreg2 calculates the Shea
partial R2. I have a data set with 75 cases, 2 endogenous
regressors (y1,x1), and 5 instruments (y2,y3,y4,x2,x3). When
I run ivreg2, it reports a Shea partial R2 for y1 of 0.5606
and for x1 of 0.7580. However, when I calculate these using
the formula provided by Godfrey (1999) and referenced in
Baum, Schaffer, and Stillman's (2003) - R2_p =
(v_b1[ols]/v_b1[2sls])[(1-R2[2sls])/(1-R2[ols])] - I get
somewhat different results.
Based on the formula and maintaining 7 digits after the
decimal for the inputs, I obtain R2_p for y1 of 0.5840 and
for x1 of 0.7896. These aren't that far off, but I expected
them to be closer.
-ivreg2- agrees with -ivregress-, e.g.:
. sysuse auto
(1978 Automobile Data)
. which ivreg2
c:\ado\personal\ivreg2.ado
*! ivreg2 2.2.08 15oct2007
*! authors cfb & mes
*! see end of file for version comments
. ivreg2, version
02.2.08
. qui ivreg2 price (mpg foreign = weight trunk turn length), ffirst
. mat list e(first)
e(first)[6,2]
mpg foreign
sheapr2 .10855718 .06782192
pr2 .66219852 .41371357
F 33.815496 12.172479
df 4 4
df_r 69 69
pvalue 1.307e-15 1.527e-07
.
. qui ivregress 2sls price (mpg foreign = weight trunk turn length)
. qui estat firststage
. mat list r(multiresults)
r(multiresults)[2,2]
c1 c2
r1 .10855718 .07035248
r2 .06782192 .02787143
The first row in the -ivreg2- saved matrix is identical to the first
column in the -ivregress- saved matrix.
Maybe you could show us the steps you went through to
calculate the Shea
partial R-sqs?
--Mark
Has anyone else found a similar difference or does anyone
know why I would see this difference?
Best,
Shawn
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/