[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

From |
May Boggess <[email protected]> |

To |
[email protected] |

Subject |
Re: st: biprobit: test for difference in marginal effects |

Date |
04 Nov 2004 14:49:13 -0600 |

On Thu, 2004-11-04 at 14:05, Wenhui Wei wrote: > hi, May, thanks a lot for your quick response. > > I read your response, and as far as I understand, you're testing the > difference of marginal effects for (for =0) and (for=1). However, > given that (for =0) is the base level, I'm getting marginal effects > for (for =1), and I'm interested in whether the two marginal effects > are different. > > In my case, I first run the model: > biprobit y1 y2 othervar for > > the following command tests whther the coeffecients for (for =1 ) are > significant different. > test [y1]for = [y2]for > > However, since the probit coefficients are hard to interpret, I need > the marginal effects, by typing: > (a) mfx compute, predict(pmarg1) > (b) mfx compute, predict(pmarg2) > > My question is: how to test the marginal effect of (for=1) from (a) is > significant from > that from (b). > OK. We can use the same method, that is, collect the information from each call to -mfx-, save in e() results and use -test-. I have pasted the cdoe for that beow. But since we are using -biprobit-, it is easy to differentiate the probability functions by hand, and so we can also achieve our objective using -testnl-, without using -mfx- at all. clear sysuse auto set seed 12345 gen y1=uniform()>0.5 gen y2=uniform()>0.5 biprobit y1 y2 mpg for local xb1 "[y1]_b[mpg]*20+[y1]_b[for]*1+[y1]_b[_cons]" local xb2 "[y2]_b[mpg]*20+[y2]_b[for]*1+[y2]_b[_cons]" testnl normden(`xb1')*[y1]_b[mpg]=normden(`xb2')*[y2]_b[mpg] I have used local macros to store the linear predictors, xb1 and xb2, to make the code a little easier to read. I am finding the marginal effects at mpg=20 and for=1. The expression normden(`xb1')*[y1]_b[mpg] is the derivative of the pmarg1=norm(xb1), since the derivative of norm is normden (and the extra [y1]_b[mpg] comes from using the chain rule). The can compare the above code using analytic derivatives to the answer given by -mfx- using numerical derviaties: clear sysuse auto set seed 12345 gen y1=uniform()>0.5 gen y2=uniform()>0.5 biprobit y1 y2 mpg for matrix A1=(20, 1) mfx, predict(pmarg1) var(mpg) at(A1) tr(2) mat m1=e(Xmfx_dydx) mat D1=(.38728114, -.00009023, -.00009023, 0, 0, 0, 0) mfx, predict(pmarg2) var(mpg) at(A1) tr(2) mat m2=e(Xmfx_dydx) mat D2= (0, 0, 0, .34408008, -.00231321, -.00231321, 0) mat D=D1\D2 mat list D mat V=e(V) mat COV=D*V*D' mat rownames COV = m1 m2 mat colnames COV = m1 m2 mat list COV mat b=[m1[1,1],m2[1,1]] mat colnames b = m1 m2 mat list b eret post b COV eret display mat list e(b) mat list e(V) test _b[m1]=_b[m2] --May [email protected] * * 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/

**References**:**st: biprobit: test for difference in marginal effects***From:*Wenhui Wei <[email protected]>

**Re: st: biprobit: test for difference in marginal effects***From:*May Boggess <[email protected]>

**Re: st: biprobit: test for difference in marginal effects***From:*Wenhui Wei <[email protected]>

- Prev by Date:
**Re: st: RE: Sorting huge Datasets** - Next by Date:
**st: how to lie with statistics, 2004 edition...** - Previous by thread:
**Re: st: biprobit: test for difference in marginal effects** - Next by thread:
**st: Re: Windows Service pack 2** - Index(es):

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