commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Romeo Palijan (JIRA)" <j...@apache.org>
Subject [jira] Commented: (MATH-296) LoessInterpolator.smooth() not working correctly
Date Fri, 18 Sep 2009 15:56:16 GMT

    [ https://issues.apache.org/jira/browse/MATH-296?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12757216#action_12757216
] 

Romeo Palijan commented on MATH-296:
------------------------------------

My settings are 0.3 and 4 (these are used as defaults in R). 
If I use the standard values I still get:
|3.100000000000003|6.099999999999999|3.0999999999999996|NaN|NaN|NaN|NaN|NaN|7.1|7.85|

Here is my test code for a quick look:

public void testLoessInterpolator() throws MathException{
		dataX = new double[10];
		dataX[0] = 1.5;
		dataX[1] = 3.0;
		dataX[2] = 6;
		dataX[3] = 8;
		dataX[4] = 12;		
		dataX[5] = 13;
		dataX[6] = 22;
		dataX[7] = 24;
		dataX[8] = 28;
		dataX[9] = 31;
		
		
		dataY = new double[10];
		dataY[0] = 3.1;
		dataY[1] = 6.1;
		dataY[2] = 3.1;
		dataY[3] = 2.1;
		dataY[4] = 1.4;		
		dataY[5] = 5.1;
		dataY[6] = 5.1;
		dataY[7] = 6.1;
		dataY[8] = 7.1;
		dataY[9] = 7.2;
		
		LoessInterpolator li = new LoessInterpolator();
		double[] ly = li.smooth(dataX, dataY);
		
		for (int i = 0; i < ly.length; i++) {
			System.out.println(ly[i]);
		}		
	}

Is there any obvious error which I do not see? Is it possible (although highely unlikely)
that some java floating point operations are broken on Vista64 (which I am using)?
Can you show your results?

> LoessInterpolator.smooth() not working correctly
> ------------------------------------------------
>
>                 Key: MATH-296
>                 URL: https://issues.apache.org/jira/browse/MATH-296
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 2.0
>         Environment: Java 1.6 on Vista
>            Reporter: Romeo Palijan
>
> I have been comparing LoessInterpolator.smooth output with the loessFit output from R
(R-project.org, probably the most widely used loess implementation) and have had strangely
different numbers. I have created a small set to test the difference and something seems to
be wrong with the smooth method but I do no know what and I do not understand the code.
> *Example 1*
> |x-input: |1.5| 3.0| 6| 8| 12|13| 22| 24|28|31|
> |y-input: |3.1|6.1|3.1|2.1|1.4|5.1|5.1|6.1|7.1|7.2|
> |Output LoessInterpolator.smooth():|NaN|NaN|NaN|NaN|NaN|NaN|NaN|NaN|NaN|NaN|
> |Output from loessFit() from R: |3.191178027520974|3.0407201231474037|2.7089538903778636|2.7450823274490297|4.388011000549519|4.60078952381848|5.2988217587114805|5.867536388457898|6.7797794777879705|7.444888598397342|
> *Example 2 (same x-values, y-values just floored)*
> |x-input: |1.5| 3.0| 6| 8| 12|13| 22| 24|28|31|
> |y-input: |3|6|3|2|1|5|5|6|7|7|
> |Output LoessInterpolator.smooth(): |3|6|3|2|0.9999999999999005|5.0000000000001705|5|5.999999999999972|7|6.999999999999967|
> |Output from loessFit() from R: |3.091423927353068|2.9411521572524237|2.60967950675505|2.7421759322272248|4.382996912300442|4.646774316632562|5.225153658563424|5.768301917477015|6.637079139313073|7.270482144410326|
> As you see the output is practically the replicated y-input.
> At this point this funtionality is critical for us but I could not find any other suitable
java-implementation. Help. Maybe this strange behaviour gives someone a clue?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message