Announcement

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

  • About correlations for a longitudinal data

    Hi,

    I have a dataset for a company and I can follow workers' earnings through years. I am interested in the correlation between two types of workers' (Type A and Type B) earnings through their working years.I wonder that how can I calculate earnings correlation of those workers in their first year, second year, and so on. I tried to use following commands:

    sort numberofworkyears
    egen corr = corr(typea typeb), by(numberofworkyears)
    tabdisp numberofworkyears, c(corr)

    or

    bysort numberofworkyears: corr typea typeb

    However, those two give different correlation coefficient for different years. I could not understand what I did wrong. I hope someone help me on it.

    Best
    Murat Mercan




  • #2
    Is something missing in your description? How did you pair Type A and Type B workers within number of years worked? From the code that you posted, they would be just randomly paired and so the correlation coefficients would be accordingly affected.

    Comment


    • #3
      First of all, thank you for the response. Actually, Type A is male worker and Type B is female worker at the same occupation e.g. accountants. I paired them according to their working group in the company. Therefore, the pairs do not change but correlation coefficients do.

      Comment


      • #4
        mamercan (just in case, s per FAQ, please note the strong preference on this forum for real given and family names and the way to re-register accordingly. Thanks).
        I would take a step aside and consider -xtreg-:
        Code:
        xtset id_workers years
        xtreg ln_wage i.company i.gender, re
        I would consider -re- specification as a provisional proposal, assuming that you're interested in estimating the coefficients of time-invariant predictors, such as gender and, possibly, company.
        However, if this approach is feasible, please take a look at -hausman- outcome bfore ruling out the -fe- specification on a a priori base.
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment


        • #5
          Hi Carlo,

          First of all, thank you for the response and I applied to change my username (I'm sorry for it).

          I need to calculate the correlation through years i.e. I wonder that does correlation between earnings increase or decrease through time. I want to estimate earnings correlations for workers who worked one year, earnings correlations for workers who worked two years, and so on. Do I use xtreg for it?

          Sincerely
          Murat Mercan

          Comment


          • #6
            Murat:
            not quite.
            As any other regression model, it would show the effect of each predictor in explaining the variation in the dependent variable (adjusted for the remaining predictors).
            Are you testing whether the gender-specific difference in wages decreases as the job tenure increases?
            Kind regards,
            Carlo
            (Stata 19.0)

            Comment


            • #7
              Yes, I exactly want to test it. Do you have a suggestion?

              Comment


              • #8
                Murat:
                I would try something along the following lines to investigate the interactions between gender (categorical variable) and tenure years (continuous variable) and a possible turning point for tenure:
                Code:
                xtset id_workers years
                xtreg ln_wage i.company i.gender##c.tenure c.tenure#c.tenure, re
                Kind regards,
                Carlo
                (Stata 19.0)

                Comment

                Working...
                X