Heteroscedastic Probit

For posting your own programs to share with others

Moderators: EViews Gareth, EViews Moderator

trubador
Did you use forum search?
Posts: 1518
Joined: Thu Nov 20, 2008 12:04 pm

Heteroscedastic Probit

Postby trubador » Mon Apr 27, 2015 1:49 am

The following code estimates a probit model with a correction for heteroscedasticity of the form Var(e) = exp(k1*z1 + k2*z2 + ...+ km*zm):

Code: Select all

'Example 17.10 (p. 715) of Greene, William H. (2012) Econometric Analysis, 7th edition, Prentice-Hall.
wfopen http://www.stern.nyu.edu/~wgreene/Text/Edition7/TableF5-1.txt
logl hetprobit
hetprobit.append @logl maxlik
hetprobit.append index = c(1) + c(2)*wa + c(3)*wa^2 + c(4)*faminc + c(5)*we + c(6)*((kl6+k618)>0)
hetprobit.append sig = @exp(c(7)*((kl6+k618)>0)+c(8)*faminc)
hetprobit.append adjindex = index/sig
hetprobit.append maxlik = lfp*log(1-@cnorm(-adjindex)) + (1-lfp)*log(@cnorm(-adjindex))
hetprobit.ml(optmethod=legacy)
'Heteroscedasticity test (Wald)
freeze(mode=overwrite,waldtest) hetprobit.wald c(7)=0, c(8)=0
Last edited by trubador on Tue Apr 28, 2015 1:39 am, edited 1 time in total.

Kath
Posts: 16
Joined: Tue Jan 06, 2015 4:08 am

Re: Heteroscedastic Probit

Postby Kath » Mon Apr 27, 2015 8:54 am

Many thanks!
Two additional questions:
Also, do you know a way to estimate a logit model with a correction for heteroscedasticity?
And there is a test to check if there is heteroscedasticity in the logit/probit models?

trubador
Did you use forum search?
Posts: 1518
Joined: Thu Nov 20, 2008 12:04 pm

Re: Heteroscedastic Probit

Postby trubador » Tue Apr 28, 2015 1:41 am

Kath wrote:Also, do you know a way to estimate a logit model with a correction for heteroscedasticity?

Just replace @cnorm with @clogistic in the likelihood function.
Kath wrote:And there is a test to check if there is heteroscedasticity in the logit/probit models?

The final line does a Wald test to check for heteroscedasticity. Please see the cited reference for more details.

trubador
Did you use forum search?
Posts: 1518
Joined: Thu Nov 20, 2008 12:04 pm

Re: Heteroscedastic Probit

Postby trubador » Fri May 01, 2015 1:51 am

Testing for heteroscedasticity in binary dependent variable models (David and MacKinnon, 1993):

Code: Select all

'EViews 9 Users Guide II, Chapter 28, pp.315-316
wfopen http://www.stern.nyu.edu/~wgreene/Text/Edition7/TableF5-1.txt
equation probiteq.binary(d=n, h,optmethod=legacy) lfp c wa wa^2 faminc we (kl6+k618>0)
probiteq.fit p_hat
probiteq.fit(i) xb
probiteq.makeresids(s) brmr_y
series fac=@dnorm(-xb)/@sqrt(p_hat*(1-p_hat))
group brmr_x.add fac (fac*wa) (fac*wa^2) (fac*faminc) (fac*we) (fac*(kl6+k618>0))
equation artificialeq.ls brmr_y brmr_x (fac*(-xb)*faminc) (fac*(-xb)*(kl6+k618>0))
artificialeq.fit brmr_yf
scalar lm_test=@sumsq(brmr_yf)
scalar p_val=1-@cchisq(lm_test,2)

Kath
Posts: 16
Joined: Tue Jan 06, 2015 4:08 am

Re: Heteroscedastic Probit

Postby Kath » Sat May 02, 2015 8:54 am

Many thanks
I used the code you suggest in order to estimate a probit model with a correction for heteroscedasticity but when I try to run the code it appears in the screen the following message:"Missing values in @Logl series at current coefficients at observation 1 in "Do_hetprobit.ml (optmethod=legacy)".
Do you know what is the problem? Can you please help me?
Kath

trubador
Did you use forum search?
Posts: 1518
Joined: Thu Nov 20, 2008 12:04 pm

Re: Heteroscedastic Probit

Postby trubador » Mon May 04, 2015 6:19 am

Hard to say without seeing the actual workfile. You can either adjust the estimation period (i.e. sample) or try different starting values for the coefficients (i.e. c(.)).

Kath
Posts: 16
Joined: Tue Jan 06, 2015 4:08 am

Re: Heteroscedastic Probit

Postby Kath » Mon May 04, 2015 8:32 am

Ok, thanks.
Sorry, disturb you again...but I have another doubt.
Also, I run the code to estimate a probit model with a correction for heteroscedasticity using the data available at: http://www.stern.nyu.edu/~wgreene/Text/ ... TableF14-1, and this time I had no problems. However, although the estimates of the parameters are correct, the standard errors are not (I confirm in the book: Greene, William H. (2000), Econometric Analysis, 4th edition, page 830).
Do you know why? What is the problem?

My code is:
logl hetprobit
hetprobit.append @logl maxlik
hetprobit.append index = c(1) + c(2)*gpa + c(3)*tuce + c(4)*psi
hetprobit.append sig=@exp(c(5)*psi)
hetprobit.append adjindex=index/sig
hetprobit.append maxlik=grade*log(1-@cnorm(-adjindex))+(1-grade)*log(@cnorm(-adjindex))
hetprobit.ml (optmethod=legacy)

' Hetroscedasticity test(Wald)
freeze(mode=overwrite,waldtest) hetprobit.wald c(5)=0

Kath

trubador
Did you use forum search?
Posts: 1518
Joined: Thu Nov 20, 2008 12:04 pm

Re: Heteroscedastic Probit

Postby trubador » Mon May 04, 2015 12:00 pm

Unfortunately I do not have access to 4th edition and I cannot seem to find the example you refer to in other editions. The difference may be due to use of different optimization algorithm (e.g. BHHH) or some kind of transformation in the process. In any case, I do not think there is a problem.

Kath
Posts: 16
Joined: Tue Jan 06, 2015 4:08 am

Re: Heteroscedastic Probit

Postby Kath » Mon May 04, 2015 2:04 pm

But the problem is that, as the standard erros are very different, the p-value are also very different and so the significance of the parameters. Thus, for me some variables are statisticallly significant and in the book they are not and vice-versa. Consequently the conclusions are different...

The model is: Prob(grade=1)= β1+β2*gpa+β3*tuce+β4*psi


My estimated coefficients:

Coefficient (Std. Error)
C(1) -14.28929 (17.01562)
C(2) 3.121627 (3.214196)
C(3) 0.123750 (0.353867)
C(4) 2.343260 (2.342131)
C(5) 1.093392 (1.354041)


Estimated coefficients in the book:

Coefficient (Std. Error)
C(1) -14.28929 (8.861)
C(2) 3.121627 (1.761)
C(3) 0.123750 (0.2134)
C(4) 2.343260 (1.671)
C(5) 1.093392 (0.8806)

trubador
Did you use forum search?
Posts: 1518
Joined: Thu Nov 20, 2008 12:04 pm

Re: Heteroscedastic Probit

Postby trubador » Tue May 05, 2015 3:46 am

Usually, maximum likelihood estimation uses the observed information/hessian matrix. However, BHHH algorithm is often used for discrete choice models, which itself has a preference towards OPG (an approximation to the observed hessian matrix). And it seems, this is the default choice in EViews regardless of the chosen optimization algorithm.

You'll get similar results by simply changing following line:

Code: Select all

...
hetprobit.ml(covinfo=hessian)
...

Kath
Posts: 16
Joined: Tue Jan 06, 2015 4:08 am

Re: Heteroscedastic Probit

Postby Kath » Wed May 06, 2015 10:10 am

So, my results are different comparatively to the results in the book due to the optimization algorithm? It is a question of the optimization algorithm used?

EViews Glenn
EViews Developer
Posts: 2530
Joined: Wed Oct 15, 2008 9:17 am

Re: Heteroscedastic Probit

Postby EViews Glenn » Wed May 06, 2015 12:09 pm

It's not the algorithm employed for estimation, it's the estimator used for the coefficient covariances. As trubador points out, the coefficient covariance results from the book are computed using the inverse of the negative of the Hessian. Your example uses the outer product of the gradients.

The reason that you are seeing it tied to method is that the older engine, EViews legacy, only offers a covariance estimator based on the outer product of the scores. If you select "optmethod=bhhh" you're using roughly the same method as EViews legacy, but you'll also get to use the "covinfo=hessian" method for computing the covariances.

Kath
Posts: 16
Joined: Tue Jan 06, 2015 4:08 am

Re: Heteroscedastic Probit

Postby Kath » Fri May 08, 2015 1:39 am

Many thanks.
If the the results are different due to the estimator used for the coefficient covariances, it is not possible to use in Eviews the estimator used in the book, this is the inverse of the negative of the Hessian?
In Eviews is possible to use not only the outer product of the gradients (as I used in the example) but also the inverse of the negative of the Hessian as used in the book?

EViews Glenn
EViews Developer
Posts: 2530
Joined: Wed Oct 15, 2008 9:17 am

Re: Heteroscedastic Probit

Postby EViews Glenn » Fri May 08, 2015 10:11 am

The example given above uses the hessian. As trubador wrote a couple of posts above, change the line with the ML estimation command to

Code: Select all

hetprobit.ml(covinfo=hessian)

You can use the "covinfo=hessian" option with all of the estimation methods with the exception of legacy.

Kath
Posts: 16
Joined: Tue Jan 06, 2015 4:08 am

Re: Heteroscedastic Probit

Postby Kath » Tue May 12, 2015 10:33 am

As suggested I used the command hetprobit.ml(covinfo=hessian) and I obtain exactly the same results as using the command hetprobit.ml (optmethod=legacy) or hetprobit.ml (optmethod=bhhh). So using different estimators for the coefficient covariances I obtain the same results.It is possible?
And why using the command hetprobit.ml(covinfo=hessian) the results are different comparatively to the results in the book? As I understood they should be equal. I'm a little confused...


Return to “Program Repository”

Who is online

Users browsing this forum: No registered users and 3 guests