Announcement

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

  • esttab and ttest

    Hi statalist user
    I also want to use esttab for ttest outputs but I am running more than one variable at once using codes below, however the output come with only one variable(the first one). I am sure i missed something in the codes.

    foreach var of varlist seed_bought seed_free seed_agrodealer s4a_23a s4a_23b {
    estpost ttest `var', by(s2_16)
    matrix ttest= (r(mu_1),r(sd_1),r(N_1),r(mu_2),r(sd_2),r(N_2),r(m u_2) - r(mu_1),r(p))
    matrix rownames ttest= `var'
    matrix colnames ttest= Mean1 sd1 N1 mean2 sd2 N2 mean_differences pscore
    esttab `var' using "$dir/output/seeds_source.csv", cells(mu_1 mu_2 t p) wide nonumber star(* 0.1 ** 0.05 *** 0.01)
    }

  • #2
    It would have been much easier with an example data set. Anyway, in the given code, I can see a typo in this line
    Code:
    esttab `var' using "$dir/output/seeds_source.csv", cells(mu_1 mu_2 t p) wide nonumber star(* 0.1 ** 0.05 *** 0.01)
    The correct command would be
    Code:
    esttab  using "$dir/output/seeds_source.csv", cells(mu_1 mu_2 t p) wide nonumber star(* 0.1 ** 0.05 *** 0.01)
    Regards
    --------------------------------------------------
    Attaullah Shah, PhD.
    Professor of Finance, Institute of Management Sciences Peshawar, Pakistan
    FinTechProfessor.com
    https://asdocx.com
    Check out my asdoc program, which sends outputs to MS Word.
    For more flexibility, consider using asdocx which can send Stata outputs to MS Word, Excel, LaTeX, or HTML.

    Comment


    • #3
      One more thing, if you want to write to the same file, then add append at the end of the command, see
      Code:
       
       esttab  using "$dir/output/seeds_source.csv", cells(mu_1 mu_2 t p) wide nonumber star(* 0.1 ** 0.05 *** 0.01) append
      Regards
      --------------------------------------------------
      Attaullah Shah, PhD.
      Professor of Finance, Institute of Management Sciences Peshawar, Pakistan
      FinTechProfessor.com
      https://asdocx.com
      Check out my asdoc program, which sends outputs to MS Word.
      For more flexibility, consider using asdocx which can send Stata outputs to MS Word, Excel, LaTeX, or HTML.

      Comment


      • #4
        This is very brilliant Shah, it actually worked perfect

        Comment

        Working...
        X