Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

evaluate to include a 3rd math-lib #77

Closed
nimo23 opened this issue Nov 6, 2017 · 3 comments
Closed

evaluate to include a 3rd math-lib #77

nimo23 opened this issue Nov 6, 2017 · 3 comments

Comments

@nimo23
Copy link
Contributor

nimo23 commented Nov 6, 2017

When I have this:

SimpleLinearRegressionIndicator reg = new SimpleLinearRegressionIndicator(close, 7);

and it outputs this for index n:

closeprice(n): "27.82"
simpleLinearReg(n): "27.7761"

does this mean the following ?:

For index n the value of n+1 is probably around "27.7761" (= prediction value).

Does "SimpleLinearRegressionIndicator" outputs the "predictionValue" for the next comming index?

Is this something like this from commons-math "SimpleLinearRegression":
http://commons.apache.org/proper/commons-math/userguide/stat.html

System.out.println(regression.predict(1.5d))
// displays predicted y value for x = 1.5
@nimo23 nimo23 changed the title SimpleLinearRegression and other math tools SimpleLinearRegression and other math tools better from 3rd lib Nov 6, 2017
@team172011
Copy link
Member

Yes, if you take a look at the test file:

    @Test
    public void calculateLinearRegression() {
        double[] values = new double[] { 1, 2, 1.3, 3.75, 2.25 };
        ClosePriceIndicator indicator = new ClosePriceIndicator(new MockTimeSeries(values));
        SimpleLinearRegressionIndicator reg = new SimpleLinearRegressionIndicator(indicator, 5);
        
        SimpleRegression origReg = buildSimpleRegression(values);
        assertDecimalEquals(reg.getValue(4), origReg.predict(4));
    }

In the last line the test should be successful if SimpleLinearRegressionIndicator returns value of origReg(int i) call from org.apache.commons.math3.stat.regression.SimpleRegression that

Returns the "predicted" y value associated with the supplied x value, based on the data that has been added to the model when this method is activated.

I think SimpleLinearRegressionIndicator should not predict any values, but calculate the current value of the linear regression

other math tools better from 3rd lib
You are right, the org.apache.commons.math3 rep is very powerful. We could use it to improve peformance and correctness, but would break with "Minimal 3rd party dependencies" and the "MIT license". Depending on how many indicators could be improved i could imagine to do so.

Regarding also #75

@nimo23
Copy link
Contributor Author

nimo23 commented Nov 6, 2017

Please evaluate the inclusion of a proper 3rd-party-math-lib.

@nimo23 nimo23 changed the title SimpleLinearRegression and other math tools better from 3rd lib evaluate the inclusion of a proper math-lib Nov 6, 2017
@nimo23 nimo23 changed the title evaluate the inclusion of a proper math-lib evaluate the inclusion of a 3rd math-lib Nov 6, 2017
@nimo23 nimo23 changed the title evaluate the inclusion of a 3rd math-lib evaluate to include a 3rd math-lib Nov 6, 2017
@team172011
Copy link
Member

Wont fix because of changes resulting from #75 and #88 (Decimal Interface..)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants