LINEST on specific non-adjacent columns

smeador

New Member
Joined
Nov 30, 2014
Messages
12
Hey guys,

So I am running a daily fantasy regression analysis and I need some help. I have found that certain criteria is better suited for predicting some player's performances than others. So I want to run a solver that will pick which criteria to use to maximize the R squared value.

I listed an example of what it might look like below. I will run binary cells along to top of each column, and I wish to include the columns that come up with a 1 on the top and ignore the columns that come up with a 0 on top. There will be parameters in place to avoid unreal R squared values, but that is not my current concern.

I cannot think of a formula, or a method to use LINEST with the left most column (Actual) as the Y variables and then use each column with a 1 over the top of it as the X variables. Again, columns that show up with a zero above them should not be used in the LINEST.

Thanks a lot,
Shawn

011101
ActualBaseVAverageCompVEaseMPGRest
44.141.7337641.3564335.95-0.3536.71
23.841.1651840.9419938.670.2536.21
27.441.1651842.5052834.95-0.3887236.21
3540.596642.5021833.44-0.0835.71
47.840.596641.6981333.70.635.70
46.340.596641.8878135.71-0.2635.71
36.941.1651844.8057737.040.636.20
37.841.7337639.54337.02222-0.1018136.74
38.841.3926144.9360837.10.06605836.43
40.840.7442939.3274637.2-0.637.351
49.734.5739.1041337.550.7730.40
33.840.0537.2545538.48-0.1935.41
3943.6239.5839.93-0.1736.41

<colgroup><col width="67" span="7" style="width:50pt"> </colgroup><tbody>
</tbody>
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
I have tried using various Index functions and Vlookups and Match functions but I am afraid I have not yet had success.
 
Upvote 0
0​
1​
1​
1​
0​
1​
Actual​
BaseV​
Average​
CompV​
Ease​
MPG​
Rest​
-0.25517​
0​
5.261621​
-1.26661​
-0.98279​
0​
125.7181​
I2:O2: {=LINEST(A3:A15, B1:G1*B3:G15)}
44.1​
41.73376​
41.35643​
35.95​
-0.35​
36.7​
1​
23.8​
41.16518​
40.94199​
38.67​
0.25​
36.2​
1​
27.4​
41.16518​
42.50528​
34.95​
-0.38872​
36.2​
1​
35​
40.5966​
42.50218​
33.44​
-0.08​
35.7​
1​
47.8​
40.5966​
41.69813​
33.7​
0.6​
35.7​
0​
46.3​
40.5966​
41.88781​
35.71​
-0.26​
35.7​
1​
36.9​
41.16518​
44.80577​
37.04​
0.6​
36.2​
0​
37.8​
41.73376​
39.543​
37.02222​
-0.10181​
36.7​
4​
38.8​
41.39261​
44.93608​
37.1​
0.066058​
36.4​
3​
40.8​
40.74429​
39.32746​
37.2​
-0.6​
37.35​
1​
49.7​
34.57​
39.10413​
37.55​
0.77​
30.4​
0​
33.8​
40.05​
37.25455​
38.48​
-0.19​
35.4​
1​
39​
43.62​
39.58​
39.93​
-0.17​
36.4​
1​
 
Upvote 0
This returns the coefficients, but the "unused" columns are turned into zeroes instead. This ends up throwing off the R Squared Value. Is there anyway to exclude the columns completely rather than turning them into 0's?
 
Upvote 0
ABCDEFGHIJKLM
1
0​
1​
1​
1​
0​
1​
2
Actual​
BaseV​
Average​
CompV​
Ease​
MPG​
Rest​
-0.25517​
5.261621​
-1.26661​
-0.98279​
125.7181​
3
44.1​
41.73376​
41.35643​
35.95​
-0.35​
36.7​
1​
4
23.8​
41.16518​
40.94199​
38.67​
0.25​
36.2​
1​
5
27.4​
41.16518​
42.50528​
34.95​
-0.38872​
36.2​
1​
6
35​
40.5966​
42.50218​
33.44​
-0.08​
35.7​
1​
7
47.8​
40.5966​
41.69813​
33.7​
0.6​
35.7​
0​
8
46.3​
40.5966​
41.88781​
35.71​
-0.26​
35.7​
1​
9
36.9​
41.16518​
44.80577​
37.04​
0.6​
36.2​
0​
10
37.8​
41.73376​
39.543​
37.02222​
-0.10181​
36.7​
4​
11
38.8​
41.39261​
44.93608​
37.1​
0.066058​
36.4​
3​
12
40.8​
40.74429​
39.32746​
37.2​
-0.6​
37.35​
1​
13
49.7​
34.57​
39.10413​
37.55​
0.77​
30.4​
0​
14
33.8​
40.05​
37.25455​
38.48​
-0.19​
35.4​
1​
15
39​
43.62​
39.58​
39.93​
-0.17​
36.4​
1​

<tbody>
</tbody>

I2: =IFERROR(INDEX(LINEST($A$3:$A$15,$B$1:$G$1*$B$3:$G$15),SMALL(TRANSPOSE(ROW(1:7))*$A$1:$G$1,COUNTIF($A$1:$G$1,0)+COLUMN()-8)),"")
confirm with Ctrl Shift Enter
Drag until return blank
 
Upvote 0
Ok Ignore above post , try this one :

I2 : =IFERROR(LINEST($A$3:$A$15,INDEX($B$3:$G$15,0,SMALL(TRANSPOSE(ROW(2:7))*$B$1:$G$1,COUNTIF($A$1:$G$1,0)+COLUMN()-8)-1)),"")
Ctrl shift enter
Drag to right until see blank
And shg, I think your formula wrong some where...
the result shout be
-0.298422874-0.804916874.48245178-1.30686275

<tbody>
</tbody>
Not
-0.25517​
5.261621​
-1.26661​
-0.98279​
125.7181​

<tbody>
</tbody>
 
Upvote 0
Running data analysis regression manually on the columns with a 1 above them as detailed in the previous post (copy and pasting the cells to be adjacent) returns the following numbers:

InterceptAverageCompVEaseRest
125.718072-0.9827916-1.26660565.261621-0.25517

<colgroup><col span="3"><col span="2"></colgroup><tbody>
</tbody>

I want an intercept to be calculated normally, and I need the statistics returned so that I can see the R squared value. Yesterdays, I was unable to retrieve the Stats from your formula - even after adding the appropriate "True" values.
 
Upvote 0
Ok you could use the formula in post #5 of this thread
That should return value as your

I'm not really understand how LINEST work..
to calculate of "Rest" we use =LINEST(A3:A15,G3:G15) right?
Where is "Intercept" coming from ?
 
Upvote 0
SUMMARY OUTPUT
Regression Statistics
Multiple R0.414088
R Square0.171469
Adjusted R Square-0.2428
Standard Error8.431443
Observations13

<colgroup><col span="2"></colgroup><tbody>
</tbody>

CoefficientsStandard Errort StatP-valueLower 95%Upper 95%Lower 95.0%Upper 95.0%
Intercept125.718190.148591.3945650.200653-82.165333.6011-82.165333.6011
Average-0.982791.267997-0.775070.460589-3.90681.941214-3.90681.941214
CompV-1.266611.466901-0.863460.413023-4.649292.116075-4.649292.116075
Ease5.2616216.4600440.8144870.438937-9.6352720.15851-9.6352720.15851
Rest-0.255172.361612-0.108050.916617-5.701065.190715-5.701065.190715

<colgroup><col width="67" span="9" style="width:50pt"> </colgroup><tbody>
</tbody>


Above is the output if the regression is run through data analysis on Excel. "Average", "CompV", "Ease", and "Rest", are all the X Value columns that had a 1 on top of them indicating that they were to be used in the calculation. These are what the numbers should be, and the LINEST() function is designed to output these regression statistics.

The LINEST() function used on the same data set outputs the following:

-0.255175.261621-1.26661-0.98279125.7181
2.3616126.4600441.4669011.26799790.14859
0.1714698.431443#N/A#N/A#N/A
0.4139118#N/A#N/A#N/A
117.6985568.7138#N/A#N/A#N/A

<colgroup><col width="67" span="5" style="width:50pt"> </colgroup><tbody>
</tbody>

The top row of this output array are the coefficients, and the third number in the first column (0.171469) is the R squared value for the regression analysis performed. This is the number I desire because I will change the locations of the 1's and 0's above each column in order to maximize the R squared value (in order to make my regression analysis more accurate). I want to be able to do this without copying and pasting the desired cells or manually calculating scenarios for every possibly combination of 0's and 1's above the columns.

thanks
 
Upvote 0

Forum statistics

Threads
1,215,079
Messages
6,123,000
Members
449,092
Latest member
masterms

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top