Announcement

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

  • Averaged data in panel regression

    Hi there,

    I am doing panel data analysis with fixed effects (and also simultaneous quantile regressions) and all my observations are country-year, except one important explanatory variable. This variable is averaged over 5 years, so I have only one observation for a time period of 5 years. I considered assigning this value to all years in that period, but that does not feel right.

    Has anyone an idea how I could handle this problem?

  • #2
    Carlo Maria:
    welcome to this forum.
    The -fe- estimator wipes out all the time-invariant variables: hence, if the variable you're concerned about has the identical within-panel value, Stata will simply omit it.
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Thank you for the welcome Carlo!

      Maybe I should have been more precise with my question: The variable is not identical over the entire panel, but there is only one value for several years in a panel. My panel data are from 1990 - 2018, but the variable concerned has only one observation respectively for the periods 1989-1993, 1994-1998, 1999-2004, 2005-2009, 2010-2014 and 2017-2022. So I am wondering how I can make use of these observations within the context of a fixed effects regression and/or a quantile regression analysis.

      Best regards,
      Carlo

      Comment


      • #4
        Carlo Maria:
        the following toy-example may be useful:
        Code:
         set obs 10
        Number of observations (_N) was 0, now 10.
        
        . g id=1 in 1/5
        
        
        . replace id=2 in 6/10
        
        
        . bysort  id: g year=2021+_n
        
        . bysort id (year): replace wanted=wanted[_n-1] if wanted[_n]==.
        
        
        . list
        
             +--------------------+
             | id   year   wanted |
             |--------------------|
          1. |  1   2022     1000 |
          2. |  1   2023     1000 |
          3. |  1   2024     2000 |
          4. |  1   2025     2000 |
          5. |  1   2026     2000 |
             |--------------------|
          6. |  2   2022     1000 |
          7. |  2   2023     1000 |
          8. |  2   2024     2000 |
          9. |  2   2025     2000 |
         10. |  2   2026     2000 |
             +--------------------+
        
        .
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment


        • #5
          I will try that, thank you!

          Best regards,
          Carlo

          Comment

          Working...
          X