Dear all,
I am running a few regressions that include factor variables and their interactions, and I would like outreg2 to display factor value labels instead of factor values in the interactions. Here's an example of what I mean.
I create a fictitious MAXSPEED variable with 4 levels:
Run the following regression and save the results to 'myfile.txt':
The regression produces the following output
But outreg2 only returns factor values for the interactions:
I am aware of the fact that when the option 'label' is used, the value labels are printed with the main effects (as with Car Type above). But what if we did not want to include the main effects? Regardless of this, some of us might find the output in Stata's results window more aesthetically pleasing.
A similar question was asked recently by another user (Michael Anbar) and got no reply here but he did get a suggestion from Stacktoverflow to use estout instead (http://stackoverflow.com/q/29679981/2766558). I post it again because I couldn't find an answer in the pre-April archives and, if there is no option to do this, it would be a great addition to outreg2.
Thanks in advance.
P.S. This is my first post. My apologies for any rookie mistakes I may have made (including not searching through this forum or the archives more thoroughly).
I am running a few regressions that include factor variables and their interactions, and I would like outreg2 to display factor value labels instead of factor values in the interactions. Here's an example of what I mean.
I create a fictitious MAXSPEED variable with 4 levels:
Code:
sysuse auto, clear set seed 1234 gen maxspeed = round(runiform()*3)+1 label define speed 1 "Light" 2 "Ridiculous" 3 "Ludicrous" 4 "Plaid" label values maxspeed speed
Code:
reg price mpg weight i.foreign i.foreign#i.maxspeed outreg2 using myfile, seeout replace label
Code:
Source | SS df MS Number of obs = 74 -------------+------------------------------ F( 9, 64) = 8.10 Model | 338256360 9 37584040 Prob > F = 0.0000 Residual | 296809036 64 4637641.19 R-squared = 0.5326 -------------+------------------------------ Adj R-squared = 0.4669 Total | 635065396 73 8699525.97 Root MSE = 2153.5 -------------------------------------------------------------------------------------- price | Coef. Std. Err. t P>|t| [95% Conf. Interval] ---------------------+---------------------------------------------------------------- mpg | 54.82039 77.72798 0.71 0.483 -100.4591 210.0999 weight | 3.458109 .6816211 5.07 0.000 2.096414 4.819804 | foreign | Foreign | 5116.416 1318.91 3.88 0.000 2481.59 7751.242 | foreign#maxspeed | Domestic#Ridiculous | 600.8878 850.1522 0.71 0.482 -1097.487 2299.262 Domestic#Ludicrous | 410.7065 809.4843 0.51 0.614 -1206.424 2027.837 Domestic#Plaid | 1054.297 981.5494 1.07 0.287 -906.5734 3015.167 Foreign#Ridiculous | -1792.409 1304.103 -1.37 0.174 -4397.654 812.8358 Foreign#Ludicrous | -1487.636 1435.987 -1.04 0.304 -4356.349 1381.078 Foreign#Plaid | 762.8078 1876.151 0.41 0.686 -2985.236 4510.851 | _cons | -6947.346 3678.932 -1.89 0.064 -14296.86 402.1645 -----------------------------------------------------------------------------------
Code:
(1) VARIABLES Price Standard errors in parentheses *** p<0.01, ** p<0.05, * p<0.1 Mileage (mpg) 54.82 (77.73) Weight (lbs.) 3.458*** (0.682) Car type = 1, Foreign 5,116*** (1,319) 0b.foreign#1b.maxspeed 0 (0) 0b.foreign#2.maxspeed 600.9 (850.2) 0b.foreign#3.maxspeed 410.7 (809.5) 0b.foreign#4.maxspeed 1,054 (981.5) 1o.foreign#1b.maxspeed 0 (0) 1.foreign#2.maxspeed -1,792 (1,304) 1.foreign#3.maxspeed -1,488 (1,436) 1.foreign#4.maxspeed 762.8 (1,876) Constant -6,947* (3,679) Observations 74 R-squared 0.533
A similar question was asked recently by another user (Michael Anbar) and got no reply here but he did get a suggestion from Stacktoverflow to use estout instead (http://stackoverflow.com/q/29679981/2766558). I post it again because I couldn't find an answer in the pre-April archives and, if there is no option to do this, it would be a great addition to outreg2.
Thanks in advance.
P.S. This is my first post. My apologies for any rookie mistakes I may have made (including not searching through this forum or the archives more thoroughly).
Comment