该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

function

[logRS,logERS,V]=RSana(x,n,method,q)

%Syntax:

[logRS,logERS,V]=RSana(x,n,method,q)

%____________________________________________

%

% Performs R/S

analysis on a time series.

%

% logRS is the

log(R/S).

% logERS is the

Expectation of log(R/S).

% V is the V

statistic.

% x is the time

series.

% n is the vector

with the sub-periods.

% method can take

one of the following values

% 'Hurst'

for the Hurst-Mandelbrot variation.

% 'Lo' for the Lo variation.

% 'MW' for the Moody-Wu variation.

% 'Parzen' for the Parzen variation.

% q can be either

% a (non-negative) integer.

% 'auto' for the Lo's suggested value.

%

%

% References:

%

% Peters E (1991):

Chaos and Order in the Capital Markets. Willey

%

% Peters E (1996):

Fractal Market Analysis. Wiley

%

% Lo A (1991): Long

term memory in stock market prices. Econometrica

% 59: 1279-1313

%

% Moody J, Wu L

(1996): Improved estimates for Rescaled Range and Hurst

% exponents. Neural

Networks in Financial Engineering, eds. Refenes A-P

% Abu-Mustafa Y,

Moody J, Weigend A: 537-553, Word Scientific

%

% Hauser M (1997):

Semiparametric and nonparametric testing for long

% memory: A Monte

Carlo study. Empirical Economics 22: 247-271

%

%

% Alexandros

Leontitsis

% Department of

Education

% University of

Ioannina

% 45110 - Dourouti

% Ioannina

% Greece

%

% University

e-mail: me00743@cc.uoi.gr

% Lifetime e-mail:

leoaleq@yahoo.com

% Homepage:

http://www.geocities.com/CapeCanaveral/Lab/1421

%

% 1 Jan 2004.

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(n)==1

n=1;

else

% n must be either a scalar or a vector

if

min(size(n))>1

error('n must be either a scalar or a

vector.');

end

% n must be integer

if n-round(n)~=0

error('n must be integer.');

end

% n must be positive

if n<=0

error('n must be positive.');

end

end

if nargin<4 |

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/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

for i=1:length(n)

% Calculate the sub-periods

a=floor(N/n(i));

% Make the sub-periods matrix

X=reshape(x(1:a*n(i)),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)=log10(mean(rs));

if nargout>1

% Initial calculations fro 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))

logERS(i,1)=log10(s/sqrt(n(i)*pi/2));

% Other estimations of log(E(R/S))

%logERS(i,1)=log10((n(i)-0.5)/n(i)*s/sqrt(n(i)*pi/2));

%logERS(i,1)=log10(sqrt(n(i)*pi/2));

end

if nargout>2

% Estimate V

V(i,1)=mean(rs)/sqrt(n(i));

end

end

matlab 输入时间,求助:在MATLAB里如何输入时间序列中的时间相关推荐

  1. matlab解决相遇追及问题,猎犬追狐狸试题中追击时间问题的严格求解.doc

    猎犬追狐狸试题中追击时间问题的严格求解1试题这是一道有趣的高中物理运动学奥赛题:如图1 所示, 有一只狐狸以不变速度v1沿着直线AB逃跑, 一猎犬以不变的速率v2追击, 其运动方向始终对准狐狸.某时刻 ...

  2. linux 命令提示符 时间,在LINUX的命令提示符及CMD命令提示符中显示时间

    用途之一是可以查看某个命令或程序的执行时间. 一.CMD中显示时间设置 参数说明: $P:当前路径 $G:>(大于号) $T:当前时间,精确到0.01s 实验如下: C:\Users\g4-10 ...

  3. cmd怎么进入linux系统时间,在LINUX的命令提示符及CMD命令提示符中显示时间

    用途之一是可以查看某个命令或程序的执行时间. 一.CMD中显示时间设置 参数说明: $P:当前路径 $G:>(大于号) $T:当前时间,精确到0.01s 实验如下: C:\Users\g4-10 ...

  4. oracle时间24小时格式转换,在oracle数据库中查询时间并转为24小时制--------------String转Date类型或者Date转String类型...

    1.在Oracle数据库中查询时间的时候,首先就是把日期从date类型的转化为String类型的. 2.将date类型的转成String类型的,直接调用传入date类型的参数,返回String类型的字 ...

  5. matlab函数输入顺序,求助:在MATLAB里如何输入时间序列中的时间

    该楼层疑似违规已被系统折叠 隐藏此楼查看此楼 function [logRS,logERS,V]=RSana(x,n,method,q) %Syntax: [logRS,logERS,V]=RSana ...

  6. matlab 时间序列 周期,求助:在MATLAB里如何输入时间序列中的时间

    该楼层疑似违规已被系统折叠 隐藏此楼查看此楼 function [logRS,logERS,V]=RSana(x,n,method,q) %Syntax: [logRS,logERS,V]=RSana ...

  7. 如何生成时间序列matlab,求助:在MATLAB里如何输入时间序列中的时间

    该楼层疑似违规已被系统折叠 隐藏此楼查看此楼 function [logRS,logERS,V]=RSana(x,n,method,q) %Syntax: [logRS,logERS,V]=RSana ...

  8. matlab日期textscan,求助:在MATLAB里如何输入时间序列中的时间

    该楼层疑似违规已被系统折叠 隐藏此楼查看此楼 function [logRS,logERS,V]=RSana(x,n,method,q) %Syntax: [logRS,logERS,V]=RSana ...

  9. matlab如何记录时间,求助:在MATLAB里如何输入时间序列中的时间

    该楼层疑似违规已被系统折叠 隐藏此楼查看此楼 function [logRS,logERS,V]=RSana(x,n,method,q) %Syntax: [logRS,logERS,V]=RSana ...

  10. 在matlab中输入时间日期,求助:在MATLAB里如何输入时间序列中的时间

    该楼层疑似违规已被系统折叠 隐藏此楼查看此楼 function [logRS,logERS,V]=RSana(x,n,method,q) %Syntax: [logRS,logERS,V]=RSana ...

最新文章

  1. 接口测试用例测试模板
  2. 大多数人对AI的理解,都是错的
  3. linux whois工具,CentOS如何安装whois命令
  4. python写出的程序如何给别人使用-python如何写出表白程序
  5. 专家票选! 2020 年度 10 篇人工智能经典论文(6-10)
  6. Apache Shiro 框架简介和下载导入
  7. 解决开机POST提示Strike tne F1 key to continue,F2 to run the setup utility
  8. 频谱分析幅值单位_FFT分析的注意事项,您都知道吗?
  9. 心理正常与异常的区分_【敬畏生命,拥抱生活】公政青协“善爱我”系列活动之如何识别心理正常与异常...
  10. 前端性能优化的那些事
  11. 定时任务发展史(二)
  12. 输入法辅助工具:自动切换输入法 for Mac
  13. 【论文解读】深度学习目标检测 | R-CNN系列里程碑 | 一文弄懂Faster R-CNN
  14. 求s = a + aa + aaa +aaaa +……a的值
  15. Enolsoft PDF Converter with OCR Mac(PDF格式转换及OCR识别软件)
  16. 没有水印的夸克免费扫描
  17. C++ 算法篇 动态规划----区间动态规划
  18. 大三时候看了这份路线,进阿里了,进大厂保姆教程,收藏起来
  19. macd的python代码同花顺_缠论辅助同花顺Macd面积2种公式源代码
  20. 净水器的数字电路理论基础

热门文章

  1. 使用css让文字两端对齐
  2. Retrofit2的再封装实战—多线程下载与断点续传(三)
  3. Unity3D游戏开发之换装系统的实现
  4. php中json_encode中文编码问题(转)
  5. FAQ 工作薄及工作表
  6. 英特尔 XML 安全网关
  7. C# 比较两个数组中的内容是否相同的算法
  8. 导航猫连接Oracle
  9. jsp中使用echarts简单示例
  10. 解决办法:无法获得锁 /var/lib/dpkg/lock-frontend - open (11: 资源暂时不可用)