Announcement

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

  • Dummy variables to control for years

    Hi,

    By using World Values Survey data, I am analyzing religiosity and intolerance. I have a pooled data of 1990, 1996, 2001, 2007, and 2011 waves. I want to control for years, making the oldest year (1990) as the reference group (i.e., 1990 vs 1996, 1990 vs 2001, 1990 vs 2007, 1990 vs 2011). I tried but in the output it showed two waves as "omitted." Definitely, I am doing something wrong, either building the dummy variables or the syntax I wrote. Can anyone help me with the commands?

    Thank you so much.

  • #2
    Well, you don't show the code that you actually tried or the full output you got, so it's anybody's guess what, if anything, is wrong with it. Also, the problem may be arising from problems in your data, and you don't show any of that either. Most likely, in fact, is that nothing is wrong. Rather you may have a collinearity relationship between the year variables and some other variable in your analysis that causes the omission of an additional year indicator (dummy). But with only imaginary code, data and results, only imaginary help can be provided.

    Comment


    • #3
      Welcome to the Stata Forum/Statalist,

      the use of - ib#,year - notation will allow you to select the reference group. That being said, sharing exactly what you typed (plus results, etc., as per FAQ), is the best approach to entail a helpful reply.
      Best regards,

      Marcos

      Comment


      • #4
        Alex:
        welcome to this forum.
        To obtain the most out of your participation to this forum I would strongly recommend you to take a look at the FAQ. Thanks.
        What you're seemingly after can probably be done with -regress- (if you have survey data, take a look at the -svy:- prefix).
        You do not show us what you typed and what Stata gave you back (as per FAQ), so what follows heavily relies on guess-work.
        The omission of one level of a categorical variable is mandatory to avoid the so called dummy trap (https://en.wikipedia.org/wiki/Dummy_...le_(statistics)).
        Other omission can be due to missing values and collinearity.
        Sorry, but without further details I cannot reply more positively.

        PS: When I joined to the party, Clyde and Marcos had alredy provided their helpful advice!
        Last edited by Carlo Lazzaro; 19 Nov 2019, 12:38.
        Kind regards,
        Carlo
        (StataNow 18.5)

        Comment


        • #5
          Hi Alex,

          If you could share your command and/or (part) of your data, it would greatly facilitate our help.

          You will not need to manually build the dummies for each set. In fact, you will only need to do:
          Code:
          tab year, gen(year_dummy)
          to get all the necessary dummies you need.

          In regression, you could simply add:
          Code:
          reg y x i.year
          where "i.year" works exactly what you have told us.

          Of course, my commands here are the simplest possible ones, but you might start from here.

          Surely, please share your codes for us to further help you.

          Best, Long

          Comment

          Working...
          X