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?
Confusion about create matching pair id for conditional logistic regressionDear Statalisters, I use -ccmatch- creating match pair of fdz (0 1) base on condition of (size0 ind…
How to explain the results of t2way5 i.e. Tukey's Two-Way Analysis by MediansDear Stata users, Nick Cox had written a command named -t2way5- (SSC) to execute Tukey's Two-Way An…
From single event observations to time seriesHi everyone, As I am quite new to Stata hope you can help me out with the next question. Currently…
Mundlak procedureDear all, When using the Mundlak procedure, if one wishes to include year fixed effects (i.e. a dum…
Time and Country Fixed Effects in Panel Data Estimation (OLS and PPMLI am doing a regression taking 34 countries for the time period 2010-19. It is a gravity model so th…
Subscribe to:
Post Comments (Atom)
0 Response to How exactly does Stata calculate derivatives via the margins command for nonlinear functions?
Post a Comment