Announcement

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

  • logit fixed effect

    Hi,
    I need help with logit fixed effects.
    I have panel data.
    Firm Country year Y X1 X2
    1 US 2010
    1 US 2011
    2 Japan 2010
    2 Japan 2011
    2 Japan 2012
    2 Japan 2013
    3 US 2008
    I wish to do firm-year level logit analysis. However, I need to use country*year fixed effect. (The reason is that I have some time-invariant country-level control variables. If I only include country FE, they will drop. Therefore, I use year dummy multiply by country dummy.)
    First I tried: xtlogit y x1 x2 i.country#i.year, vce(cluster firm)
    Stata runs like 30 mins (but I only have around 2000 obs) and shows:
    "calculation of robust standard errors failed"

    Then I tried to run the same model without cluster: xtlogit y x1 x2 i.country#i.year
    The results shown as: "Random effects logistic regression". Also, the number of observation is only 925 which should be around 2000.
    I don't know why here shows random effect. I am actually just add country*year dummy into my logit model.

    Second I tried: xi logit y x1 x2 i.country*i.year, vce(cluster firm)
    Stata runs forever.... It keeps showing Iteration 1: log pseudolikelihood = -291.60543 (not concave)
    I don't know what's going on here... Could you please help me?

    Thanks.
    Lily

  • #2
    When you try to put a square peg into a round hole, it is not going to fit. What you have here is three-level data and you are trying to force it into a two-level model. Something is going to have to give.

    That said, if you insist on that framework, you should understand some things about -xtlogit- that are currently puzzling you:

    1. -xtlogit-, like any other estimation command in Stata, omits from the analysis any observation for which any of the variables mentioned in the model has a missing value. This will probably account for most of the missing observations in your analysis.

    2. In addition, -xtlogit- has three "flavors": fixed effects, random effects, and population averaged. Random effects is the default. If you were expecting to do fixed effects, then you need to specify the -fe- option.

    3. While including indicator ("dummy") variables in a linear model is equivalent to doing a fixed-effects regression, that is not true in logistic regression.

    4. When you do go to -xtlogit, fe-, you may find that even fewer observations are included. This is because -xtlogit- will drop any panels (defined by your -xtset- command) which exhibit no variation in the outcome variable. In addition, if any of your predictor variables perfectly predict the outcome, those variables will be removed from the model, and those observations taking on value of those variables that perfectly predict the outcome will be omitted as well. Stata will notify you of these omissions if they occur. They will appear as messages before the iterated maximum likelihood output. Added note: these additional exclusions are applied based on how the data look after the observations described in 1 above are dropped. So there may be outcome variability in a panel in the full data set, but after observations with some missing values are dropped, if only all 0 or only all 1 outcomes remain for that panel, then the entire panel will be dropped. Similarly, perfect prediction is assessed on what remains of the data after observations that have missing values for any variable are dropped.

    5. If you do a fixed-effects regression with firm as the panel variable, you will not be able to estimate country effects as they will be constant within panel.

    Also note that using -xi:- will not improve anything going on compared to factor variable notation here, and it will prevent you from using the -margins- command subsequently.

    Since you haven't actually run the fixed effects model you are looking for yet, I don't think we should spend time trying to troubleshoot the convergence issues you encountered. They may recur with fixed effects, or they may not. If you do find that Stata "spins its wheels" with the fixed effects model, too, then you should do the following:

    A. Note the number of the iteration at which the output becomes repettive.

    B. Re-run the model, adding the -iterate(#)- option, where you replace # by a number that's just a little bit larger than what you noted in A.

    C. The model will now terminate after that number of iterations. The results are not usable as valid results. But, repost here showing the exact command you used and the exact output you got from Stata. There will be clues in the output about what is causing the model to fail to converge. Be sure to post it all in between code delimiters so it aligns properly and is easy to read. (If you are not familiar with code delimiters read forum FAQ #12 for instructions.)

    I am somewhat reluctant to advise you on how to go about putting your three-level data into the procrustean bed of a two-level fixed-effects model, for I would not do this myself. I would use a three-level mixed effects model instead. But if you must use a two-level fixed-effects model, probably the least bad option is to -xtset country-, include i.country#i.year in the model, and use vce(cluster country). In effect you are ignoring firm level effects in doing this. That sounds like a serious mis-specification to me, but the alternatives are all worse than that, in my view.
    Last edited by Clyde Schechter; 02 Oct 2017, 21:25.

    Comment


    • #3
      Hi Clyde,
      Thank you very much for your reply! That's very helpful. I don't think I will use country-year instead of firm-year. I will reconsider the model... Thanks again.
      Kind regards,
      Lily

      Comment

      Working...
      X