hurst.m

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

hurst.m

Przemek Klosowski
I ran into this problem with 'hurst':

hurst is the user-defined function from the file
/usr/share/octave/2.1.71/m/signal/hurst.m

 -- Function File:  hurst (X)
     Estimate the Hurst parameter of sample X via the rescaled range
     statistic.  If X is a matrix, the parameter is estimated for every
     single column.

but there's a problem with the matrix: I get this for "hurst(rand(5))"

    error: operator -: nonconformant arguments (op1 is 5x5, op2 is 1x5)

I think it can be fixed by

*** hurst.m     2005-09-28 16:12:59.000000000 -0400
--- /usr/share/octave/2.1.71/m/signal/hurst.m   2005-08-03 15:54:46.000000000 -0400
***************
*** 42,48 ****
    [xr, xc] = size (x);

    s = std (x);
!   w = cumsum (x - repmat(mean (x),xr,1));
    RS = (max(w) - min(w)) ./ s;
    H = log (RS) / log (xr);

--- 42,48 ----
    [xr, xc] = size (x);

    s = std (x);
!   w = cumsum (x - mean (x));
    RS = (max(w) - min(w)) ./ s;
    H = log (RS) / log (xr);


because mean() sums column-wise, and I think the intent of hurst()
is to process the results column by column. Please have a look at this
and forward the patch to John if it's OK.