matlab产生年月日的时间序列,求助:在MATLAB里如何输入时间序列中的时间
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
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里如何输入时间序列中的时间相关推荐
- matlab函数输入顺序,求助:在MATLAB里如何输入时间序列中的时间
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼 function [logRS,logERS,V]=RSana(x,n,method,q) %Syntax: [logRS,logERS,V]=RSana ...
- matlab 时间序列 周期,求助:在MATLAB里如何输入时间序列中的时间
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼 function [logRS,logERS,V]=RSana(x,n,method,q) %Syntax: [logRS,logERS,V]=RSana ...
- 如何生成时间序列matlab,求助:在MATLAB里如何输入时间序列中的时间
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼 function [logRS,logERS,V]=RSana(x,n,method,q) %Syntax: [logRS,logERS,V]=RSana ...
- matlab日期textscan,求助:在MATLAB里如何输入时间序列中的时间
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼 function [logRS,logERS,V]=RSana(x,n,method,q) %Syntax: [logRS,logERS,V]=RSana ...
- matlab如何记录时间,求助:在MATLAB里如何输入时间序列中的时间
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼 function [logRS,logERS,V]=RSana(x,n,method,q) %Syntax: [logRS,logERS,V]=RSana ...
- 在matlab中输入时间日期,求助:在MATLAB里如何输入时间序列中的时间
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼 function [logRS,logERS,V]=RSana(x,n,method,q) %Syntax: [logRS,logERS,V]=RSana ...
- MATLAB中年份加月份怎么输,求助:在MATLAB里如何输入时间序列中的时间
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼 function [logRS,logERS,V]=RSana(x,n,method,q) %Syntax: [logRS,logERS,V]=RSana ...
- matlab出现无限循环警告,[求助] 关于matlab无限循环的问题
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼 各路大神,求助啊啊啊啊~ 以下是我的代码: n=0 for i=1:length(NAXLES) if CODE(i)==0 n=n+1 GVM1(n)= ...
- matlab画转体_【求助】matlab生成旋转体?
CODE: clear x = 0 : pi / 10 : 2 * pi; % x范围 y = 2 + cos( x ); % y = f( x ); [ X, Y, Z ] = cylind ...
- matlab画等势线的程序,求助大牛MATLAB画三维等势面
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼 首先,我先描述一下我的问题,我得到了一个三维数组,数字代表了三维空间中的势能,我想把等势面画出来,也就是把势能相同的点连接起来形成面,问下有没有大牛会的, ...
最新文章
- Android Activity 和 ViewGroup中事件触发和传递机制
- Pytorch搭建Faster R-CNN目标检测平台
- STRUTS2.X之使用validate方法验证数据
- 蓝桥杯2014届试题9题 小朋友排队(树状数组+类逆序对)
- 编程体系结构(02):Java异常体系
- 【LeetCode】【HOT】543. 二叉树的直径(递归)
- Linux查询pg数据库账号密码,PostgreSQL登录数据库
- 字节跳动(今日头条),战斗力为何如此凶猛?| 畅言
- FireEye实验室在一次水坑式攻击中发现IE 0DAY
- 极限编程的12个实践原则
- Java面试题视频讲解汇总,持续更新中...
- python进阶到高阶大全(强烈推荐)
- 如何在Mac之间进行数据迁移,macbook怎么迁移数据
- ubuntu 下 Aircrack 破解wifi密码(wpa/wpa2)
- vue设计调查问卷:换个思路解决问题
- 苹果个人开发者账号出售_苹果开发者账号被调查血泪史总结
- 蔡康永的说话之道总结
- 柬埔寨攻略―签证、机票
- Java画布:直线三角形,矩形,椭圆等
- android-sdk-windows版本下载
热门文章
- 机器学习与医学应用基础(超星尔雅学习通)--答案
- 常用计算机office操作知识,计算机基础知识及OFFICE常用操作_
- IOS开发之——屏幕适配-AutoLayout代码实现(03)
- Python数据分析第二周总结
- ESP32使用PCF8563时钟模块进行网络校时
- 从零开始学WEB前端——VUE介绍
- 网狐荣耀6701/6801 手机打包发布
- libiconv android编译,(OK) 编译libiconv-1.14(静态库)—CentOS 7— android-ndk
- python matplotlib阶段性总结——word转txt、绘图、文件操作
- Tomcat JAAS 身份验证和授权