Announcement

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

  • #16
    Philippe:
    not quite.
    You should create one variable only that includes all the years the time dimension of your panel dataset is composed of (put differently: you should group together all your -year- dummies in an unique categorical variable, each level of which relates to a given year).
    Then you should -xtset- you dataset:
    Code:
    xtset panelid timevar
    The -paneid- tells Stata that you have a panel dataset and that you're going to investigate panel-wise heterogeneity.
    Eventually, you can add in the righ-hand side of your regression equation, -i.year- among predictors.

    I do recommend you to give a comprehensive reading to -xtset- and -xtreg- entries in Stata .pdf manual before starting your analysis: it might sound time-consuming (and this impression is, at least at the beginning, true) but the long-lasting rewarding is worth the effort (see also William Lisowski 's wise recommendation on this forum about reading and re-reading Stata .pdf manual in order to increase your knowledge of this wonderful software and increase yiour statistical skills through its many worked-out examples).
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #17
      Thanks Carlo, I'll try and squeeze in some time to learn Stata better!

      Out of interest, is the previous method of me creating a large number of time variables always wrong, or just only wrong for Stata? I am concurrently doing another analysis in EViews and use all these dummy variables there, with me now becoming a bit uncertain about my general approach.

      Cheers for any answer.

      Best,

      Philippe

      Comment


      • #18
        Philippe:
        I have a scant smattering of EViews; hence I cannot tell.
        As far as Stata is concerned, not only is -fvvarlist- notation more efficient than mysefl in creating categorical variables and interactions, but it also has a tight (and auomatic) relationship with two useful Stata commands, such as -margins- and -marginsplot-.
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment


        • #19
          Sorry for the late response Carlo, but thank you. I have followed your advice earlier and learned more about Stata. I have now began using it again and found a new, albeit slight, problem. I'll make a new topic for it though, as it does not relate to this original question.

          Comment


          • #20
            Phillppe:
            the whole process is hopefully made clearer by the following toy-example:
            Code:
            . set obs 4
            number of observations (_N) was 0, now 4
            
            .  g id=1
            
            . g Year_2020=1 in 1
            (3 missing values generated)
            
            . g Year_2021=1 in 2
            (3 missing values generated)
            
            . g Year_2022=1 in 3
            (3 missing values generated)
            
            . g Year_2024=1 in 4
            (3 missing values generated)
            
            . foreach var of varlist Year_* {
              2. replace `var'=0 if `var'==.
              3. }
            (3 real changes made)
            (3 real changes made)
            (3 real changes made)
            (3 real changes made)
             
            . g Cum_Year=_n
            
            . label define Cum_Year 1 2020 2 2021 2 2022 3 2023 4 2024
            
            . label val Cum_Year Cum_Year
            
            . tab Cum_Year
            
               Cum_Year |      Freq.     Percent        Cum.
            ------------+-----------------------------------
                   2020 |          1       25.00       25.00
                   2022 |          1       25.00       50.00
                   2023 |          1       25.00       75.00
                   2024 |          1       25.00      100.00
            ------------+-----------------------------------
                  Total |          4      100.00
            
            
            . list id Cum_Year
            
                 +---------------+
                 | id   Cum_Year |
                 |---------------|
              1. |  1       2020 |
              2. |  1       2022 |
              3. |  1       2023 |
              4. |  1       2024 |
                 +---------------+
            
            .
            Kind regards,
            Carlo
            (Stata 19.0)

            Comment


            • #21
              Thanks for that Carlo, I will absolutely try to implement this much more clean version of my current cluttering dummies when I have time!

              Comment

              Working...
              X