回答问题1,可以用重标极差法,计算hurst来说明,可以使用的软件有很多,只要可以编程的软件都可以。
我以前写的MATLAB程序如下,供学习讨论:
function [logRS,logERS,V,h,H,C,R,MaxV]=RSana(x,method,q)
if nargin<1 | isempty(x)==1
error('You should provide a time series.');
else
% x must be a vector
if min(size(x))>1
error('Invalid time series.');
end
x=x(:);
% N is the time series length
N=length(x);
end
if nargin<2 | isempty(q)==1
q=0;
else
if q=='auto'
t=autocorr(x,1);
t=t(2);
q=((3*N/2)^(1/3))*((2*t/(1-t^2))^2)^(1/3);
else
% q must be a scalar
if sum(size(q))>2
error('q must be scalar.');
end
% q must be integer
if q-round(q)~=0
error('q must be integer.');
end
% q must be positive
if q<0
error('q must be positive.');
end
end
end
% n is the period lenght
n=5:floor(N/3);
for i=1:length(n)
% Calculate the sub-periods
a=floor(N/n(i));
% Calculate the number of data that not used
b=mod(N,n(i));
% Make the sub-periods matrix (use last a*n(i) data)
X=reshape(x(1+b:a*n(i)+b),n(i),a);
% Estimate the mean of each sub-period
ave=mean(X);
% Remove the mean from each sub-period
cumdev=X-ones(n(i),1)*ave;
% Estimate the cumulative deviation from the mean
cumdev=cumsum(cumdev);
% Estimate the standard deviation
switch method
case 'Hurst'
% Hurst-Mandelbrot variation
stdev=std(X);
case 'Lo'
% Lo variation
for j=1:a
sq=0;
for k=0:q
v(k+1)=sum(X(k+1:n(i),j)'*X(1:n(i)-k,j))/(n(i)-1);
if k>0
sq=sq+(1-k/(q+1))*v(k+1);
end
end
stdev(j)=sqrt(v(1)+2*sq);
end
case 'MW'
% Moody-Wu variation
for j=1:a
sq1=0;
sq2=0;
for k=0:q
v(k+1)=sum(X(k+1:n(i),j)'*X(1:n(i)-k,j))/(n(i)-1);
if k>0
sq1=sq1+(1-k/(q+1))*(n(i)-k)/n(i)/n(i);
sq2=sq2+(1-k/(q+1))*v(k+1);
end
end
stdev(j)=sqrt((1+2*sq1)*v(1)+2*sq2);
end
case 'Parzen'
% Parzen variation
if mod(q,2)~=0
error('For the "Parzen" variation q must be dived by 2.');
end
for j=1:a
sq1=0;
sq2=0;
for k=0:q
v(k+1)=sum(X(k+1:n(i),j)'*X(1:n(i)-k,j))/(n(i)-1);
if k>0 & k<=q/2
sq1=sq1+(1-6*(k/q)^2+6*(k/q)^3)*v(k+1);
elseif k>0 & k>q/2
sq2=sq2+(1-(k/q)^3)*v(k+1);
end
end
stdev(j)=sqrt(v(1)+2*sq1+2*sq2);
end
otherwise
error('You should provide another value for "method".');
end
% Estiamte the rescaled range
rs=(max(cumdev)-min(cumdev))./stdev;
clear stdev
% Take the logarithm of the mean R/S
logRS(i,1)=log(mean(rs));
% Initial calculations for the log(E(R/S))
j=1:n(i)-1;
s=sqrt((n(i)-j)./j);
s=sum(s);
% The estimation of log(E(R/S))
%ERS=s/sqrt(n(i)*pi/2);
% Other estimations of E(R/S)
ERS=(n(i)-0.5)/n(i)*s/sqrt(n(i)*pi/2);
%ERS=sqrt(n(i)*pi/2);
logERS(i,1)=log(ERS);
% Estimate V and VE
V(i,1)=mean(rs)/sqrt(n(i));
VE(i,1)=ERS/sqrt(n(i));
h(i,1)=log(n(i));
end
% Figure output
% Calcuate the Hurst index using of BP network to make regression
[H,C,R]=postreg(logRS',h');
[H1,C1,R1]=postreg(V',h');
% Text lacation xlabel
range = max(h)-(max(h)-min(h))/8;
% Find the Max value of V and the time period MaxV_N
MaxV_h=h(find(V==max(V)));
MaxV=exp((MaxV_h));
% Plot logRS and logRS* logERS and y=x line 2.1.1
subplot(2,1,1);
plot(h,logRS,'r','linewidth',1.5);
hold on;
y=C+H*h;
plot(h,y,'b','linewidth',1.5);
hold on;
plot(h,0.5*h+C,'k','linewidth',1.5);
hold on;
plot(h,logERS,'c','linewidth',1.5);
grid on;
% Description
% Text loaction ylabel
high1=min(logRS):((max(logRS)-min(logRS))/8):(min(logRS)+3*((max(logRS)-min(logRS))/8));
text(range,high1(4),'Red-logRS','HorizontalAlignment','left');
text(range,high1(3),'Blue-logRS*','HorizontalAlignment','left');
text(range,high1(2),'Cyan-logERS','HorizontalAlignment','left');
text(range,high1(1),'Black-y=C+0.5*log(n)','HorizontalAlignment','left');
title('Graph of logRS logRS* logERS and y=x');
xlabel('log(n)');
% Plot V line V* and Max value of V 2.1.2
subplot(2,1,2);
y1=C1+H1*h;
plot(h,y1,'y','linewidth',1.5);
hold on;
plot(MaxV_h,max(V),'k-*');
hold on;
plot(h,V,'g','linewidth',1.5);
hold on;
plot(h,VE,'m','linewidth',1.5);
grid on;
% Description
% Text location ylabel
high2=min(V):((max(V)-min(V))/8):(min(V)+3*((max(V)-min(V))/8));
text(range,high2(4),'Black-MaxV','HorizontalAlignment','left');
text(range,high2(3),'Green-V','HorizontalAlignment','left');
text(range,high2(2),'Yellow-V*','HorizontalAlignment','left');
text(range,high2(1),'Magenta-VE','HorizontalAlignment','left');
title('Graph of MaxV V V* and VERS');
xlabel('log(n)');