Announcement

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

  • Panel data ttest

    Hi,
    I'm comparing data (sales) of private equity backed companies (variable pe=1) and non-private equity backed companies (variable pe=0).
    I have panel data (846 companies over 6 years).
    I would like to run a ttest for equality of means of sales in the two groups of companies.


    Is the following command correct? ttest sales, by (pe)
    Or should I use another command as I'm dealing with panels?


    Thanks

    Elisa

  • #2
    Elisa:
    welcome to the list.
    Why not considering one of the -xt- regressions, as you're dealing with panel data?
    Kind regards,
    Carlo
    (Stata 18.0 SE)

    Comment


    • #3
      maybe a little more detail will help: using ttest will not be correct for panel data as the SE's will be too small; since regression is a ttest (e.g., when the only covariate is a 0/1 indicator (dummy) variable, you will get the exact same result as using the ttest command; further, if your panel data are unbalanced, even the difference in means supplied by the ttest will be incorrect; note also that you show a space after the "by" and before the parentheses and that will cause an error

      as Carlo suggest, you could use xtset first and then xtreg:
      Code:
      xtset panelvar
      xtreg sales pe
      assuming that pe is coded 0/1

      if the panel is balanced, or if you want the "raw" difference in means you could also use:
      Code:
      regress sales pe, vce(cluster panelvar)
      in the above replace "panelvar" with the actual name of the panel variable

      Comment

      Working...
      X