Skip to content
Numerical Method , home
Menu

Forum Numerical Method Statistics

How to use AugmentedDickeyFuller object in suanShu ?

  1. rafiaParticipant 2012-07-31 at 1:46 pm

    Hello I try to consctruct the AugmentedDickeyFuller object but i always have a “java.lang.NullPointerException” return.

    I use this constructor : AugmentedDickeyFuller stationarite = new AugmentedDickeyFuller(residu.getVals());
    

    Where residu.getVals() is an array of double not null.

    My var “stationarite” is alwais null, anybody can tell me why or how to use this method correctly ?

    Thanks

  2. RyuParticipant 2012-07-31 at 1:50 pm

    The usage is correct. Can you post the source code for investigation?

  3. rafiaParticipant 2012-07-31 at 1:57 pm

    yes,

    // at the start of the program I save the ratio betwin two pairs.
    if (coeff == 0)
    coeff = parseur.eurjpyBid / parseur.eurusdAsk;
    
    //I save a value in a personal object
    residu.addValeur(parseur.eurjpyBid – coeff * parseur.eurusdAsk);
    
    AugmentedDickeyFuller stationarite = null;
    if (residu.pret)				// if my table are full ->
    stationarite = new AugmentedDickeyFuller(residu.getValeurs());		// I construct the object (residu.getValeurs() return -> double[])
    

    system.out.println(stationarite.k); // here stationarite is null

  4. RyuParticipant 2012-07-31 at 2:39 pm

    Are you sure [tt:3di47kkw]residu.getValeurs()[/tt:3di47kkw] is not [tt:3di47kkw]null[/tt:3di47kkw], or the line in [tt:3di47kkw]if[/tt:3di47kkw] is actually executed?

    We cannot investigate unless we have a source code that compiles and runs.

  5. rafiaParticipant 2012-07-31 at 4:30 pm

    Yes the line is executed and getValeurs() is not null.

    I join the files if you want inspect the code.

    Thank for your help.

  6. RyuParticipant 2012-07-31 at 6:42 pm

    Well, your code depends on reading some files that we have no access to. Why don’t you manually put in the data in an array and see if it works? For example,

    <br />
            double[] sample = new double[]{0.2, 0.3, -0.1, 0.4, -0.5, 0.6, 0.1, 0.2};<br />
            AugmentedDickeyFuller instance = new AugmentedDickeyFuller(sample, TrendType.CONSTANT, 0, null);<br />
            assertEquals(-5.1504, instance.statistics, 1e-4);<br />
            assertEquals(0.01, instance.pValue, 1e-2);//from R: p-value smaller than printed p-value 0.01<br />
    
  7. rafiaParticipant 2012-08-01 at 12:44 pm

    I don’t know what I changed but today the object is not empty, maybe am I mix me because I had 2 errors. I called the method “getNullHypothesis()” wich is broken.

    Thank you very much.

    Since today I have the message : Exception in thread “main” com.numericalmethod.suanshu.license.InvalidLicense: the license is expired: licensed period is [2012-06-15, 2012-08-01] but now is 2012-08-01

    I thinked that I have 30 days to use it and I only use for 2 days, is it normal ?

    Edit:

    I missed, the k, lagOrder and N values are always to 0 and never change, why ?

  8. RyuParticipant 2012-08-01 at 5:41 pm

    What do you mean by “getNullHypothesis()” broken?

    lagOrder is a user input parameter. If you use the one-argument constructor, it is set to 0 by default.

    k is the number of group; N is the number of observations.

    If they are 0, it means your data is empty.

    I sent you a new one-month license to your registered email.