# Maximize R squared using solver DOCUMENT ATTACHED (may be difficult)

1. ## Maximize R squared using solver DOCUMENT ATTACHED (may be difficult)

Hey guys,

I'm creating an algorithm for daily fantasy basketball and I have hit a little roadblock.

Linest Solver.xlsx

Now the data at the top is pulled from a database I have created on another sheet that I have omitted for these purposes. So the premise is, each playe'r's performance in basketball can be predicted by a different set of statistics. In the B column I have listed some of the ones I have come up with so far. The "Actual" data is the Y data for the Linest function I wish to run.

This will be a much easier question to answer if you download the file. I have put 0's or 1's in the A column beside each of the data types. I then have a data array beginning in B17 that displays the rows with 1's next to them as adjacent columns. Then starting in D30, I run a dynamic Linest Function on the displayed array using offset functions and row/column count functions in order to select the data displayed in the step in the previous sentence.

ANYWAY, if you MANUALLY change the 0's and 1's the data does change with it and everything is accurate. If you make all the rows a 1, then all the rows will display as adjacent columns below, if only 7 then 7 adjacent columns will show, etc.

Having only a working knowledge of using solver at THIS level (I've done basic binary situations before), I cannot spot the reason why the solver wont change the 0's and 1's to maximize the R squared value in D32. Again, if I manually change the 0's and 1's I can maximize this value with trial and error, but I thought that was what the iterations in Solver were for.

If you have any suggestions about how I can go about fixing this PLEASE let me know, as manually doing these situations would be impossible due to the volume required (this is on one player's data). And PLEASE download the file so that your answer does not depend fully on my explanation.

2. ## Re: Maximize R squared using solver DOCUMENT ATTACHED (may be difficult)

Why not attach it directly (Go Advanced) on your post and make it available here so those who help do not have to go to another site to assist.

3. ## Re: Maximize R squared using solver DOCUMENT ATTACHED (may be difficult)

To best describe or illustrate your problem you would be better off attaching a dummy workbook. The workbook should contain the same structure and some dummy data of the same type as the type you have in your real workbook - so, if a cell contains numbers & letters in this format abc-123 then that should be reflected in the dummy workbook.

To attach a file to your post,
click advanced (next to quick post),
scroll down until you see "manage file",
click that and select "add files" (top right corner).
click "select files" find your file, click "open" click "upload" click 'done" bottom right. click "submit reply"

Once the upload is completed the file name will appear below the input boxes in this window.
You can then close the window to return to the new post screen.

4. ## Re: Maximize R squared using solver DOCUMENT ATTACHED (may be difficult)

sorry guys, I missed the "go advanced" button. New here

5. ## Re: Maximize R squared using solver DOCUMENT ATTACHED (may be difficult)

Solver should have no problem with the "LINEST" function but you have added the "IF ERROR" as well and that I think makes the "Object function" discontinuos.

A nonlinear solver relies on (partial) derivative values to guide it towards a feasible and optimal solution; since it is unable to compute the derivatives of a function at points where that function is discontinuous, it has trouble determining how to proceed.
In practice, the nonlinear GRG Solver used in Excel can sometimes deal with discontinuities which are "incidental" to the problem, but as a general statement, the nonlinear Solver cannot be expected to find optimal solutions to such problems. However, the Evolutionary Solver included in Frontline's enhanced Solver products can make progress on these problems.
If you try to solve a problem with discontinuous functions with the Assume Linear Model box checked, it is possible -- though unlikely -- that the linearity test performed by the Solver will not detect the discontinuities and will proceed to try to solve the problem. (This probably means that the functions were linear over the range considered by the linearity test -- but there are no guarantees at all that the solution found is optimal!)
You can use discontinuous functions such as IF and CHOOSE in calculations on the worksheet which are not dependent on the decision variables, and are therefore constant in the optimization problem. But any discontinuous functions that do depend on the variables will likely cause problems for the Solver. Users sometimes fail to realize that certain functions, such as ABS and ROUND, are nonsmooth at certain points.
Still I could run your model selecting the "Evolutionary" model. Question why has the range "A3:A13" two constraints i.e. as binary and as integer? I would think that just binary would be sufficient.

Alf

6. ## Re: Maximize R squared using solver DOCUMENT ATTACHED (may be difficult)

Without the IFerror, running the solver on GRG NonLinear or Simplex returns an error message stating that it detects an error in the object or constraint cells

7. ## Re: Maximize R squared using solver DOCUMENT ATTACHED (may be difficult)

Did you try to run solver using the "Evolutionary" methode?

There are currently 1 users browsing this thread. (0 members and 1 guests)