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
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
Comment