Announcement

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

  • Exporting summary stats and balance checks in same latex table

    Hi, I am trying to create a table in Tex with 6 columns: the first five being summary statistics and the last a balance check between two different treatment groups on a number of variables.

    This is the code I am using:
    Code:
    est clear
    *Index 1
        * All
        *Column1: T1
        eststo col1: estpost su hhsize num_young num_senior adult_fem im_married im_age if t1==1 
        *Column 2: T2
        eststo col2: estpost su hhsize num_young num_senior adult_fem im_married im_age if t2==1
    
        * Applied
        *Column 3: T1
        eststo col3: estpost su hhsize num_young num_senior adult_fem im_married im_age if t1==1 & selfselect==1
        *Column 4: T2
        eststo col4: estpost su hhsize num_young num_senior adult_fem im_married im_age if t2==1 & selfselect==1
        *Column 5: Control 
        eststo col5: estpost su hhsize num_young num_senior adult_fem im_married im_age if NVH==1 & selfselect==1
        
    local index1 hhsize num_young num_senior adult_fem im_married im_age
        *Column 6: Balance 
        foreach var in `index1'{
        keep if t1==1 | t2==1
        eststo `var'_a: areg `var' t1, a(cluster_code_new) cluster(cluster_code_new)
        }
        esttab *_a, se nostar 
    
    matrix A = r(coefs)
    
    local a_rnames : rownames A
    local models : coleq A
    local models : list uniq models
    local i 0
    
    foreach name of local a_rnames {
    local ++i
    local j 0
    capture matrix drop b
    capture matrix drop se
    foreach model of local models {
    local ++j
    matrix tmp = A[`i', 2*`j'-1]
    if tmp[1,1]<. {
    matrix colnames tmp = `model'
    matrix b = nullmat(b), tmp
    matrix tmp[1,1] = A[`i', 2*`j']
    matrix se = nullmat(se), tmp
    }
    
    }
    
    ereturn post b
    quietly estadd matrix se
    eststo a_`name'
    }
    
    
            
        # delimit ;
        esttab using "summarystats.tex", 
             cells( mean(fmt(2)) sd(fmt(2) par([ ])))  
             starlevels(* .10 ** .05 *** .01)     
             mtitles("\specialcell{Voucher \\ only }" 
                     "\specialcell{Voucher \\ +extra stipend}" 
                     "\specialcell{Voucher \\ only }" 
                     "\specialcell{Voucher \\ +extra stipend}" 
                     "\multirow{3}{*}{\specialcell{ Control group }}" 
                     "\specialcell{Balance between \\treatment groups}" 
                     ) 
                varlabels(hhsize "Household size" num_young "Number of young dependents" num_senior "Number of senior dependents"  adult_fem "Number of adult females" im_married "Respondent is married" im_age "Respondent's age")
                posthead("\hline")
                postfoot("\hline")
                booktabs
                fragment
                nonotes
                collabels(none)
                replace;
            
            
            ;
        # delimit cr
    But I am not getting any of the balance results in the exported tex file, and I also don't know how to specify that I want the standard deviation in parentheses for the first 5 columns but the SE for the last column. Any help would be appreciates.

    Thanks in advance.

  • #2
    Hello Adrienne
    It is unfortunate am not offering help on what you seek, mine is rather seeking help from you. I have a treatment and control group from which we gathered baseline data...Now I want to conduct an equivalence/balance checks with the baseline data. Please how do I do it or what are the commands. its really urgent ..please

    Comment

    Working...
    X