Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: Re: About weakiv
From
Chau Tak Wai <[email protected]>
To
[email protected]
Subject
st: Re: About weakiv
Date
Thu, 19 Dec 2013 22:13:54 +0800
Mark,
I have used the -small- option all the way.
Thanks,
Tak Wai
========================
Tak Wai,
Your simulation is set up with 100 obs. The AR test has many degrees of freedom (you have 15 instruments), and I think you're using the large-sample (chi-sq) version of the test stat.
Maybe AR won't be so oversized if you use a small-sample correction? You could try using the -small- option of -weakiv-, and maybe compare that to doing the AR test by hand using an F test.
HTH,
Mark
> Dear Mark and other Statalist users,
>
> Thanks a lot for Mark's reply.
>
> Indeed my aim is to see how good it performs under heteroscedasticity,
> and it should be robust even when the DGP is homoscedastic.
>
> When I remove the robust option of ivregress before weakiv, the
> following results are obtained: (I have used rho=0.9 here)
>
> clrtest 1000 .082 .274502 0 1
> artest 1000 .166 .3722668 0 1
> wtest 1000 .867 .3397446 0 1
>
> Wald test is large, but it agrees with 2SLS. It is the case because it's
> highly overidentified (15 instruments and 1 endo regressor) with average
> first-stage F of 2.
>
> CLR test now looks OK (though a little over rejects) while AR test
> seriously over-rejects. It looks problematic as these tests are supposed
> to be robust to weak IV.
>
> I haven't checked about condivreg yet.
>
> Hope the information helps.
>
> Tak Wai
>
> P.S. Sorry, since I only subscribe the digest version, I cannot reply
> the email of the reply directly.
> ========
>
> Tak Wai,
>
> Does the issue come up when you don't use the -robust- version? You could double-check in that case against -condivreg-, which will report the CLR stat but only for the iid case.
>
> If it's specific to -robust-, maybe have a look at the Finlay-Magnusson 2009 SJ paper cited in the weakiv help file. They say at one point that:
>
> " For linear IV models under homoskedasticity, Andrews, Moreira, and Stock (2007) provide a formula for computing the p-value function of the CLR test (which is embedded in the condivreg
> command). Although this is not the correct p-value function when homoskedasticity is violated, our simulations indicate that it provides a good approximation."
>
> --Mark
>
>> Dear Statalisters,
>>
>> I have a question about weakiv. I have tried to run some simulations to
>> understand the performance of CLR test. But in the following code with
>> 15 instruments and 1 endogenous regressor, the result seems to be far
>> from what it should be. I cannot spot the error of my code. So I would
>> like to ask if it's the problem of my code or a bug in the procedure.
>>
>> I may have coded things badly, so advice is welcome!
>>
>> Thank you very much in advance!
>>
>> The code is as follows:
>>
>> capture program drop sim_iv_clr_15
>> program define sim_iv_clr_15, rclass
>> version 11
>> syntax [, obs(integer 100) mu2k(real 3) b(real 1) rho(real 0.5) ]
>> drop _all
>> set obs `obs'
>> tempvar y x z1 z2 z3 z4 z5 z6 z7 z8 z9 z10 z11 z12 z13 z14 z15 u
>> gen `z1' = rnormal(0,1)
>> gen `z2' = rnormal(0,1)
>> gen `z3' = rnormal(0,1)
>> gen `z4' = rnormal(0,1)
>> gen `z5' = rnormal(0,1)
>> gen `z6' = rnormal(0,1)
>> gen `z7' = rnormal(0,1)
>> gen `z8' = rnormal(0,1)
>> gen `z9' = rnormal(0,1)
>> gen `z10' = rnormal(0,1)
>> gen `z11' = rnormal(0,1)
>> gen `z12' = rnormal(0,1)
>> gen `z13' = rnormal(0,1)
>> gen `z14' = rnormal(0,1)
>> gen `z15' = rnormal(0,1)
>>
>> gen `u' = rnormal(0,1)
>>
>> gen `x' =
>> sqrt(`mu2k'/`obs')*(`z1'+`z2'+`z3'+`z4'+`z5'+`z6'+`z7'+`z8'+`z9'+`z10'+`z11'+`z12'+`z13'+`z14'+`z15')+`u'
>> gen `y' = `b'*`x'+(`rho')*`u'+sqrt(1-`rho'^2)*rnormal(0,1)
>>
>> local z `z1' `z2' `z3' `z4' `z5' `z6' `z7' `z8' `z9' `z10' `z11' `z12'
>> `z13' `z14' `z15'
>> *check first stage
>> regress `x' `z'
>> return scalar fsf=e(F)
>>
>> ivregress 2sls `y' (`x' = `z'), robust
>> return scalar beta2sls=_b[`x']
>> return scalar se2sls=_se[`x']
>>
>> ivregress liml `y' (`x' = `z'), robust
>> return scalar betaliml=_b[`x']
>> return scalar seliml=_se[`x']
>>
>> ivreg2 `y' (`x'=`z' ), fuller(1) robust
>> return scalar betaf1=_b[`x']
>> return scalar sef1=_se[`x']
>>
>> ** check the related tests at null of true value
>> ivregress 2sls `y' (`x' = `z'), robust
>> weakiv, null(1.0) small
>> return scalar clrp=e(clr_p)
>> return scalar arp=e(ar_p)
>> return scalar wp=e(wald_p)
>>
>> **test at true value - 0.25
>> ivregress 2sls `y' (`x' = `z'), robust
>> weakiv, null(0.75) small
>> return scalar clrpa=e(clr_p)
>> return scalar arpa=e(ar_p)
>> return scalar wpa=e(wald_p)
>>
>> **test at true value +0.25
>> ivregress 2sls `y' (`x' = `z'), robust
>> weakiv, null(1.25) small
>> return scalar clrpb=e(clr_p)
>> return scalar arpb=e(ar_p)
>> return scalar wpb=e(wald_p)
>>
>> end
>>
>> local betatrue 1.0
>> local nobs 100
>> simulate fsf=r(fsf) beta2sls=r(beta2sls) se2sls=r(se2sls) /*
>> */ betaliml=r(betaliml) seliml=r(seliml) betaf1=r(betaf1) sef1=r(sef1)/*
>> */ clrp=r(clrp) arp=r(arp) wp=r(wp) clrpa=r(clrpa) arpa=r(arpa)
>> wpa=r(wpa) clrpb=r(clrpb) arpb=r(arpb) wpb=r(wpb), /*
>> */ reps(1000): sim_iv_clr_15, obs(`nobs') b(`betatrue') mu2k(1.0) rho(0.5)
>>
>> **I generate a dummy variable for rejection
>> gen clrtest=(clrp<0.05)
>> gen artest=(arp<0.05)
>> gen wtest=(wp<0.05)
>>
>> The results are then given by
>> For tests at true value
>> clrtest | 1000 .253 .4349485 0 1
>> artest | 1000 .437 .4962633 0 1
>> -------------+--------------------------------------------------------
>> wtest | 1000 .355 .4787528 0 1
>>
>> For tests at true - 0.25
>> clrtesta | 1000 .324 .4682342 0 1
>> -------------+--------------------------------------------------------
>> artesta | 1000 .49 .5001501 0 1
>> wtesta | 1000 .797 .4024338 0 1
>>
>> For tests at true +0.25
>> clrtestb | 1000 .351 .4775218 0 1
>> artestb | 1000 .509 .5001691 0 1
>> wtestb | 1000 .052 .2221381 0 1
>>
>> So at least at the true value it is quite far from the nominal size of 0.05.
>>
>> Sincerely,
>> Tak Wai Chau
>>
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/