Announcement

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

  • Fixed effect for a month

    I'm working with a panel data set (unbalanced) with year and month on it. I grouped by the household for a fixed effect with logistic regression. I get results when I do for a year (combining all months' observation). However, when I do fixed effect for a particular month it gives me an error
    Code:
    outcome does not vary in any group
    I was wondering what's missing here for month by month (a single month) fixed effect?

  • #2
    Well, without seeing an example of your data, it is hard to be certain. But as best I can make out from your description, you have monthly data on households. If you include fixed effects for both households and restrict the data to a particular month, you are left with only one observation per household. The "group" that your error message is referring to is the household (the panel variable). So each household has only a single observation included, so, of course, there is no variation of outcome within any household. So it is not possible to do fixed effects regression that way.

    I'm making a few assumptions here about both your data and what you did. If my response does not clear things up for you, then post back showing:

    1. The exact code you did that produces the error along with the complete exact output that Stata gave you (including any notes or messages), enclosed between code delimiters so it is readable.

    2. An example of your data set including the full data for two or three households. Also be sure the data example includes all of the variables that appear in the regression, along with the household id variable and the month variable. Use the -dataex- command to show the example data.

    If you are running version 16 or a fully updated version 15.1 or 14.2, -dataex- is already part of your official Stata installation. If not, run -ssc install dataex- to get it. Either way, run -help dataex- to read the simple instructions for using it. -dataex- will save you time; it is easier and quicker than typing out tables. It includes complete information about aspects of the data that are often critical to answering your question but cannot be seen from tabular displays or screenshots. It also makes it possible for those who want to help you to create a faithful representation of your example to try out their code, which in turn makes it more likely that their answer will actually work in your data.


    If you are not familiar with using code delimiters in this Foroum, please read Forum FAQ #12 for instructions.

    Comment


    • #3
      My data set look like this (3 households observation are here)

      Code:
      * Example generated by -dataex-. To install: ssc install dataex
      clear
      input str12 ssuid int rhcalyr long rhcalmn byte wlfs float(lag_hlfs wage wagesqadj) double unemp float lag_wlfs
      "019128000276" 2008  6 0 . 32 10.24    6 .
      "019128000276" 2008  7 0 3 32 10.24  6.3 0
      "019128000276" 2008  8 0 3 32 10.24  6.7 0
      "019128000276" 2008  9 0 3 32 10.24    7 0
      "019128000276" 2008 10 0 3 32 10.24  7.4 0
      "019128000276" 2008 11 0 3 32 10.24  7.8 0
      "019128000276" 2008 12 0 3 32 10.24  8.3 0
      "019128000276" 2009  1 0 3 32 10.24  8.8 0
      "019128000276" 2009  2 0 3 32 10.24  9.3 0
      "019128000276" 2009  3 0 3 32 10.24  9.8 0
      "019128000276" 2009  4 0 3 32 10.24 10.1 0
      "019128000276" 2009  5 0 3 32 10.24 10.4 0
      "019128000276" 2009  6 0 3 33 10.89 10.5 0
      "019128000276" 2009  7 0 1 33 10.89 10.7 0
      "019128000276" 2009  8 0 1 33 10.89 10.8 0
      "019128000276" 2009  9 0 1 33 10.89 10.9 0
      "019128000276" 2009 10 0 1 33 10.89   11 0
      "019128000276" 2009 11 0 1 33 10.89 11.2 0
      "019128000276" 2009 12 0 1 33 10.89 11.2 0
      "019128000276" 2010  1 0 1 33 10.89 11.3 0
      "019128000276" 2010  2 0 1 33 10.89 11.2 0
      "019128000276" 2010  3 0 1 33 10.89 11.2 0
      "019128000276" 2010  4 0 1 33 10.89 11.1 0
      "019128000276" 2010  5 0 3 33 10.89   11 0
      "019128000276" 2010  6 0 3 34 11.56 10.9 0
      "019128000276" 2010  7 0 3 34 11.56 10.9 0
      "019128000276" 2010  8 0 3 34 11.56   11 0
      "019128000334" 2010  6 1 . 25  6.25  8.5 .
      "019128000334" 2010  7 1 1 25  6.25  8.5 1
      "019128000334" 2010  8 1 1 25  6.25  8.5 1
      "019128000932" 2008  6 1 . 50    25  5.9 .
      "019128000932" 2008  7 1 1 51 26.01  6.1 1
      "019128000932" 2008  8 1 1 51 26.01  6.2 1
      "019128000932" 2008  9 1 1 51 26.01  6.4 1
      "019128000932" 2008 10 1 1 51 26.01  6.6 1
      "019128000932" 2008 11 1 1 51 26.01  6.7 1
      "019128000932" 2008 12 1 1 51 26.01  6.9 1
      "019128000932" 2009  1 1 1 51 26.01    7 1
      "019128000932" 2009  2 1 1 51 26.01  7.1 1
      "019128000932" 2009  3 1 1 51 26.01  7.1 1
      "019128000932" 2009  4 1 1 51 26.01  7.2 1
      "019128000932" 2009  5 1 1 51 26.01  7.3 1
      "019128000932" 2009  6 1 1 51 26.01  7.3 1
      "019128000932" 2009  7 1 1 52 27.04  7.4 1
      "019128000932" 2009  8 1 1 52 27.04  7.5 1
      "019128000932" 2009  9 1 1 52 27.04  7.6 1
      "019128000932" 2009 10 1 1 52 27.04  7.7 1
      "019128000932" 2009 11 1 1 52 27.04  7.8 1
      "019128000932" 2009 12 1 1 52 27.04  7.9 1
      "019128000932" 2010  1 1 1 52 27.04    8 1
      "019128000932" 2010  2 1 1 52 27.04  8.2 1
      "019128000932" 2010  3 1 1 52 27.04  8.3 1
      "019128000932" 2010  4 1 1 52 27.04  8.3 1
      "019128000932" 2010  5 1 1 52 27.04  8.4 1
      end
      I tried with the following reg equation and got the error (that I mentioned earlier)
      Code:
      xtset, clear
      clogit wlfs ib1.lag_hlfs wage wagesqadj unemp if year==2008 & month==8 & lag_wlfs==1, group(ssuid) nolog
      clogit, or

      Comment


      • #4
        Hi Clyde Schechter, based on my data structure, is there any way to do a fixed effect for a single month?
        Thanks.

        Comment


        • #5
          No. The idea doesn't even make sense. If you are going to do a regression for a single month, then just used ordinary regression without -fe-.

          Added: By ordinary regression, in th9is case, I mean -logistic-, the ordinary analog of -clogit-.
          Last edited by Clyde Schechter; 19 Dec 2019, 18:33.

          Comment

          Working...
          X