![stata 12 student stata 12 student](https://images.slideplayer.com/16/5199313/slides/slide_8.jpg)
The stata output for the last three lines should look like the output below. Then, we will confirm that each row is saved by plopping the command to view the matrices at the end.We’ll specifically call them “row1”, “row2”, and “row3”. Save the r(table) matrix for each regression to a custom named matrix.Run three regressions, one for each row, and.Use the -matrix- command to copy the contents of the r(table) to a custom matrix. Since we actually need to save 3 separate r(table) matrices to fill out the blank table (one for each row), you should do this anyway to help facilitate completing the table. Make sure to save the r(table) matrix as custom matrix before going any further. įor various reasons that you can read about here, r(table) is not a usual matrix and Stata will do funny things if you try to run matrix commands on it. You’ll note above (after the -matrix list r(table)- command) that Stata tells you that the r(table) matrix has 9 rows and 2 columns, or. These exist separate from the dataset, which is also basically a big spreadsheet. Matrices are basically small spreadsheets saved in the memory that can be accessed by referencing a cell reference. Copy it to a custom ‘typical’ matrix before doing anything else! Actually view the r(table) matrix in order to verify that all of the data points of interest are hiding there.Take a look at the -return list- to see that the r(table) is hiding there (without actually viewing the contents of r(table)).Let’s take a look at the regression output below and how they exist in the r() level r(table), I have bolded/underlined the output of interest. We actually don’t need this to fill out the above table. ereturn list – this will let you see the ‘brains’ behind the regression, namely the e() level bits, which are useful in post-estimation commands.Type -matrix list r(table)- to see the structured output of this matrix.These are what you will use to fill out the above blank table. Importantly, the r() level contains the r(table) matrix, which holds all of the raw numbers used to generate the output of your regression as you see it in Stata’s output. return list – This will give the ‘guts’ of the regression, namely the r() level bits, as you see it in the Stata output.You can view the r() ‘guts’ with -return list- and e() ‘brains’ with -ereturn list. When you run a regression, Stata saves relevant bits of these regressions in scalars and matrices saved in different r() and e() levels, which can be viewed by -return list- and -ereturn list- commands, respectively. Let’s get familiar with the ‘guts’ and ‘brains’ behind Stata’s regression functions.
#Stata 12 student how to
You can either copy the output manually, or automate it! Let’s learn how to automate this process. In Stata you’ll run three regressions to fill out the three rows: sysuse auto, clear We want to regress MPG (Y) on weight (x) overall and by strata of domestic vs. Let’s use the classic 1978 auto dataset that comes with Stata. Here’s one step-by-step approach that you might find helpful. Extracting the results from regressions in Stata can be a bit cumbersome. If you make your own Stata programs and loops, you have discovered the wonders of automating output of analyses to tables.