Announcement

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

  • F-tests do not show in Excel output (Stata 14.2)

    Hi everyone,

    I have one very simple question which concerns the results from a regression analysis that I output to Excel.

    I run regressions and perform F tests post hoc to test for the differences between certain variables to be significant. The code I use is included below. Now, all works well and the output in Excel looks great, except the F-test values. That is to say, the output shows all values correctly, but leaves the cells for the p values of the f tests blank.

    To complicate the matter, when a colleague of mine runs the same code, the p values do show. I am using Stata 14.2 and am not sure of the version my colleague is using. Another colleague of mine with the same version of Stata as I have, experienced the same problems: the p values do not show.

    Is this a well-known problem? Does this have sth to do with my version of Stata? If so, what can I do, other than updating to Stata 15? Or is there sth different going on with my code?

    Here the part of the code that should be relevant:

    Code:
    // here are some locals with variables which serve as outcomes, controls, etc. for the regression
    
    
    local i = 1
    local m = 1
    
    
    // estimation loop going through all possible outcomes (which come in dimensions) and running regressions
    
    foreach this_dim in `dims' {
        
        est drop _all
        
        foreach var in ``this_dim'' {
    
            /*
            * ITT - Saturated Without Controls
            xi: reg W3_`var' `x_treatment'  i.W1_village, rob noconstant
            est sto T`m'_`this_dim'_`i'
            estadd ysumm
            test book_only-book_mov=0
            estadd scalar f1 = r(p)
            test book_only-book_ast=0
            estadd scalar f2 = r(p)
            test book_only-book_mov_ast=0
            estadd scalar f3 = r(p)
            sum W3_`var' if control==1
            estadd scalar mean = r(mean)
            estadd scalar sd = r(sd)
            local ++i
    
    }
        
    capture erase "PAPER Business performance\Stata output\T`m'_`this_dim'_ITT.csv"
    
    * csv output
    #delimit ;
        esttab T`m'_`this_dim'_* using "PAPER Business performance\Stata output\T`m'_`this_dim'_ITT.csv", label replace modelwidth(16) varwidth(50) depvar legend cells(b(star fmt(%9.3f)) se(par)) star(* 0.10 ** 0.05 *** 0.01) stats(r2 N mean sd f0 f1 f2 f3, fmt(%9.3f %9.0g %9.3f %9.3f %9.3f %9.3f %9.3f %9.3f) labels("R-squared" "N" "Dependent Variable Mean in Control Group" "Dependent Variable SD in Control Group")) title("`e(title)' of `this_dim'" variables on treatment) keep(book_*);
    #delimit cr
    
        local ++m
    
    }

    I have asked around a lot but to no avail. So, thanks loads in advance for any help you can provide!

    Best,
    Julius

  • #2
    I'm using 14.2 as well. You might stop using xi: because Stata has moved to factor vars. You should too. I can use estadd to the ereturn list regardless of xi or factor variable usage, so I'm assuming it is something to do with the user created esttab program. Check you version of that against what is available is one piece of advice.

    Comment


    • #3
      Julius, welcome to Statalist. Apart from using Google to search for answers to your question, there is a search button at the top right hand corner of the forum page where you can enter specific keywords. Your issue has popped up a few times on Statalist, so refer to the following link for a possible solution

      https://www.statalist.org/forums/for...alar-pseudo-r2

      Comment

      Working...
      X