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

From |
Wenhui Wei <weiwenhui@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

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

Date |
Thu, 4 Nov 2004 15:05:41 -0500 |

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). I hope I'm not confusing you.... Thanks! Wenhui On 04 Nov 2004 13:38:05 -0600, May Boggess <mboggess@stata.com> wrote: > On Thursday, Wenhui Wei wrote: > > I'm runing a biprobit model (two treatment modes) and get two sets > > marginal effects by the MFX command. > > > > > > My quesiton is: for a certain variable, for example, gender (with male > > as the base), how to test whether its estimated marginal effects are > > significant different in the 2 equations. i.e. the marginal effect of > > female in treatment mode 1 is significantly different from that in > > treatment mode 2? > > > > test command only test for the difference in the estimated > > coefficients, not marginal effects. > > > > We can do this by saving the marginal effects and their covariance > matrix as estimation results and then use -test-. Let's begin with an > example we can work with: > > clear > sysuse auto > set seed 12345 > gen y1=uniform()>0.5 > gen y2=uniform()>0.5 > biprobit y1 y2 mpg for > > I am interested in the marginal effect for for=1 and for=0. > I am going to use a matrix to pass the numbers into the -at()- > option of -mfx-: > > matrix A1=(20, 1) > mfx, var(mpg) at(A1) tr(2) > mat m1=e(Xmfx_dydx) > mat D1=(.32062124, .00432451, .00432453, .11510433, -.0019256, > -.0019256, -.00114118) > > When you use the -tracelvl()- option on -mfx- you get to the see > the second derivatives that a calculated so -mfx- can use the > delta method to get the standard error of the marginal effect. > -mfx- doesn't save those guys in a matrix for us, so we'll have to copy > and paste them in by hand. Same thing for the marginal effect at for=0: > > matrix A0=(20, 0) > mfx, var(mpg) at(A0) tr(2) > mat m0=e(Xmfx_dydx) > mat D0= (.28952027, 0, .00463938, .19246524, 0, -.00111842, .00006737) > > mat D=D1\D0 > mat list D > > Now, to get the covariance matrix for these two marginal effects, > I need the covariance matrix for the coefficients of the model: > > mat V=e(V) > > Then multiply: > > mat COV=D*V*D' > mat rownames COV = m1 m0 > mat colnames COV = m1 m0 > mat list COV > > To be able to test if the two marginal effects are the same, > I want to use a Wald test. This is done in Stata using the command > -test-. > > I can take advantage of that by posting the marginal effects > and the covariance matrix as estimation results. Before I do so, > I have to make sure the rows and columns are labeled appropriately, > which means, mathing the names on the covariance matrix COV: > > mat b=[m1[1,1],m0[1,1]] > mat colnames b = m1 m0 > mat list b > eret post b COV > eret display > mat list e(b) > mat list e(V) > > You can see the marginal effects and the covariance matrix are now > stored in the e() results. So now we can use test: > > test _b[m1]=_b[m0] > > --May > mmb@stata.com > > * > * 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/

**Follow-Ups**:**Re: st: biprobit: test for difference in marginal effects***From:*May Boggess <mboggess@stata.com>

**References**:**st: biprobit: test for difference in marginal effects***From:*Wenhui Wei <weiwenhui@gmail.com>

**Re: st: biprobit: test for difference in marginal effects***From:*May Boggess <mboggess@stata.com>

- Prev by Date:
**st: Stata and Excel** - Next by Date:
**Re: st: Sequential Multiple Regression** - Previous by thread:
**Re: st: biprobit: test for difference in marginal effects** - Next by thread:
**Re: st: biprobit: test for difference in marginal effects** - Index(es):

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