hello friends
I need to extract the residuals from a simple Linear regression lm(y~x) , but the challenge is I need to run separate regression for each category for each year , then after combining the residual beside each observation .
this is a sample from the data I have 8 categories need to be run for 2 years , we need to run 16 regression , the real sample is for 20 years and for around 40 categories .
below are the data , your help is really appreciated
Thank you