I am using the below mentioned code for getting the value of residuals for 10 different ols regression for each year. I need to apply filter and running all the regression individually all the time. And combining all the data at the end. Please let me know the shortcut for this. I need the residual value for each 10 regression for all years.
Thanks in advance
code
df1 <- nse_indices_return %>% filter(year==2022) # filter for year
# sectoral return
ols1 <- lm(auto ~ nifty50+finserv, data = df1)
ols1$residuals
ols2 <- lm(consumer_durables ~ nifty50+finserv, data = df1)
ols2$residuals
ols3 <- lm(FMCG ~ nifty50+finserv, data = df1)
ols3$residuals
ols4 <- lm(healthcare ~ nifty50+finserv, data = df1)
ols4$residuals
ols5 <- lm(IT ~ nifty50+finserv, data = df1)
ols5$residuals
ols6 <- lm(media ~ nifty50+finserv, data = df1)
ols6$residuals
ols7 <- lm(metal ~ nifty50+finserv, data = df1)
ols7$residuals
ols8 <- lm(oil_gas ~ nifty50+finserv, data = df1)
ols8$residuals
ols9 <- lm(pharma ~ nifty50+finserv, data = df1)
ols9$residuals
ols10 <- lm(reality ~ nifty50+finserv, data = df1)
ols10$residuals
# financial sector return
fin <- lm(finserv ~ nifty50, data = df1)
fin$residuals
# combining all sector returns residual year wise
df_2016 <- cbind(df1$Date,ols1$residuals,ols2$residuals,ols3$residual,
ols4$residuals,ols5$residuals,ols6$residual,ols7$residual,
ols8$residuals,ols9$residuals,ols10$residual,fin$residuals)
df_2017 <- cbind(df1$Date,ols1$residuals,ols2$residuals,ols3$residual,
ols4$residuals,ols5$residuals,ols6$residual,ols7$residual,
ols8$residuals,ols9$residuals,ols10$residual,fin$residuals)
df_2018 <- cbind(df1$Date,ols1$residuals,ols2$residuals,ols3$residual,
ols4$residuals,ols5$residuals,ols6$residual,ols7$residual,
ols8$residuals,ols9$residuals,ols10$residual,fin$residuals)
df_2019 <- cbind(df1$Date,ols1$residuals,ols2$residuals,ols3$residual,
ols4$residuals,ols5$residuals,ols6$residual,ols7$residual,
ols8$residuals,ols9$residuals,ols10$residual,fin$residuals)
df_2020 <- cbind(df1$Date,ols1$residuals,ols2$residuals,ols3$residual,
ols4$residuals,ols5$residuals,ols6$residual,ols7$residual,
ols8$residuals,ols9$residuals,ols10$residual,fin$residuals)
df_2021 <- cbind(df1$Date,ols1$residuals,ols2$residuals,ols3$residual,
ols4$residuals,ols5$residuals,ols6$residual,ols7$residual,
ols8$residuals,ols9$residuals,ols10$residual,fin$residuals)
df_2022 <- cbind(df1$Date,ols1$residuals,ols2$residuals,ols3$residual,
ols4$residuals,ols5$residuals,ols6$residual,ols7$residual,
ols8$residuals,ols9$residuals,ols10$residual,fin$residuals)
return_residual <- rbind(df_2016,df_2017,df_2018,df_2019,df_2020,
df_2021,df_2022)
head(return_residual)
colnames(return_residual) <-c("auto","consumer_durables","FMCG","healthcare",
"IT","media","metal","oil_gas","pharma","reality",
"finance")
sample data
date year auto bank commodities consumer_durables energy finserv FMCG healthcare housing infra IT media metal nifty50 oil_gas pharma reality service trans_logist
31-01-2022 2022 1.82801 0.7587 0.53744 1.97096 1.24387 0.92058 0.77083 1.33413 0.80828 1.58298 2.8731 1.40171 0.13538 1.39107 1.48207 1.51621 3.1354 1.37206 1.71988
28-01-2022 2022 -0.58988 -0.77063 1.04379 0.40379 0.48866 -0.50442 0.61585 1.49777 0.26045 0.55652 1.12591 0.86708 0.37 -0.04792 0.54672 1.05192 0.76823 -0.04934 -0.08179
27-01-2022 2022 0.33716 0.73024 -0.9388 -2.28425 -0.64492 -0.1498 -1.14353 -2.24565 -0.72632 -1.00586 -3.55082 0.58681 -0.71557 -0.97118 -0.53724 -1.86525 -1.8062 -1.05635 -0.26793
25-01-2022 2022 2.32258 2.0548 1.20375 0.08612 1.192 0.88667 1.22839 0.53958 1.12372 0.97834 -0.32781 2.19656 1.19363 0.75135 0.89595 0.71931 1.8174 0.74608 1.46448
24-01-2022 2022 -2.59952 -1.66803 -3.77432 -3.96034 -2.51678 -2.29179 -2.36751 -1.89993 -3.44815 -2.90563 -3.41968 -4.58656 -5.22943 -2.65679 -2.49649 -1.84587 -5.90391 -2.4372 -2.79485
21-01-2022 2022 -0.18518 -0.73063 -1.8604 -2.9558 -0.84784 -0.50116 0.35849 -1.44282 -1.65765 -1.64015 -1.65743 -3.46792 -1.91386 -0.78758 -1.13857 -1.57452 -2.35563 -0.97623 -0.74038
20-01-2022 2022 -0.84065 -0.50077 -0.0242 -0.66212 -0.09429 -0.7225 -1.14535 -1.3201 -0.02281 -0.13866 -1.66167 -0.7012 0.51801 -1.01124 -0.90438 -1.66488 0.22913 -0.92646 -0.78869
19-01-2022 2022 0.71258 -0.44216 0.20485 -0.03875 0.9539 -1.07615 -1.05791 -0.40133 -0.66351 -0.32536 -2.12658 1.00808 0.79842 -0.96422 0.5396 -0.10878 -0.14921 -1.34204 0.1947
18-01-2022 2022 -2.3777 -0.01531 -2.06279 -1.13578 -0.5144 -0.28588 -1.27866 -1.80712 -1.56445 -2.1616 -1.83791 -1.15535 -2.26292 -1.06538 -0.80633 -1.18918 -2.60608 -0.72626 -2.12044
17-01-2022 2022 2.04586 -0.402 1.34781 0.53206 1.27333 -0.23941 0.45721 -0.88844 0.92528 0.90774 -0.0564 0.49854 0.28954 0.28676 0.60174 -0.72829 1.27551 -0.01012 1.37361
14-01-2022 2022 -0.36881 -0.25877 0.02656 0.20726 0.20268 -0.24554 -0.71218 -0.63796 0.02375 0.28507 0.56946 -0.30338 -0.19294 -0.01123 -0.16866 -0.61917 1.15125 0.24825 0.11768
13-01-2022 2022 0.34562 -0.66516 1.43658 -0.12688 1.23084 -0.39043 0.2482 1.38858 0.45615 0.65903 0.00583 0.53647 3.47845 0.24956 0.60308 1.57189 -0.71928 -0.14138 0.44767
12-01-2022 2022 1.44777 0.74228 1.5408 -0.01726 2.13512 0.78727 0.37794 -0.17128 0.94878 1.50981 -0.00168 0.81783 1.33058 0.86731 1.45256 -0.14833 1.90782 0.64542 1.15209
11-01-2022 2022 -0.19128 0.24591 -0.34595 -0.12486 1.227 0.29729 -0.35317 0.02627 -0.00898 0.31655 1.02899 -0.04142 -1.89638 0.29134 0.2767 -0.03391 0.56549 0.52448 0.04316
10-01-2022 2022 1.86699 1.61183 0.77281 0.9226 0.57109 1.52587 0.31586 0.09203 0.86261 0.83878 0.1897 2.25135 0.5972 1.07002 0.39137 0.00722 1.92466 1.18903 1.38729
07-01-2022 2022 -0.2271 0.66511 1.45132 -0.23928 0.88616 0.17194 0.6431 -0.20308 0.64231 0.57392 0.34426 -0.82678 0.51008 0.37642 1.25721 -0.3903 0.03089 0.24783 0.00715
06-01-2022 2022 0.53079 -0.54555 -0.69123 0.48835 -0.62675 -0.88266 -0.76086 -0.68944 -0.88744 -0.81322 -1.55442 0.90789 -0.49524 -1.00054 -0.2079 -0.62572 -1.47089 -0.92296 0.278
05-01-2022 2022 1.05437 2.32287 1.17374 -0.19958 0.63178 2.0236 0.29259 -0.31117 1.35112 0.67966 -1.93431 -0.44195 1.37867 0.67396 1.21676 -0.29058 1.20111 0.63469 0.73984
04-01-2022 2022 0.22358 1.14835 0.71847 0.50205 2.2806 1.19306 0.51667 -0.84277 0.79656 1.1656 0.63107 0.00888 -0.37757 1.01868 1.34139 -0.81765 -0.53099 1.01676 0.18503
03-01-2022 2022 1.62432 2.64982 1.63425 1.03041 0.96015 2.48228 0.06945 -0.44432 1.78445 1.22023 1.09248 1.46025 1.92602 1.56534 1.14032 -0.46826 1.13601 1.81298 1.36168
29-01-2021 2021 -2.89394 0.68252 -1.61664 -2.73095 -1.82597 -0.0654 -1.50123 -1.7513 -1.5404 -1.90612 -2.59078 -1.11168 -1.9327 -1.32404 -1.40586 -1.82076 0.49318 -0.91245 -2.24086
28-01-2021 2021 -1.02495 0.24352 0.04636 1.30175 -0.14045 -0.82213 -1.91226 -0.74782 -0.03077 -0.14139 -2.18072 -0.06588 -0.52935 -1.07356 0.32895 -0.79986 -2.20257 -1.09989 -0.71951
27-01-2021 2021 -2.13974 -2.92916 -1.86158 -1.60202 -1.72546 -2.77179 0.30077 -2.00622 -1.88356 -1.40067 -0.60715 -0.61308 -2.51981 -1.90605 -1.81456 -2.0448 -2.17049 -2.13166 -1.7073
25-01-2021 2021 -0.7831 0.09994 -0.79187 -0.52092 -2.82448 0.01222 -0.73104 1.36579 -0.62388 -1.60975 -1.76087 -0.59758 0.15163 -0.92542 -2.32967 1.71144 -0.78027 -0.48084 -1.30251
22-01-2021 2021 1.42847 -3.1679 -1.96604 -1.41807 -1.73279 -2.60441 -0.18583 -0.91372 -2.04381 -1.06388 0.14972 -1.64683 -3.88739 -1.49722 -1.53996 -1.22114 -2.83548 -1.75293 1.21804
21-01-2021 2021 -0.01447 -1.09637 -1.02983 2.72038 -0.18271 -0.74251 -0.32062 -1.51362 -0.47219 -0.92341 -0.63693 -2.03797 -2.17777 -0.37112 -0.9908 -1.42883 -2.55615 -0.7687 0.02956
20-01-2021 2021 2.29313 0.36654 0.6727 0.66415 0.44382 0.31318 -0.15724 0.11684 0.71443 0.74243 2.21245 1.06294 0.93387 0.85083 0.67596 0.11775 0.07393 0.75375 2.26885
19-01-2021 2021 1.76386 1.92728 2.06622 1.73236 1.84759 2.4134 0.45503 1.5036 2.54924 1.89183 0.491 2.48576 2.92277 1.67947 1.44679 1.67977 4.19042 1.79951 2.10625
18-01-2021 2021 -2.13395 -1.34913 -1.79676 0.42261 -0.80906 -1.34145 -0.36731 -2.31 -1.73303 -1.29162 -1.69386 -2.24807 -4.07782 -1.05586 -0.96099 -2.77196 -2.02264 -1.5295 -2.10794
15-01-2021 2021 -0.58603 -0.83934 -1.36744 -1.4038 -1.8583 -0.99622 -0.73282 -1.34004 -1.47087 -0.81961 -2.23526 -1.27354 -1.09681 -1.10924 -2.08418 -1.64972 -1.82276 -1.16538 -0.66887
14-01-2021 2021 0.29142 -0.16854 0.3838 -0.35855 1.37262 -0.09665 0.77446 0.80017 -0.04477 0.71636 -0.1435 -0.23308 -1.01753 0.21112 1.24222 0.83825 -0.05924 -0.06211 0.31542
13-01-2021 2021 0.8765 0.72869 0.29214 -0.95201 0.58022 -0.55945 0.37389 -0.96842 0.02473 0.42416 0.08228 0.32223 0.38035 0.00961 0.30376 -0.92226 -0.31005 -0.13202 0.82613
12-01-2021 2021 1.24305 1.06285 0.33463 -0.70728 1.29204 0.68471 -0.55534 -1.01576 -0.13884 1.54215 -0.16872 1.37604 0.45794 0.54333 1.70811 -1.24997 2.76134 0.49116 1.24403
11-01-2021 2021 2.61106 -0.26586 -0.60644 0.19694 -0.8496 0.60569 1.1801 0.67855 -0.29301 -0.36781 3.30742 -1.53706 -1.00023 0.95837 -0.07713 1.06092 0.62595 1.41062 1.80956
08-01-2021 2021 3.30447 0.40118 1.31112 1.04812 1.24628 0.56144 0.71814 1.60196 1.25584 1.7613 3.60854 3.25652 -0.59852 1.48472 1.41989 1.614 1.42459 1.45916 2.37288
07-01-2021 2021 0.53414 0.4972 0.85988 0.48123 -0.32226 0.19878 -0.85937 -0.4054 0.63018 1.02443 -0.66072 0.59724 3.8204 -0.06291 0.29705 -0.43718 1.34965 0.0382 0.91593
06-01-2021 2021 -0.38764 0.23848 0.81407 1.02127 0.15992 0.08712 -1.13162 -0.33536 0.89705 0.59892 -1.35821 0.24898 1.28989 -0.37501 -0.16042 -0.36646 0.71124 -0.1157 -0.292
05-01-2021 2021 -0.02017 1.63332 -0.52534 1.13306 -0.61481 1.23412 0.29044 0.28785 0.41362 -0.25295 2.62485 0.67439 -1.41184 0.47124 -0.41369 0.12586 -0.34651 1.23929 0.08978
04-01-2021 2021 1.56862 -0.04291 2.2629 0.32655 1.17783 0.05631 0.66251 0.83513 1.07468 1.14038 2.67398 1.00365 5.08615 0.81606 1.52394 1.13714 0.33186 0.73828 1.63177
01-01-2021 2021 0.8593 -0.12219 0.40257 -0.12204 0.31733 -0.15452 0.62834 0.66258 0.33952 0.63682 0.84428 0.60645 0.12905 0.26284 0.34069 0.66623 0.81249 0.1763 1.04119
31-01-2020 2020 -1.15994 0.60756 -2.24657 0.69071 -2.6632 0.18859 -0.52091 -1.04505 -0.64167 -1.41421 -1.12537 -0.52575 -2.27852 -0.61234 -2.641 -1.19521 1.19211 -0.19099 -1.28675
30-01-2020 2020 -0.47382 -0.7436 -1.22901 -0.46632 -1.34029 -0.39626 -1.55857 -1.46782 -0.49785 -0.95334 -0.91873 -1.23391 -1.38605 -0.7725 -1.84205 -2.08908 -0.41096 -0.63641 -0.5816
29-01-2020 2020 0.78898 0.3758 0.4434 -0.2258 0.57637 0.51636 1.28662 -0.02863 0.29884 0.38431 0.30159 0.37883 0.89318 0.61132 0.3966 -0.08848 0.47408 0.46085 0.98883
28-01-2020 2020 -1.23635 -0.24645 -0.97011 -0.48572 -0.81282 0.26976 -0.39374 -0.27171 -0.54266 -1.18542 0.22082 -1.13947 -2.491 -0.5215 -0.33385 0.04634 0.0459 -0.02863 -1.12278
27-01-2020 2020 -0.20182 -1.29426 -1.17781 -0.44258 -1.1828 -1.28776 -1.0332 1.46855 -0.93561 -0.84171 -0.48079 -0.3942 -3.0917 -1.05525 -0.72211 1.47455 -0.56291 -1.24019 -0.37519
24-01-2020 2020 0.40161 0.76667 0.79484 1.32316 -0.1923 0.92347 0.79419 0.03272 1.20025 0.5658 -0.01002 0.96429 0.97319 0.55746 0.06005 -0.07409 0.3052 0.56789 0.56698
23-01-2020 2020 0.88871 0.98562 0.88396 1.52235 1.09594 0.77547 0.23673 0.66139 1.33235 1.36227 0.85616 -1.94605 0.45343 0.60668 1.42701 0.52745 2.11937 0.72827 0.89753
22-01-2020 2020 -0.93077 -0.79522 -1.20353 -0.48518 -1.5361 -0.88916 0.02312 -0.0478 -0.77819 -0.41523 0.98515 1.73195 -1.54288 -0.51726 -1.24337 -0.21211 -0.09341 -0.45708 -0.46757
21-01-2020 2020 -1.27863 -0.42824 -0.64322 -0.59577 -0.49133 -0.37571 -0.89351 0.10126 -0.72706 -0.1123 -0.19714 2.22259 -1.26593 -0.44746 -0.08104 0.05865 -1.42726 -0.24909 -0.86341
20-01-2020 2020 -0.88875 -1.6144 -1.17604 -0.3373 -1.38577 -1.38822 0.17627 -0.5605 -0.48604 -0.61312 -0.9137 -1.83947 -1.00536 -1.03462 -1.60453 -0.91009 0.50902 -1.09484 -0.89636
17-01-2020 2020 0.37757 -0.82643 0.0441 0.73842 0.64635 -0.63833 0.1061 1.40746 -0.08469 0.71795 -0.15291 0.35417 -0.69849 -0.02549 0.74647 1.73349 0.10809 -0.41935 0.25006
16-01-2020 2020 0.12581 0.09112 -0.8002 0.55186 -0.27842 0.13187 0.32365 0.62046 -0.44964 0.09602 0.21289 1.44257 -1.25451 0.09884 -0.12208 0.45186 0.90371 0.09346 0.33327
15-01-2020 2020 1.15872 -0.76937 0.26177 0.88898 -0.21335 -0.21238 0.29443 0.63393 0.43661 0.05404 -0.09473 0.81221 0.71708 -0.15369 0.25074 0.60614 1.31018 -0.38568 0.94929
14-01-2020 2020 0.64899 -0.32942 0.25535 0.33513 0.06171 0.21968 1.40639 0.44595 0.28365 -0.05251 0.84094 2.09547 0.92377 0.26562 0.07376 0.4772 -0.12612 0.22565 0.61445
13-01-2020 2020 0.12583 0.25002 0.66978 0.81679 0.64742 0.17386 1.12939 0.41468 0.73196 0.65996 1.66668 0.79914 1.17399 0.59355 0.49408 0.24756 2.09239 0.71282 0.13646
10-01-2020 2020 0.86141 0.01558 0.67864 0.13035 0.25031 0.13399 0.81946 0.43991 0.69448 0.3729 0.21821 0.15272 1.20956 0.33481 0.02555 0.31557 1.80239 0.12803 0.72323
09-01-2020 2020 2.6754 2.29094 1.44841 1.84815 1.50272 1.98125 0.77074 0.51671 1.953 1.72706 -0.17739 2.39488 1.42922 1.58457 1.64414 0.46272 2.72681 1.49042 2.44825
08-01-2020 2020 -0.74664 -0.08201 -0.18926 -0.7183 -0.81551 -0.05658 0.10515 -0.22636 -0.03479 -0.43602 0.36646 -0.49275 -0.66944 -0.22899 -0.71927 -0.50208 -0.33551 0.0556 -0.58931
07-01-2020 2020 0.29767 0.51941 0.90492 -0.03653 0.3603 0.79035 0.20974 0.57339 1.06086 0.60393 0.09698 1.03648 0.72855 0.49946 0.38317 0.61535 1.93228 0.46341 0.3399
06-01-2020 2020 -2.31876 -2.5947 -2.12509 -0.52952 -1.97916 -2.46005 -1.02942 -1.43777 -2.07763 -1.73332 -0.35641 -2.45101 -2.89992 -1.91058 -2.25522 -1.53601 -2.41949 -2.01441 -2.02171
03-01-2020 2020 -1.2011 -1.15461 -0.65137 -0.15042 -0.45696 -0.93077 -0.51857 0.48706 -0.95072 -0.53443 1.44465 -2.22975 -0.7509 -0.45228 -0.13399 0.72014 -0.4485 -0.41529 -0.86372
02-01-2020 2020 0.69853 1.06205 1.81654 0.2822 0.88005 0.84602 0.10567 0.38969 1.67739 1.49238 -0.07951 0.35949 2.64123 0.81839 0.98428 0.08512 1.05758 0.70781 0.743
01-01-2020 2020 -0.46313 -0.18267 0.16754 -0.97362 0.50037 0.11541 0.37432 0.2457 0.19739 0.24422 0.44562 -0.52118 -0.18741 0.11546 -0.0172 0.08644 -0.23447 0.21572 -0.16822
31-01-2019 2019 1.23177 1.75188 1.4502 1.27249 2.16655 1.60707 1.14276 0.87545 1.48462 0.93754 1.60011 -1.07644 1.17278 1.68188 1.71677 1.03897 0.90508 1.63786 0.93256
30-01-2019 2019 -0.02524 0.94869 0.30682 0.65615 -1.0338 0.44901 -0.99147 0.0319 0.58189 0.06956 0.15691 1.70586 1.89863 -0.00376 -0.85194 -0.25466 -0.74496 0.22701 -0.14787
29-01-2019 2019 -0.27692 -0.29884 -0.11667 -0.04802 -1.27901 -0.37012 0.65397 1.20941 -0.00698 0.19038 0.73544 0.58904 0.04245 -0.0877 -1.06007 1.07342 -0.47972 -0.04267 0.10626
28-01-2019 2019 -1.41408 -1.70476 -1.38829 -0.93259 -1.002 -1.89052 -1.24424 -1.97079 -1.31634 -0.92122 0.53759 8.37455 -1.06385 -1.10384 -1.11418 -2.55427 -0.32602 -1.24222 -2.29622
25-01-2019 2019 -3.24988 -0.55416 -1.24975 0.03452 -0.13575 -0.53312 -0.3286 -0.31497 -1.93241 -0.51437 0.45018 -16.37407 -1.24244 -0.63826 0.09506 -0.03935 -4.38487 -0.49324 -2.37231
24-01-2019 2019 -0.87085 0.05743 -0.17391 0.09051 0.94681 -0.09908 0.15121 -0.2731 -0.08308 -0.5051 0.55814 -0.17483 -0.11737 0.16895 0.35668 -0.5779 2.16561 0.20577 -0.78867
23-01-2019 2019 -0.72506 -0.84236 -0.25642 -1.02891 -0.66924 -0.97257 -1.69204 0.40384 -0.48172 -0.66238 -0.49356 1.30161 0.56411 -0.83541 -0.13801 0.60275 -0.48595 -0.88554 -0.72581
22-01-2019 2019 -0.81972 -0.1865 -0.69501 1.54023 -0.09356 -0.40325 0.07413 1.40702 -0.45721 -0.51892 -0.02539 -1.37629 -2.21162 -0.35669 0.23446 1.80773 0.745 -0.32782 -0.43399
21-01-2019 2019 -1.10743 0.28008 0.08545 -0.28083 2.4395 0.33481 -0.18124 0.28685 -0.04971 -0.66601 0.49319 -0.57123 -0.38213 0.50335 1.27795 0.51901 -1.42677 0.33022 -0.96613
18-01-2019 2019 -0.3762 -0.26173 0.18774 -0.23146 2.45485 -0.21617 -0.64059 -2.03255 -0.50083 -1.5942 0.62634 -1.60991 -0.20081 0.01605 1.14101 -2.6975 -1.28418 -0.23645 -0.48275
17-01-2019 2019 0.12913 0.16392 -0.10353 -0.17069 0.10462 0.43078 -0.15138 -1.26301 -0.05586 0.10639 0.62858 -2.08434 -0.13481 0.13682 0.49985 -1.36622 1.19472 0.2801 0.04295
16-01-2019 2019 -0.24358 0.30273 0.18338 0.04676 0.56487 -0.188 -0.73264 0.29093 0.14941 0.15823 0.33632 -0.84944 -0.64461 0.03215 0.73918 0.29576 0 0.16927 0.06837
15-01-2019 2019 0.4373 0.55967 1.48272 0.31613 2.14494 0.73685 0.95926 0.46805 0.75382 0.70076 3.05759 1.20557 1.59729 1.38951 1.92566 0.87381 1.79219 1.39524 0.68116
14-01-2019 2019 -0.14274 -0.74907 -0.60949 -0.03007 -0.5191 -0.8635 -0.13866 0.65567 -0.97747 -1.4185 -0.58363 -0.98143 -1.07362 -0.53127 -0.4622 0.52626 -0.9719 -0.64937 -0.2682
11-01-2019 2019 -0.79477 -0.27117 -0.15592 -0.4006 -0.47842 0.13147 0.61299 -0.19563 -0.3947 -1.10482 -0.11275 -0.02403 -0.03701 -0.24627 -0.00314 -0.36207 -1.35473 -0.21311 -0.82881
10-01-2019 2019 0.29471 -0.69209 -0.23559 0.87637 -0.40147 -0.55576 -0.01864 0.55737 -0.0798 0.27179 -0.01954 0.08016 -0.10586 -0.30907 -0.68574 0.31549 -0.27021 -0.38478 0.46944
09-01-2019 2019 0.53557 0.76664 -1.04757 0.80787 -0.32149 0.90499 1.00869 0.4323 -0.40836 0.00318 0.28245 -0.03806 -1.15603 0.49064 -1.31521 0.47322 0.64854 0.647 0.43655
08-01-2019 2019 0.44955 0.75061 0.01196 -0.6337 -0.21716 0.37829 -0.035 1.04251 0.23834 -0.02225 -0.04058 -1.23852 0.44043 0.28175 -0.17968 1.51271 -0.02092 0.23223 0.21218
07-01-2019 2019 0.12089 0.40283 0.42928 1.19418 0.66937 0.16548 0.30606 -0.25269 0.42544 0.50309 1.02749 0.31955 -0.15325 0.41436 0.33857 -0.6304 1.33531 0.4923 -0.25768
04-01-2019 2019 0.47905 0.87222 1.06491 -0.29062 0.92313 0.99049 0.00331 0.41863 0.53436 0.85694 -1.22887 1.10166 1.39508 0.51629 0.78652 0.75381 0.83351 0.53959 0.39527
03-01-2019 2019 -1.51977 -0.79063 -2.02283 -0.46238 -1.59789 -1.09829 -0.01987 -0.94402 -1.41762 -1.2691 -0.86488 -1.92088 -2.24702 -1.1142 -1.64793 -1.33089 -0.06408 -0.99745 -1.20703
02-01-2019 2019 -3.04712 -0.79475 -1.73363 -0.43402 -1.44585 -0.99 -0.66862 -0.3507 -1.26452 -1.46056 -0.0263 -1.30723 -3.40643 -1.0779 -1.24172 -0.47287 -1.43158 -0.78934 -2.59308
01-01-2019 2019 -0.57495 0.85493 -0.22587 0.31581 0.09173 1.00251 -0.38733 0.17054 0.28781 0.48027 0.07341 0.3098 -0.61339 0.43774 0.30803 0.1494 2.21648 0.82127 -0.28302
31-01-2018 2018 -0.1376 0.40485 -0.39425 -1.60287 0.59435 0.48179 -1.39866 -1.57872 -0.55412 -0.44969 -0.92692 -0.29008 -1.22442 -0.19865 0.48854 -1.8696 -0.029 -0.02283 -0.20696
30-01-2018 2018 -0.43242 -0.83423 -0.17075 -1.96212 -0.08692 -1.08638 -0.1642 -0.588 -0.81177 -0.35764 -1.01642 -0.89923 -0.59408 -0.72549 0.58829 -0.61108 -1.07589 -0.9737 -0.45677
29-01-2018 2018 1.48291 0.19238 -0.02421 0.21653 -0.58483 0.8778 -0.57421 -0.86238 0.44554 -0.13821 0.95023 0.66573 0.13784 0.5488 -0.76335 -1.09773 -0.3431 0.64928 0.73925
25-01-2018 2018 -1.26044 0.17191 -0.1487 -0.71696 -0.26957 0.18194 -0.6187 -1.01667 0.01142 -0.34637 -0.994 -0.85788 0.92255 -0.14748 -0.29412 -0.98968 -1.75562 -0.24052 -1.28843
24-01-2018 2018 -0.60678 0.02902 -0.80227 -1.95322 -0.63028 0.15364 0.45963 0.21105 -0.82642 -1.03509 1.53768 -0.33243 -1.71864 0.02075 -0.22126 0.60508 -0.0842 0.32934 -0.24384
23-01-2018 2018 0.29895 1.2921 1.76715 0.38866 1.29668 0.91858 0.55673 1.1014 1.14342 0.31679 1.19388 -0.25151 4.065 1.07147 1.65328 1.16522 0.66394 0.98783 0.1825
22-01-2018 2018 0.11389 0.48942 0.24958 0.79345 1.99461 0.17971 0.32943 0.59366 0.14484 0.56637 2.06667 0.5084 -0.67561 0.65628 1.22111 0.17639 1.91477 0.52619 0.22038
19-01-2018 2018 0.13248 1.40217 0.42882 0.1859 0.96007 1.10849 0.61888 0.41071 0.4058 0.97469 0.50236 0.65529 0.864 0.71831 0.93029 0.1179 1.09154 0.96534 0.59879
18-01-2018 2018 -0.26085 0.9445 -1.82627 -1.08731 -1.04025 1.05187 1.12074 -1.10149 -0.95033 -1.51903 0.31361 -1.33793 -2.88514 0.26371 -1.2163 -1.20942 -3.91554 0.60105 -0.64359
17-01-2018 2018 0.39798 1.20963 0.49459 0.21186 0.25274 0.94351 0.63331 1.06403 0.69301 1.20715 0.80806 -1.45665 1.01192 0.82333 0.07493 1.25579 0.86037 0.97531 0.55883
16-01-2018 2018 -1.25359 -0.36173 -1.70629 -1.27344 -2.11791 -0.45477 -1.09251 -0.54653 -0.96128 -1.05611 3.65387 -0.68081 -2.84455 -0.38263 -2.03277 -0.37579 -3.37967 0.25972 -1.21511
15-01-2018 2018 -0.95983 1.24335 0.07274 1.11823 -0.19773 2.41228 -0.09284 -0.48264 0.86434 -0.40238 -0.8794 1.40865 0.14918 0.56454 -0.58229 -0.84276 0.02726 1.18 -0.85053
12-01-2018 2018 0.30872 0.34352 0.20791 -0.18929 0.68336 0.43199 -0.40666 -0.37043 0.02919 -0.09173 -0.03264 1.7131 0.61964 0.28213 0.86277 -0.31721 -1.46407 0.24543 0.25237
11-01-2018 2018 0.12482 0.1702 -0.19082 -0.18814 -0.38032 0.20737 0.35685 0.25368 0.02114 -0.0027 0.4015 0.47083 -0.1415 0.1787 -0.30666 0.24875 2.00027 0.3014 0.09242
10-01-2018 2018 -0.71427 -0.33653 -0.17501 -0.51029 -0.10686 -0.33287 -0.14166 -0.09714 -0.59762 -0.25968 2.23775 -0.384 0.072 -0.04513 0.06415 -0.22108 1.26249 0.16595 -0.31965
09-01-2018 2018 -0.26932 0.10788 0.18965 0.22892 0.59402 -0.19487 0.47325 -0.75493 0.01121 -0.52999 0.11888 -1.22607 0.006 0.12613 0.34203 -0.69169 2.80987 -0.07551 -0.26545
08-01-2018 2018 0.37637 0.29002 0.68333 0.49362 0.53404 0.44638 0.76744 1.27126 0.42091 -0.01606 1.23178 1.21404 0.87038 0.61323 0.62886 1.41428 0.93579 0.49669 0.28704
05-01-2018 2018 0.72911 0.54688 0.28664 0.83517 0.0186 0.42478 0.8419 0.84235 0.7746 0.94011 0.36883 1.453 0.44747 0.51453 -0.14321 0.70015 0.72506 0.79967 0.87304
04-01-2018 2018 -0.19845 0.56875 1.29808 2.31883 0.63181 0.41015 0.15461 0.92162 1.24528 1.25 0.03539 0.35046 2.79486 0.58986 0.81418 1.19806 -0.18816 0.33747 0.01674
03-01-2018 2018 -0.50599 -0.07755 0.59152 0.80074 -0.03248 -0.11588 0.43304 -0.40008 0.58274 0.92895 -0.13489 0.29073 1.45453 0.00958 -0.1704 -0.48349 0.46532 -0.09648 -0.02193
02-01-2018 2018 0.30823 0.07959 0.3584 -0.27698 0.16585 0.2381 -0.57276 -0.60691 -0.0264 -0.39322 0.31645 -0.13289 0.60344 0.06372 -0.2529 -0.54428 -1.10728 0.06975 0.06115
01-01-2018 2018 -0.98676 -0.86495 -0.68984 -0.05037 -0.77442 -0.96706 -0.6132 0.03068 -0.57004 -0.02337 -0.85084 -0.08371 -0.53044 -0.89696 -0.82903 -0.02027 0.23061 -0.86869 -0.91429
31-01-2017 2017 -0.91554 -0.35742 -1.23629 -1.2413 -0.8467 -0.50643 0.21114 -1.56517 -0.80709 -0.61196 -3.16126 -1.34909 -1.04683 -0.82709 -1.33851 -1.69036 -0.63641 -1.07166 -0.99937
30-01-2017 2017 -0.85281 -0.62411 -0.04159 -0.50445 0.27805 -0.2857 -0.05505 0.34454 -0.12974 0.9385 -0.10804 -0.10312 -0.16079 -0.09837 0.1074 0.43407 -0.38589 0.07271 -0.69576
27-01-2017 2017 0.4645 1.2068 0.3787 1.32067 0.68984 1.6197 -1.83734 0.28765 1.00929 1.29987 0.16726 -0.29074 0.0193 0.44753 0.4134 0.33875 -0.60274 1.20493 0.61787
25-01-2017 2017 1.41939 2.36556 1.62116 1.63727 0.72698 2.95494 1.36023 0.08953 1.49467 0.78746 -0.36271 2.36272 1.525 1.4972 1.34274 -0.0677 1.84152 1.75964 1.44651
24-01-2017 2017 1.68857 0.96062 1.77013 0.56203 1.29769 1.18189 0.16001 1.12555 1.49857 1.45645 -0.17614 -0.17391 1.61938 1.00459 1.15024 1.22381 0.33595 0.72594 1.68152
23-01-2017 2017 0.6666 0.1169 1.2869 0.93457 0.40597 0.44367 1.07204 -0.71737 0.57142 -0.43293 0.85867 2.03697 2.74113 0.50543 0.91373 -0.9023 0.70482 0.60704 0.41302
20-01-2017 2017 -1.11237 -1.58963 -1.55289 -1.04713 -1.24826 -1.58915 0.03236 -0.85107 -1.33443 -1.7838 -0.88045 -1.82201 -2.41866 -1.01718 -1.27963 -0.7893 -2.23264 -1.19025 -1.09623
19-01-2017 2017 0.66564 -0.20872 0.57525 1.15998 1.29519 -0.24459 0.48771 -0.47829 0.10943 0.48633 -0.08797 -0.23536 -0.02328 0.21504 1.60659 -0.60276 -0.32967 0.02812 0.482
18-01-2017 2017 0.03111 0.50873 1.00903 0.70628 -0.39969 0.26097 0.40575 0.15329 0.90437 -0.13183 0.24495 0.51683 2.36287 0.22624 -0.17023 0.24938 0.05498 0.13142 -0.02876
17-01-2017 2017 -0.09222 -0.15186 -0.56534 -0.53599 -1.45474 -0.30853 1.15582 0.0488 0.33625 0.07638 0.32439 -0.26499 -1.46935 -0.17592 -1.53987 0.07679 0.38631 -0.10315 0.00488
16-01-2017 2017 0.5208 0.97293 0.25536 0.93726 -0.53253 0.94623 -0.16485 -0.28326 0.55001 0.36238 -0.87694 0.24016 0.96874 0.1488 -0.59096 -0.2585 1.34228 0.38596 0.34266
13-01-2017 2017 -0.78744 0.20664 -0.2764 -0.35207 0.11555 0.7566 1.16257 0.28756 -0.21257 -0.6955 -1.29833 0.09105 -0.20957 -0.08207 0.18779 0.42304 -0.11173 -0.16916 -0.78619
12-01-2017 2017 -0.27516 0.22836 0.71942 -0.03055 1.1455 0.06387 -0.97197 -0.61489 0.8148 2.1021 1.74168 -0.05824 0.12522 0.3174 0.2484 -0.60206 -0.27855 0.76705 -0.16982
11-01-2017 2017 0.90469 2.28692 1.83475 0.46163 0.32604 1.50316 0.17488 0.87889 1.89603 1.0532 -0.00978 1.47749 4.26621 1.10996 0.22012 0.9454 0.41958 1.40196 0.82318
10-01-2017 2017 1.27107 0.67265 0.72833 0.91185 0.89841 0.44359 0.81003 0.39822 0.41238 0.70106 0.22553 0.35214 1.43532 0.63866 0.96304 0.41655 -0.27894 0.45336 1.05932
09-01-2017 2017 -0.11255 0.12046 -0.46944 -0.22004 -0.6916 0.04614 0.57507 -1.10855 -0.20562 -0.53283 0.87043 0.52914 -0.14297 -0.09462 -0.74578 -1.42284 0.84388 0.18361 -0.16048
06-01-2017 2017 -0.16488 0.82252 -0.39126 -0.36704 -0.35125 0.47453 -0.96346 0.21035 -0.01032 -0.38118 -2.78846 -1.12376 -0.01429 -0.36259 -0.32456 0.14344 -0.83682 -0.34669 -0.03987
05-01-2017 2017 2.05125 1.25203 1.90276 1.11085 1.53283 0.95538 0.64485 1.29253 1.35231 1.45289 -0.91463 1.67072 3.19749 1.01703 1.69559 1.49471 1.12835 0.70798 1.84015
04-01-2017 2017 0.32902 -0.79845 -0.21025 1.80926 -0.80721 -0.74739 0.3403 -0.00528 -0.05954 0.77212 1.29319 0.1651 -0.12523 -0.02075 -0.57167 -0.1357 2.2203 -0.18393 0.14688
03-01-2017 2017 -0.2852 0.3673 0.59874 2.03892 1.19717 0.19988 0.7436 0.07225 0.08372 0.3252 -0.04823 1.78353 0.35857 0.15527 1.4826 0.0679 0.4635 0.16484 -0.05084
02-01-2017 2017 2.02588 -1.1443 1.29541 0.86253 0.35146 -1.38788 -0.21201 0.41937 0.74564 0.90701 -0.30772 0.29494 1.9868 -0.07696 0.54007 0.41882 4.38464 -0.95083 1.55876
29-01-2016 2016 1.97104 0.91672 1.80691 2.24074 1.61669 1.33603 1.23287 2.70227 1.13494 1.2783 2.12689 3.24146 1.08497 1.87081 1.71165 2.75464 1.55423 1.74726 2.04767
28-01-2016 2016 -0.44452 -0.98494 0.18499 -1.0172 1.41573 -1.21672 1.69501 0.66835 -0.96166 -1.37201 -0.24481 1.43397 -0.5938 -0.17613 0.9267 0.80978 -0.7874 -0.7651 -0.63077
27-01-2016 2016 0.05342 -0.17351 0.28269 -0.05096 0.40579 -0.28835 0.09156 0.74178 0.01011 0.51352 0.03628 0.64045 0.13955 0.02152 -0.28941 0.97336 0.82699 0.05586 -0.37241
25-01-2016 2016 -0.75159 0.41298 0.53286 1.39646 -0.14437 0.76035 0.06467 0.89481 0.34372 -1.19077 0.17263 -0.22578 1.60912 0.18458 -0.07317 0.88051 0.56554 0.2905 -0.42182
22-01-2016 2016 3.92043 2.62234 2.62019 1.68133 2.44212 2.42339 0.47109 2.41745 2.52226 1.32681 0.6585 2.35905 4.44974 2.00088 2.8379 2.43366 1.79478 1.67516 3.16618
21-01-2016 2016 -1.91988 1.11148 -0.75973 0.53616 -1.62365 0.60193 -1.54601 -1.80152 0.68469 -0.59352 0.21998 0.7247 -0.86185 -0.44464 -1.59726 -2.30877 0.40802 0.48016 -1.07715
20-01-2016 2016 -1.65427 -2.18744 -2.56015 -0.39592 -2.82411 -1.81523 -1.48627 -0.96173 -1.69112 -1.72952 -0.48344 -3.00345 -3.11128 -1.69197 -2.62318 -0.81558 -3.41544 -1.62047 -1.62648
19-01-2016 2016 1.27298 1.65779 0.87119 1.29643 1.54058 1.78719 0.18415 1.40723 1.39341 2.75951 -0.19119 0.39778 0.60361 1.14406 1.30082 1.16484 1.90763 1.31961 1.58437
18-01-2016 2016 -1.49519 -1.2232 -2.25486 -1.40434 -3.6991 -1.51252 -0.46609 -1.58281 -1.41728 -1.70199 -0.09096 -2.72924 -1.08334 -1.16701 -3.67529 -1.45474 -3.67505 -0.93052 -1.89874
15-01-2016 2016 -1.82703 -2.58184 -1.70816 -1.75146 -0.74034 -2.44197 -1.76458 -1.53913 -2.61705 -3.39894 0.1275 -3.66333 -3.53304 -1.31355 -0.60606 -0.96443 -4.52447 -1.68358 -1.88799
14-01-2016 2016 -1.42262 -1.65081 -0.88462 -1.18358 -0.72012 -1.39023 0.12362 0.25341 -1.13404 -1.28745 1.30086 -0.33952 -1.66988 -0.33852 -0.49702 0.42398 -1.60509 -0.23818 -1.16961
13-01-2016 2016 0.9649 0.87073 -0.00423 -0.4482 1.3718 0.79487 0.38263 -0.3346 -0.39082 -1.74416 0.45412 0.30048 -0.7188 0.69371 1.03783 -0.17811 -0.98951 0.69365 0.27846
12-01-2016 2016 -0.39476 -1.76074 -0.85187 -0.30002 -0.46439 -1.27538 0.05691 0.32601 -1.04577 -0.30573 -0.30491 -0.64881 -1.20268 -0.70732 -0.90897 0.35926 -1.7673 -1.1496 -0.40789
11-01-2016 2016 0.09556 -0.78057 -0.23445 -0.56392 0.81992 -0.86717 -0.15497 -1.58044 -0.36788 -0.57375 -1.5106 -0.60138 -0.26845 -0.49334 0.06307 -1.6158 0.2362 -0.95442 -0.31288
08-01-2016 2016 0.24725 0.42929 1.10476 0.73033 1.55895 0.28341 0.5088 0.35707 0.73712 0.25141 1.1599 0.32549 0.47633 0.43603 1.45831 0.3052 2.66747 0.653 0.01821
07-01-2016 2016 -3.74187 -2.19071 -3.26741 -1.2669 -2.40118 -2.19136 -2.1738 -2.00572 -2.93252 -2.74155 -1.40679 -2.47745 -4.72936 -2.23098 -2.70022 -1.90298 -4.95534 -1.95565 -3.14982
06-01-2016 2016 -1.21734 -0.65893 -0.06138 -0.34184 1.25541 -0.54269 -1.7858 -0.55148 -0.80537 -0.89223 0.19096 -0.40097 -1.8092 -0.56008 1.0497 -0.57659 -1.13928 -0.30867 -0.92364
05-01-2016 2016 -0.22719 -0.34339 1.17579 0.3606 1.02024 -0.25618 -0.19913 -0.00932 0.801 -0.08438 -0.29014 0.83194 3.20239 -0.08599 1.84817 0.06648 1.82715 -0.28793 -0.25677
04-01-2016 2016 -2.22735 -2.58231 -1.35991 -0.92911 -1.46718 -2.5679 -0.48058 -1.88374 -1.76505 -2.40252 -1.29766 -2.09713 -1.38775 -2.15868 -1.57998 -2.0547 -1.9619 -2.44091 -1.826
01-01-2016 2016 0.89161 0.69141 0.68254 1.01751 0.12348 0.45757 -0.03962 0.22913 0.55838 0.86313 -0.33892 -0.21269 0.19159 0.21268 0.45012 0.13667 1.88297 0.16494 1.05245
output (date column is missing, please add the date column too)
> head(return_residual)
auto consumer_durables FMCG healthcare IT media metal
1 0.95028440 4.87921466 0.5110545 0.66720378 -1.07316723 1.64486849 -1.00787352
2 0.08456636 5.34455739 1.2360707 1.40234685 -0.79101113 -0.23001546 2.72055449
3 -0.36133041 1.86326530 0.5810292 -0.94965875 -0.04616256 -0.05366179 0.59106494
4 0.18252077 -0.05906096 0.2606308 -0.83846560 -0.57066020 2.51205077 0.36273120
5 -1.78603163 -1.74608118 -0.6150467 -0.53467958 3.44016775 -2.20350380 -1.68151053
6 -0.07427021 -0.39094725 -0.7668574 0.02074299 2.40454759 -1.20153956 -0.07479571
oil_gas pharma reality finance
1 1.1851927 0.66653220 0.7258000 -1.06651726
2 0.7493329 0.80091669 3.9402124 0.12672805
3 0.1013221 -1.27515438 -0.4902174 0.07959024
4 1.5439447 -1.00616138 0.6530852 0.47677774
5 0.3686313 -0.45749214 -2.3281524 -0.25050862
6 -0.7762362 -0.09837136 0.6828362 -0.75513729