Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: programmes on non-stationary panels

From   <[email protected]>
To   <[email protected]>
Subject   st: programmes on non-stationary panels
Date   Wed, 4 Aug 2004 17:07:03 +0200

Broad question
Would anybody know a good source for Stata programmes on non-stationary panels (pedroni...)  
Many thanks and best regards

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of May Boggess
Sent: Tuesday 03 August 2004 19:35
To: [email protected]
Subject: Re: st: Marginal & Impact Effects in a Tobit

On Tuesday, Gonzalo wrote:

> I'm running a tobit with several dummies.
> I calculated the marginal effect in the average probabilities and in the
> average characteristics and the results are quite different from the ones
> I obtain after the command 'dtobit' in Stata.

Before I get started on -dtobit-, we must make certain we know what
the formulas for the prediction functions following -tobit-.
Here is some code that computes the predictions "by hand".
Unfortunately, this is not simple, so I have used some local
macroes, hoping that the expressions will be a little easier to
understand that way:

sysuse auto 
tobit mpg weight , ll(20)
local xb=" _b[weight]*wei+_b[_cons] "
local nn="norm((20-(_b[weight]*wei+_b[_cons]))/_b[_se])" 
local nd="normden((20-(_b[weight]*wei+_b[_cons]))/_b[_se])" 
local p 1 - `nn' 
local e  `xb'+ _b[_se]*`nd'/(1 - `nn') 
local ys (`p')*(`e') + 20*`nn' 

 predict xb,xb
 gen myxb=`xb'
 sum xb myxb

 predict p, p(20, .)
 di "`p'"
 gen myp=`p'
 sum p myp

 predict e, e(20, .)
 di "`e'"
 gen mye=`e'
 sum e mye

 predict ys, ys(20, .)
 di "`ys'"
 gen myys=`ys'
 sum ys myys

Now, to compute discrete marginal effect we just take the difference
between the value of the prediction at 1 and the value at 0.
This is what -mfx- does, what and what the user-written command 
-dtobit- does. Unfortuntely, -dtobit- has a typo ( a 1 instead of an l)
on line 239 of the ado code. Here is an example:

 sysuse auto 
 tobit mpg for, ll(20)
 dtobit, brief

 local xb0=" _b[for]*0+_b[_cons] "
 local xb1=" _b[for]*1+_b[_cons] "
 local nn0="norm((20-(`xb0'))/_b[_se])"
 local nn1="norm((20-(`xb1'))/_b[_se])"  
 local nd0="normden((20-(`xb0'))/_b[_se])" 
 local nd1="normden((20-(`xb1'))/_b[_se])" 
 local p0 1 - `nn0' 
 local p1 1 - `nn1' 
 local e0  `xb0'+ _b[_se]*`nd0'/(`p0') 
 local e1  `xb1'+ _b[_se]*`nd1'/(`p1') 
 local ys0 (`p0')*(`e0') + 20*`nn0' 
 local ys1 (`p1')*(`e1') + 20*`nn1'

 mfx, predict(xb)  
 display "mfx = " (`xb1')-(`xb0')
 mfx, predict(ystar(20, .))
 display "mfx = " (`ys1')-(`ys0')

 mfx, predict(e(20, .))
 display "mfx = " (`e1')-(`e0')

 mfx, predict(p(20, .))
 display "mfx = " (`p1')-(`p0')

You will notice the difference in ystar and e. To make the change to
your copy of dtobit.ado, type

 which dtobit

on the command line in Stata. That will tell you where the file is
stored. Copy that, and use your favorite text editor to open the file.
If your text editor shows you lines numbers, you won't have too much
trouble finding line 239. It looks like this:

		scalar `E_c1' = `x1' + `se'*normd((`ll'-`x1')/`se')  /*
		*/ / (1-normprob((`l1'-`x1')/`se'))

You want to change the l1 to an ll, so it will
look like this:

		scalar `E_c1' = `x1' + `se'*normd((`ll'-`x1')/`se')  /*
		*/ / (1-normprob((`ll'-`x1')/`se'))

Once you have made that change, you can rerun the above example,
and you should find that now -dtobit- agrees with -mfx-.
An update for -dtobit- will appear in the next Stata Journal.

-- May
[email protected]

*   For searches and help try:

Any e-mail message from the European Central Bank (ECB) is sent in good faith but shall neither be binding nor construed as constituting a commitment by the ECB except where provided for in a written agreement.
This e-mail is intended only for the use of the recipient(s) named above. Any unauthorised disclosure, use or dissemination, either in whole or in part, is prohibited.
If you have received this e-mail in error, please notify the sender immediately via e-mail and delete this e-mail from your system.

*   For searches and help try:

© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index