Announcement

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

  • Calculating means of independent variables by binary dependent variable

    Dear all,

    For my thesis I have to research the causes of employee layoffs for (big) Belgian firms. My data consists of panel data (unbalanced) for period 2011-2020 with +- 185000 observations.

    Context:
    - My dependent variable is binary: 1 = layoff, 0 = no layoff
    - My indepent variables are both continous and binary

    To gain more insight about the bivariate analysis, I want to perform t-tests/Wilcoxon ranksum tests to analyse for example the difference between a firm with a Global Ultimate Owner (binary variable, =1 in case it is true) by LAYOFF variable.
    I ran Wilcoxon ranksum test (because 'global ultimate ownership' binary dummy variable is not normally distributed ofcourse) & in my results I want to be able to give the difference of this binary dummy variable (global ultimate owner) by layoff =1 & layoff = 0.

    My question is the following: how do I calculate the mean of binary variables by layoff =1 & layoff=0? I know that t-tests give the mean as output, but the Wilcoxon ranksum test does not give this and I want to include this information in my thesis to provide additional information for the readers (my professor).

    I tried to run the following code:
    Code:
    mean GUO, by Layoff
    But "by" is not allowed here.

    Thanks in advance! Using stata 16 on windows 11.

    Kind regards,
    Jordi

  • #2
    Try:

    Code:
    bysort Layoff: mean GUO
    Or, more directly:

    Code:
    tabstat GUO, stata(mean sd n) by(Layoff)
    Use help tabstat to learn more.

    Comment


    • #3
      Thank you very much Ken!

      Comment

      Working...
      X