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

st: marginal effects for user defined programs

From   "Paul James" <>
Subject   st: marginal effects for user defined programs
Date   Tue, 04 Oct 2005 15:27:11 +0000


I am using a user defined program (called reoprob) which runs a random effects
ordered probit model (the dependent variable, y, takes on 5 values).
Because the program is user defined, I need to write a function to get
the marginal effects that I want. To do this, I wrote one do file
program that calls upon a predict option called mypredict.

program define myreoprob, eclass
reoprob wagecat inc female, i(id)
estimates local cmd='myreoprob'
estimates local predict='mypredict'

The next step is to define and run a program called mypredict. From what
I understand, ultimately I want to use the mfx command, and it will
automatically go to mypredict to find the function it needs to take the
derivative of. In my case, I want

prob(wagecat=0) = prob(xb + u < cut1) = prob(u < cut1 - xb)
= normprob(cut1 - xb)

Now the marginal effects for continuous regressors should be the
derivative of this with respect to that continuous regressor, while the
marginal effect for discrete regressors should be the difference:

prob(y=0 | discrete regressor = 1, all other regressors at their means)
- prob(y=0 | discrete regressor = 0, all other regressors at their means)

Can you help me with this mypredict program, as well as what to type in the command box after the mypredict program is run, so that it will calculate marginal effects after the reoprob estimation.


Express yourself instantly with MSN Messenger! Download today - it's FREE!

* For searches and help try:

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