Hi everyone,
I am running a long loop with a number of different 2SLS regressions using ivregress. I want to store the models in a dataset, so that I can compare them and plot them against each other—which I am doing using regsave. My question is that I would like to also store the F-statistic in the first stage (which I would check outside do by running estat first after the ivregress command). Is there anyway I can build this into the loop? A sample code is below:
* Create a local with the outcomes
local outcomes outcome1 outcome2 outcome3
* Run the analyses
foreach outcome in `outcomes'{
ivregress 2sls `outcome' covariate1 covariate2 ///
(endogenous_predictor = instrument)
regsave endogenous_predictor using results.dta, ci level(95) append addlabel ///
(Outcome, `outcome', Model, 2SLS, Predictor, Predictor)
* The loop goes by repeating similar chunks of code
}
Any way I can add the estat first command in the loop and store the F value in the same results.dta dataset?
Thank you very much in advance!
Related Posts with Storing first-stage statistics for 2SLS regression using regsave
2SLS with count data in second stageDear all, I would like to run a 2SLS regression using longitudinal survey data where the the res…
"Variables do not uniquely identify the observations" error when mergingHi everyone. I am trying to merge two datasets constructed from German SOEP data. The datasets have …
MC Simulation: How to return regression results for multiple regressions?Hello, I am attempting to return coefficient results from multiple regressions using a simulation. …
Drop values in columns without using the drop duplicates commandDear Stata community, I am new to Stata programming and currently conducting an event study on ad h…
Generating variable that measures the difference between the last and first yearDear Statalisters, I am trying to generate a variable that measures how much the CPIA index for ins…
Subscribe to:
Post Comments (Atom)
0 Response to Storing first-stage statistics for 2SLS regression using regsave
Post a Comment