Announcement

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

  • Panel regression with fixed effects

    Hello
    I have 1.16 Mio loan applications (id=1-1.16Mio), the variables loan amount, the issue date, the social capital index and a dummy default variable.

    I run dataex for my unbalanced panel data:

    id loan_amnt issue_d sc_index Default
    1 5000 17318 -.07571 0
    2 7500 17318 -.53657 0
    3 3000 17318 -.95809 0
    4 5000 17318 -.93935 0
    5 3000 17318 -.07511 0
    6 2500 17318 .4645 0
    7 2525 17318 .34468 0
    8 3000 17318 .81892 0
    9 1000 17318 -.38692 0
    10 6500 17318 .34468 0
    11 2600 17318 -.96961 1
    end
    format %tdCCYY-NN issue_d


    My goal is to run regress/xtreg with the dependent variable "Default" and independent variable "sc_index". I also want to include time fixed effects.
    I run:
    xtset id
    xtreg Default sc_index i.issue_d, fe

    However, it does not run due to "collinearity".

    "note: sc_index omitted because of collinearity
    note: 17348.issue_d omitted because of collinearity
    note: 17379.issue_d omitted because of collinearity
    .
    .
    note: 21336.issue_d omitted because of collinearity"

    Does anyone have an idea how I can run the regression with fixed effects or what I did wrong?
    I read many posts and comments regarding fixed effects in this forum. Unfortunately, I can't get any further at this point.




  • #2
    I also run
    reg Default sc_index i.issue_d i.county (however: cannot be estimated because too many dummies are generated)

    I used i.county for county fixed effects.
    Am I right that those are panel data or do I have cross-sectional data?

    Comment


    • #3
      Hi,
      you have panel data when the same individuals / firms, etc... are observed repeatedly. From what I understand from your description, this is probably not the case.
      First of all, your outcome is binary, so a OLS regression is probably not what you want. Try a logistic regression instead (logit or probit).Also make sure that you use factor variable notation unless all your dummies are 0/1 coded. Regarding the error code try:
      Code:
      set maxvar 32767
      Best wishes

      Stata 18.0 MP | ORCID | Google Scholar

      Comment


      • #4
        Hello Jane,

        If you are attempting to control for unobserved heterogeneity across individuals, than a fixed effects approach may be the correct one. Effectively, one uses such an approach to difference out the time-constant effects. Assuming that your model satisfies other assumptions (strict exogeneity, homoskedasticity, etc.) then you may follow through with a FE approach. Ideally, you want a balanced panel.

        The problem in the above, as far as I can tell, is that your dependent variable of interest is binary, and thus may require a different model specification. Try to check out xt commands for binary explained variables. For instance, xtlogit.


        Best,


        Scott

        Comment


        • #5
          Thank you so much for your help Scott and Felix! You definitely put me on the right track.
          My new command is:

          Logit Default sc_index
          quietly reg Default sc_index
          margins, dydx(*) atmeans

          This code runs perfectly.

          When I run xtlogit (after setting xtset id) I get the error "outcome does not vary in any group; r(2000)"
          As far as I am concerned, I would say this command does not work because I do not have panel data.

          However, I still need to control for time fixed or county fixed effects.
          Do you know how I can control for "years" using the Logit command?

          Comment


          • #6
            Well, usually just include the time effect in the logit regression, like:
            Code:
            logit default c.index i.TIME
            However, the warning you receive is quite strange. Did you check the distribution of your time variable? Are there many groups with the same values? This could be a problem maybe.
            Best wishes

            Stata 18.0 MP | ORCID | Google Scholar

            Comment


            • #7
              The code you posted is working. Thanks a lot!!

              Comment

              Working...
              X