Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Esttab by subgroup add column with differences of coefficients

    Hi Everyone,

    I hope someone might be able to help as I am sitting already quite some time over this problem.

    So, here is the issue:
    I am using the esttab environment to create tables for the latex environment.
    I run a simple estimation for data from a lab experiment and I want to show that treatment effects (Inf, Opt, InfOpt) do not differ signifiantly when subjects play the game in a second round, so I split the sample by Round1 and Round2.

    I can test this by hand (see below), but I would like to show this within the table, basically add a third column that shows the differences of the coefficients and the standard errors and highlights the insignificance. (the code so far shows just the results for the two estimations)

    I tried to create a vector to add it through estadd but this did not work.

    I am sure there must be a much easier and succesful way then the approach I took.

    Could someone help me?

    Thanks!

    Code:
       
    eststo clear
         eststo: reg TransferG1 Inf Opt InfOpt if Round2==0,  vce(cluster Phumid)
    
                        **for ttest**
                        local obs1=e(N)
                        matrix regb = e(b)
                        matrix regV = e(V)
                        local c "Inf Opt InfOpt theta"
                        local tot: word count `c'
    
                        forvalues i=1/`tot'{
                        local a: word `i' of `c'
                        local b1_`a' =regb[1,`i']
                        local v1_`a' =regV[`i',`i']
                        local stdev1_`a'= sqrt(`v1_`a'')*sqrt(`obs1')
                        }
                        
         eststo: reg TransferG2 Inf Opt InfOpt if Round2==1,   vce(cluster Phumid)
    
                        **for ttest**
                        local obs2=e(N)
                        matrix regb = e(b)
                        matrix regV = e(V)                  
                        local c "Inf Opt InfOpt theta"
                        local tot: word count `c'
                        
                        forvalues i=1/`tot'{
                        local a: word `i' of `c'
                        local b2_`a' =regb[1,`i']
                        local v2_`a' =regV[`i',`i']
                        local stdev2_`a'= sqrt(`v2_`a'')*sqrt(`obs2')
                        }
    
                        **ttest**                   
                        qui:ttesti `obs1' `b1_Inf' `stdev1_Inf' `obs2' `b2_Inf' `stdev2_Inf'
                        qui:ttesti `obs1' `b1_Opt' `stdev1_Opt' `obs2' `b2_Opt' `stdev2_Opt'
                        qui:ttesti `obs1' `b1_InfOpt' `stdev1_InfOpt' `obs2' `b2_InfOpt' `stdev2_InfOpt'
                        qui:ttesti `obs1' `b1_theta' `stdev1_theta' `obs2' `b2_theta' `stdev2_theta'
    
         esttab using "panel_reg_ols_split_game$output",  b(3) se(3)  scalars(r2 F )  nogaps coeflabels(_cons "Baseline ($\tilde{\theta}$)") ///
                    nonote label ti("Split Samples by Round: Transfer Differences - OLS"\label{tab:panelregolssplit}) ///
                    star(* 0.10 ** 0.05 *** 0.01) ///
                    addn("Pooled OLS estimators; s.e. in paranthesis, clustered on individual level" "{\tiny (1) Transfer decisions in Round 1" "(2) Transfer decisions in Round 2;")  replace
Working...
X