I would like to be able to manually reproduce the results that Stata provides from the margins command from a nonlinear regression (e.g. logit).
For example, let's say that I have 1000000 observations of a binary dependent variable Y1 and a continuous variable X1, and I am running a logit regression of Y1 on X1. How might I manually calculate the marginal effects for each observation, and then manually calculate the average marginal effect for the entire logit regression, such that I get the exact same result as what Stata produces when I type 'margins, dydx(x1)' ?
My attempts to calculate the marginal effect of each observation by using the pdf of logit seem to fail, as when I then take the average of those marginal results, I get a number that is not equal to what I get when I type 'margins, dydx(x1)'
Related Posts with How exactly does Stata calculate derivatives via the margins command for nonlinear functions?
Adding suffix or prefix to each element of a global varlistHello, I have a core set of variables and for each of them I generated several secondary variables.…
Mean difference testhello there , I have an unbalanced panel data of banks comprising of 21 public,42 foreign and 21 pri…
Help via mergeI have 2 datasets: HEIGHT AGE SCORE x z x y HEIGHT AGE Controls x z x x y x Ho…
Create a rate variable for population as a whole with sample weightsDear Stata users, I am new to stata and am working on a dataset with 20 mio. people for two years w…
IV regression,the independent variable is Non-negative integer, endogenous variable is ordinary, which command can I use?Thanks a lot, Now, I am facing a problem, the problem is just like the title said. I want to conduct…
Subscribe to:
Post Comments (Atom)
0 Response to How exactly does Stata calculate derivatives via the margins command for nonlinear functions?
Post a Comment