Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: How to combine ttest and regression estimates in one table

From   Evert Reins <>
Subject   Re: st: How to combine ttest and regression estimates in one table
Date   Wed, 5 Feb 2014 18:22:39 +0100

Hello Sergiy,
thanks for your profound answer. I will use your advice concerning the
illustration of tables in my further works in order to prevent any
missunderstandings due to the different layouts of mail clients and
browsers. Thank you! Furthermore, you really helped with the clue that
estimates can be stored and used later on. That is what I was looking
for. In the end, I conducted the table a bit differently than your
suggestion, because I am somewhat more familiar with the -esttab-
I used the following code:

bysort State: eststo: reg earningsyear4 treatmnt avgunemployment
avgminimumwage avggdptotal avggdprrate

esttab est*  using estimates.csv, replace

Then a little extra work in Excel had to be done in order to structure
the table and make it understandable .


2014-02-05 Sergiy Radyakin <>:
> Evert, Stata can write any results to Excel, but the layout it up to
> you. Use the xl  class in Mata and with a couple of loops you should
> be ok. Sergiy.
> PS: either gmail or your mailer, or Stata itself is wrapping the lines
> so heavily, it is not possible to recognize a table in your posting.
> With long texts, it is safer to write:
> c11 c12 c13
> c21 c22 c23
> c31 c32 c33
> ---------------------------------------------
> c11="State"
> c12="Regression coefficient"
> c13="Impact of unemployment rate"
> c21="Alabama"
> ...
> ---------------------------------------------
> // Example code to write something to an XLS file:
> sysuse auto
> regress price weight length if foreign
> regress price weight length if !foreign
> // do whatever estimations and save the results from e() or r()
> //.....
> // output the results to Excel
> mata
>   b=xl()
>   b.create_book("Results","Sheet1")
>   b.put_string(1,1,"Variable")
>   b.put_string(1,2,"Coefficient")
>   b.put_string(1,3,"Test")
>   b.put_string(2,1,"weight")
>   b.put_string(3,1,"length")
>   b.put_number(2,2,0.654)
>   b.put_number(2,3,0.124)
>   b.put_number(3,2,0.434)
>   b.put_number(3,3,0.294)
> end
> On Tue, Feb 4, 2014 at 4:52 PM, Evert Reins <> wrote:
>> Dear Stata List users,
>> I want to combine ttest and regression estimates in one table.
>> I am currently working on my bachelor thesis in economics. In this regard,
>> I conduct an analysis of the impact effects of "Job Corps" a program
>> implemented by the DOL, which helps young people to find access to the
>> labor market. Anyways, I am approaching the question, whether there is a
>> correlation between the earnings of participants in the program and the
>> economic situation in the state, where they live and work in. Therefore, I
>> so far generated a data set which yields information about the earnings and
>> state of residence, their belonging to the treatment (control)group (binary
>> variable 0/1), plus key indicators for the economy of the state (minimum
>> wage, unemployment rate, gdp growth rate...).
>> Now I want to generate a table which shows the ttest values for difference
>> in earnings for the treatment variable per participant (1st column) sorted
>> by state combined with the regression outcomes for each indicator,
>> regarding the earnings. To illustrate, it should look something like this:
>> State                   difference in earnings                   impact
>> of uenemployment rate               ....
>> Alabama              difference in dollars                      regression
>> coefficient (t-value)                ....
>> Alaska
>> -$152                                                    1.5677 (1.98)
>> Thanks for your consideration
>> *
>> *   For searches and help try:
>> *
>> *
>> *
> *
> *   For searches and help try:
> *
> *
> *
*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index