[math] OLSMultipleLinearRegression

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[math] OLSMultipleLinearRegression

Andy Arledge
Hi,

I get an

"org.apache.commons.math3.exception.MathIllegalArgumentException: not
enough data (17 rows) for this many predictors (293 predictors)"

with the following code : https://pastebin.com/aZ4DXQB3

My class extends OLSMultipleLinearRegression. I have 293 rows of data
with 17 columns.

Is there something I'm missing here? I'm basing my work on the example @

http://commons.apache.org/proper/commons-math/userguide/stat.html#a1.5_Multiple_linear_regression

Thanks for any guidance.

--
Thanks
Andy

Andy Arledge
Appraiser Genie, LLC
325-455-7890
www.appraisergenie.com


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [math] OLSMultipleLinearRegression

Gilles Sadowski
On Sun, 31 Dec 2017 15:01:23 -0600, Andy Arledge wrote:

> Hi,
>
> I get an
>
> "org.apache.commons.math3.exception.MathIllegalArgumentException: not
> enough data (17 rows) for this many predictors (293 predictors)"
>
> with the following code : https://pastebin.com/aZ4DXQB3
>
> My class extends OLSMultipleLinearRegression. I have 293 rows of data
> with 17 columns.
>
> Is there something I'm missing here? I'm basing my work on the
> example @
>
>
> http://commons.apache.org/proper/commons-math/userguide/stat.html#a1.5_Multiple_linear_regression
>
> Thanks for any guidance.

In Java, the "row" index is the first dimension.
Try
---CUT---
  double[][] data = new double[myList.size()][17];
  // etc.
---CUT---

HTH,
Gilles


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [math] OLSMultipleLinearRegression

Andy Arledge
i had the row index 1st initially and got an error message that said:

org.apache.commons.math3.exception.DimensionMismatchException: 17 != 293

so i tried reversing the row/columns, no luck got the message below.



On 12/31/2017 4:56 PM, Gilles wrote:

> On Sun, 31 Dec 2017 15:01:23 -0600, Andy Arledge wrote:
>> Hi,
>>
>> I get an
>>
>> "org.apache.commons.math3.exception.MathIllegalArgumentException: not
>> enough data (17 rows) for this many predictors (293 predictors)"
>>
>> with the following code : https://pastebin.com/aZ4DXQB3
>>
>> My class extends OLSMultipleLinearRegression. I have 293 rows of data
>> with 17 columns.
>>
>> Is there something I'm missing here? I'm basing my work on the example @
>>
>>
>> http://commons.apache.org/proper/commons-math/userguide/stat.html#a1.5_Multiple_linear_regression 
>>
>>
>> Thanks for any guidance.
>
> In Java, the "row" index is the first dimension.
> Try
> ---CUT---
>  double[][] data = new double[myList.size()][17];
>  // etc.
> ---CUT---
>
> HTH,
> Gilles
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>

--
Thanks
Andy

Andy Arledge
Appraiser Genie, LLC
325-455-7890
www.appraisergenie.com


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [math] OLSMultipleLinearRegression

Gilles Sadowski
On Sun, 31 Dec 2017 17:35:26 -0600, Andy Arledge wrote:
> i had the row index 1st initially and got an error message that said:
>
> org.apache.commons.math3.exception.DimensionMismatchException: 17 !=
> 293
>
> so i tried reversing the row/columns, no luck got the message below.

Did you have a look at the unit tests[1]?
Hopefully, it should show how to set up your code.

Best,
Gilles

[1]
https://git1-us-west.apache.org/repos/asf?p=commons-math.git;a=blob;f=src/test/java/org/apache/commons/math4/stat/regression/OLSMultipleLinearRegressionTest.java;hb=HEAD

>
>
>
> On 12/31/2017 4:56 PM, Gilles wrote:
>> On Sun, 31 Dec 2017 15:01:23 -0600, Andy Arledge wrote:
>>> Hi,
>>>
>>> I get an
>>>
>>> "org.apache.commons.math3.exception.MathIllegalArgumentException:
>>> not
>>> enough data (17 rows) for this many predictors (293 predictors)"
>>>
>>> with the following code : https://pastebin.com/aZ4DXQB3
>>>
>>> My class extends OLSMultipleLinearRegression. I have 293 rows of
>>> data
>>> with 17 columns.
>>>
>>> Is there something I'm missing here? I'm basing my work on the
>>> example @
>>>
>>>
>>>
>>> http://commons.apache.org/proper/commons-math/userguide/stat.html#a1.5_Multiple_linear_regression
>>>
>>>
>>> Thanks for any guidance.
>>
>> In Java, the "row" index is the first dimension.
>> Try
>> ---CUT---
>>  double[][] data = new double[myList.size()][17];
>>  // etc.
>> ---CUT---
>>
>> HTH,
>> Gilles


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]