Announcement

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

  • Using state fixed effects when you have multiple states observations within each year

    I have survey data where I want to control for state and year effects. The problem is that there are multiple responses within each year for each state. I know I can't use basic panel data commands, but is there a way in Stata to control for year and state with this type of data? There is no simple way to combine the respondents within each state into a single "state" variable; there are many other factors (mostly control variables) involved.

    Any help would be appreciated!

  • #2
    It depends. What are the multiple responses within each state and year? If they are, for example, individuals and the same individuals are represented over the years, then your data is really panel data with the individual as the panel. If those individuals, in turn, are always in the same state, then state is a time-invariant attribute of the individual and it is not possible to estimate state-level effects in a fixed (individual) - effect model. And ignoring the individual level would usually be incorrect. So you would need to use a random effects model, and, actually, a multi-level model (the -me- suite of commands.)

    But if the individuals for a given state are not the same individuals over the years, (i.e., you have different cross-sections of the state each year), then there is no difficulty. There is no individual level nested inside the states, and you can properly -xtset state-, and then also include an i.time covariate to capture time effects. (You do not have to specify a time variable in the -xtset- command unless you are going to use lead/lag operators or estimate autoregressive models. If you don't specify a time variable, Stata will not notice the multiplicity of observations with the same state and time. And specifying a a time variable in the -xtset- command doesn't cause the -xt- commands to model time effects anyway.)
    Last edited by Clyde Schechter; 25 Nov 2016, 23:26. Reason: Expand and clarify the explanation.

    Comment


    • #3
      Thank you for your response. My data falls into the second case: different individuals in different years. The problem I'm running into now is that I am using probability weights, but since they're not consistent within years, I'm getting an error (weight must be constant within year).

      Comment


      • #4
        Are you doing a linear regression? If so, you can skip the -xt- machinery and just do

        Code:
        regress depvar ind_vars i.state i.time [pweight = my_pweight_variable]
        Note that this trick is not usable for a dichotomous outcome model such as -logit- or -probit-.

        Side question: your data evidently come from a complex survey design. You should not be using just the pweights: you should be using -svyset- and the -svy:- prefix so as to also account for primary or higher order sampling units and stratification. Without those, your standard error estimates will be incorrect. Perhaps you are doing that and simply didn't mention it. The same thing works this way after you -svyset- your data.:

        Code:
        svy: regress depvar ind_vars i.state i.time

        Comment


        • #5
          Alas, it is a probit model.

          Your point about the survey is well taken. However, it is a straight probability-weighted survey with individual sampling (i.e., no clustered samples), so I don't know that -svyset- is needed.

          Comment

          Working...
          X