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?
Help in creating so many dummiesHi I have a data set of 94 countries and number of observations for each country is different. The…
How to analyze data for reapeated measure mixed model design? Research objectives: 1. What is the association between tourists' and residents' aesthetic experien…
Roc curveHi everyone, I have made a ROC curve to test the predictive power of the credit rating in estimating…
Smaller and low quality graphs in Stata 17Dear community, I'm using Stata 17 SE and getting smaller and low-quality graphs than in previous v…
Margins "variable not found in list of covariates" logistic regressionHi there, I'm having an issue whereby I am trying to run a margins command following my logit regre…
Subscribe to:
Post Comments (Atom)
0 Response to How exactly does Stata calculate derivatives via the margins command for nonlinear functions?
Post a Comment