全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 MATLAB等数学软件专版
3762 3
2010-09-29
我想用copulafit集成两个分布,但是两个分布都是用paretotails拟合的分段分布,运行的结果提示出错:copulafit不能用分段分别,想问问高手,那分段分布怎样用copula集成呀?
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2010-9-29 15:48:38
问题补充:如下是出错的完整信息。
??? Error using ==> piecewisedistribution.piecewisedistribution>throwNoCatError at 146
Concatenation of PIECEWISEDISTRIBUTION objects is not allowed.  Use a cell array to contain multiple objects.

Error in ==> piecewisedistribution.piecewisedistribution>piecewisedistribution.horzcat at 133
        function a = horzcat(varargin),    throwNoCatError(); end

Error in ==> shangzhfenbunihe at 6582
rho=copulafit('Gaussian',[P1,P2])
这样看的话,出错的分段分布出错,而非copulafit.我说的是否对,请高手指教。
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2010-9-29 16:42:29
问题出在paretotails
建议你逐步执行code,
才容易除错.
[url=http://www.mathworks.com/products/econometrics/demos.html?file=/products/demos/shipping/econ/Demo_RiskEVT.html#14[/url]

可供你参考的地方,帮你汇总一下:
load Data_GlobalIdx1   
returns = price2ret(Data);    % Logarithmic returns
T       = size(returns,1);
nIndices = size(Data,2);  
spec(1:nIndices) = garchset('Distribution' , 'T'  , 'Display', 'off', ...
                            'VarianceModel', 'GJR', 'P', 1, 'Q', 1, 'R', 1);
residuals = NaN(T, nIndices);  % preallocate storage
sigmas    = NaN(T, nIndices);

for i = 1:nIndices
    [spec(i)       , errors, LLF, ...
     residuals(:,i), sigmas(:,i)] = garchfit(spec(i), returns(:,i));
end
residuals = residuals ./ sigmas;
   
nPoints      = 200;      % # of sampled points of kernel-smoothed CDF
tailFraction = 0.1;      % Decimal fraction of residuals allocated to each tail

OBJ = cell(nIndices,1);
for i = 1:nIndices
    OBJ{i} = paretotails(residuals(:,i), tailFraction, 1 - tailFraction, 'kernel');
end

U = zeros(size(residuals));
for i = 1:nIndices
    U(:,i) = OBJ{i}.cdf(residuals(:,i)); % transform margin to uniform
end

[R, DoF] = copulafit('t', U, 'Method', 'ApproximateML'); % fit the copula
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2012-4-11 10:13:10
epoh 发表于 2010-9-29 16:42
问题出在paretotails
建议你逐步执行code,
才容易除错.
for i=1:nStocks
OBJ{i}=paretotails(residuals(:,i),tailFraction,1-tailFraction,'kernel')
end
??? Error using ==> paretotails.paretotails>init at 177
Error calling CDFFUN function '@(x)ksdensity(x,'function','cdf')'.

Error in ==> paretotails.paretotails>paretotails.paretotails at 77
        [lo,up,X,F,pLower,pUpper,qLower,qUpper] = init(x,pLower,pUpper,cdfFunc);

Caused by:
    Error using ==> mtimes
    Inner matrix dimensions must agree.

请问这是什么原因造成?
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群