I have 1 main series lets say it as y and 5 sub series lets say it as x1.
Now I am calculating z1 using the equation z1= y-x1.
and then I am calculating the coefficient of determination that is R^2. Now what I want is that as from 5 x1 I will get 5 z1 series which will give me 5 R^2, so now I want that code should select the x1 series which gives maximum value of R^2 and assign it as x1 series for further computation.
After this, of the remaining 4 x1 series, which will be taken as x2 series, i again want to calculate z2 using the equation z2=y-x1-x2. Here x1 and y are fixed where as x2 is changing. I have done this in excel but I have lot of series. I just want to know how to direct the code to select the series of maximum R^2.
Thanks in advance