Outreg2 using results, word append ctitle(Model 2, Robust)įor the first column, the title will have ‘Model 1’ in its first line, and ‘OLS’ in its second line. Outreg2 using results, word replace ctitle(Model 1, OLS) regress price mpg headroom trunk displacement Now let’s say, you want to give an additional heading to each regression output column that would help you refer to and identify the model in your paper by, for example, ‘Model 1’ and ‘Model 2’. To illustrate the use of ctitle(), we used the replace option with the first outreg2 command here to replace the previous word file we had created. Outreg2 using results, word append ctitle(Robust) Regress price mpg headroom trunk displacement,robust Outreg2 using results, word replace ctitle(OLS) Running the last two regressions, and outputting them with this additional option by: regress price mpg headroom trunk displacement For this, we make use of another option called ctitle(). To distinguish each column with outputs from different regressions, we can specify customised headings accordingly. ![]() Naming Columns with Customised Titles: ctitle() The results from this third regression will be added/appended to the ‘results’ file as a third column. For this regression, we want the coefficients (and standard errors) to be appended as a new column in the ‘results’ word file: regress price mpg headroom trunk displacement, robustĪnother regression with append option will make this clearer regress price mpg headroom This option is used to cater to heterosckedasticity issues by reporting robust standard errors. To illustrate this, let’s run the last regression again, but with an option of robust. The append option is used to add new columns to the existing ones in the file name specified. The file called ‘results’ will now have the output data for this regression only, because the replace option replaced the results stored in previously. To illustrate, let’s run a second regression and output it in a word file the same name as before: regress price mpg headroom trunk displacement In our example, if the working directory already had a word file called ‘results’, running outreg2 with this option would replace that existing file with the one containing the regression results. Replace replaces any existing file that has the same name as the one defined in the outreg2 command. Typically, outreg2 is used with other options, most common of which are replace and append. Where ‘directory link’ contains the file path of the folder you want to specify.Ī third way to save the file to specific directory is specifying the file path in the outreg command: outreg2 using E:\abc\results, word Related Article: Using Putexcel to Export Stata Results into Excel Options: replace and append Alternatively, you can define a working directory for the Stata file you are working in through: cd “directory link” If you are working in a do-file and have already saved it in a folder, Stata will save the ‘results’ file in the same folder. In addition to regression coefficients, the table also reports their standard errors, R-squared, and the number of observations.Īnother link, ‘dir’ will take you to the folder where the word file with the regression output was actually saved. You can also specify options of excel and/or tex in place of the word option, if you wish your regression results to be exported to these formats as well.įollowing the command, a link called ‘results.rtf’ would appear in your Stata window, clicking on which will open a word processing file with the regression results in a table. The option of word creates a Word file (by the name of ‘results’) that holds the regression output. Using results indicates to Stata that the results are to be exported to a file named ‘results’. To export the regression output in Stata, we use the outreg2 command with the given syntax: outreg2 using results, word Related Book: Microeconometrics Using Stata by Colin Cameron ![]() Let us proceed towards using outreg2 by first running the following OLS regression, where the variable ‘price’ is regressed on five other independent variables: regress price mpg headroom trunk gear_ratio displacement This gives you a summary of data characteristics (variable types, labels, etc.). Let’s therefore describe the data through: describe ![]() It is good practice to observe the characteristics of the data before doing any data analysis on it. Where the option of clear ensures that any previous data in Stata’s memory that might still be loaded is erased. To see how the command works, we will load the 1978 Automobile data from Stata through: sysuse auto.dta, clear
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |