Announcement

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

  • Syntax for obtaining regression output with male and female categories of sex

    Hello, I want to run a regression command with a dependent variable and sex. But I want the sex variable to reflect in both categories of male and female. The dataset already has the male and female coded in binary forms (male =0 and female =1). So, what syntax should I use? Do I still need to create dummy variables? how do I go about that? Thank you.

  • #2
    In a standard regression, if you have a discrete variable with n categories, one of them must be omitted, and the remaining n-1 are included in the list of regressors. This is necessary because if you try to include all n categories, they will be colinear with the constant term. That makes the regression model unidentifiable--so Stata will drop something automatically to resolve this difficulty. If you have only one such variable, you can get around this by specifying the -nocons- option, and then you will be able to list all n categories among the regressor variables. But if you have more than one such variable, this trick will not work.

    The usual way to structure a regression of the type you describe is:
    Code:
    regress dependent_variable i.sex
    In your case, because you coded male = 0, you will get output that includes a constant term as well as a coefficient for female, which represents the difference in the expected value of the dependent variable between females and males. The simplest way to see the expected value of the dependent variable directly in both males and females, follow the regression with:
    Code:
    margins sex

    Comment


    • #3
      Thank you Clyde

      Comment

      Working...
      X