matlab bds,BDS检验

这段代码展示了如何在MATLAB中实现BDS检验,该检验用于检测时间序列的独立性。函数接受多个参数,包括最大维度、距离参数和内存限制,并通过不同的方法计算BDS统计量。代码涉及内存管理、数据预处理和位操作来计算相关统计值。
摘要由CSDN通过智能技术生成

function [w, sig, c, c1, k] = bds (series, maxdim, distance, flag, maxram)

if nargin < 5

maxram = 150;

elseif maxram > 500

disp('Are you sure you have so much memory available?')

error('If so, you need to edit the code, otherwise try again with a lower value.')

end

if nargin < 4

flag = 0;

elseif ~any(flag == [0 1])

error('Unknown method for determining dimensional distance; try again with 0 or 1.')

end

if nargin < 3

distance = 1.5;

elseif distance < 0

error('The dimensional distance parameter must be positive.')

elseif flag == 1 & distance > 1

error('The correlation integral cannot exceed 1.')

end

if nargin < 2

maxdim = 2;

elseif maxdim < 1

error('The dimension needs to be at least 1.');

end

if nargin < 1

error('Cannot compute the BDS statistic on nothing.')

end

[rows,cols] = size(series);

if rows > 1 & cols == 1

n = rows;

series = series';

elseif cols > 1 & rows == 1

n = cols;

elseif cols > 1 & rows > 1

n = cols*rows;

series = series(:)'; % transformation into a row vector

disp(sprintf('\aTransformed matrix input into a single column.'))

else

error('Cannot compute the BDS statistic on a scalar!')

end

%%%%%%%%%%%% Determination of and preparations for fastest method given MAXRAM %%%%%%%%%%%

fastbuild = 0.000016 * (1:52) .* pow2(1:52); % memory requirements

slowbuild

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值