function [H, H_lb, H_ub] = calc_H(fname, level, method, biasCorrected, diagnosticPlot, opt1, opt2); % Hurst index estimate and confidence interval % % fname: base file name % level: >= 1, level of crossings used % method: 'iid' for iid Z_i, 'srd' for correlated short-range dept Z_i, % 'lrd for long-range dept Z_i % biasCorrected: if 1 then bias correction for log transform is included % diagnosticPlot: if 1 then diagnostic plot required for methods srd or lrd % opt1, opt2: option parameters, passed to calc_subX_stats % % requires functions calc_subX_stats and calc_alpha_exponent % % Y.Shen 12.2002, O.D.Jones 7.2003 % calc_subXstats returns mean, variance and 95% CI for subcrossing distribution if nargin == 5 [m, m_var, m_lb, m_ub] = calc_subX_stats(fname, level, method, diagnosticPlot); elseif nargin == 6 [m, m_var, m_lb, m_ub] = calc_subX_stats(fname, level, method, diagnosticPlot, opt1); elseif nargin == 7 [m, m_var, m_lb, m_ub] = calc_subX_stats(fname, level, method, diagnosticPlot, opt1, opt2); end if biasCorrected == 1 % H = log 2/ log mu = f(mu) % m is estimator of mu, bias corrected estimator of H is f(m) - f''(m)*m_var/2 correction = m_var*log(2)/2/(m*log(m))^2*(1 + 2/log(m)); correction_lb = m_var*log(2)/2/(m_ub*log(m_ub))^2*(1 + 2/log(m_ub)); correction_ub = m_var*log(2)/2/(m_lb*log(m_lb))^2*(1 + 2/log(m_lb)); else correction = 0; correction_lb = 0; correction_ub = 0; end H = 1/log2(m) - correction; H_lb = 1/log2(m_ub) - correction_ub; H_ub = 1/log2(m_lb) - correction_lb;