Endogeneity refers to correlation between the error term and an independent variable. This should be something that should be very easy to calculate, e.g. after
It should be possible to have Stata test in a convenient way whether such correlation exists, between the error terms and either -length- or -weight-.
Now I searched for how to test it, in particular how to display the results of such a test in -estout-. Lots of sites, including this one, then tell me to use instrumental variables, i.e., estimate the potentially endogenous independent variable, get its predicted values, and plug them into the original equation. There are tools for that, such as -ivregress-, or -ivreg2-.
However, I found no way of displaying in the regression diagnostics, together with e.g. number of observations, number of independent variables, r2, a test that indicates whether any of the independent variables is correlated with the error term. But surely Stata would have the ability to calculate this in the same step, instead of me needing to perform an -ivreg2- every time, and thus running two models instead of one, or even needing -estadd-? Granted, condensing this test into a single number would not show me which independent variable is correlated with the error term, but to display e.g. the p-value of a hypothesis test that "no independent variable is correlated with the error term" would already help, because from there on one can motivate further diagnostics, or show that endogeneity is of no concern.
What intrigues me is that I not only cannot find a way to display endogeneity diagnostics, as proposed above, using -estout- or other outputs; but I also did not find this question asked by anyone else - is it a stupid one? But how so - would it be wrong to try and display e.g. the p-value of the hypothesis test for "no correlation between error term and any independent variable" in the regression diagnostics? Is it something I should not actually want?
Code:
sysuse auto.dta, clear reg price length weight
Now I searched for how to test it, in particular how to display the results of such a test in -estout-. Lots of sites, including this one, then tell me to use instrumental variables, i.e., estimate the potentially endogenous independent variable, get its predicted values, and plug them into the original equation. There are tools for that, such as -ivregress-, or -ivreg2-.
However, I found no way of displaying in the regression diagnostics, together with e.g. number of observations, number of independent variables, r2, a test that indicates whether any of the independent variables is correlated with the error term. But surely Stata would have the ability to calculate this in the same step, instead of me needing to perform an -ivreg2- every time, and thus running two models instead of one, or even needing -estadd-? Granted, condensing this test into a single number would not show me which independent variable is correlated with the error term, but to display e.g. the p-value of a hypothesis test that "no independent variable is correlated with the error term" would already help, because from there on one can motivate further diagnostics, or show that endogeneity is of no concern.
What intrigues me is that I not only cannot find a way to display endogeneity diagnostics, as proposed above, using -estout- or other outputs; but I also did not find this question asked by anyone else - is it a stupid one? But how so - would it be wrong to try and display e.g. the p-value of the hypothesis test for "no correlation between error term and any independent variable" in the regression diagnostics? Is it something I should not actually want?
Comment