作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试将MatLab中的t
copula适配到我的数据,并且我的功能是:
u = ksdensity(range_1, range_1,'function','cdf');
v = ksdensity(range_2, range_2,'function','cdf');
%fit a t-copula to returns
rng default ; % For reproducibility
[Rho,nu] = copulafit('t',[u v],'Method','ApproximateML');
Error using chol
Matrix must be positive definite.
Error in copulafit/approxProfileNLL_t (line 314)
nll = negloglike_t(nu,chol(Rho),t_);
Error in copulafit>bracket1D (line 494)
oldnll = nllFun(bound);
Error in copulafit (line 126)
[lowerBnd,upperBnd] = bracket1D(profileFun,lowerBnd,5); % 'upper', search ascending from 5
chol()
分解而发生的,但是我不知道应该更改哪些参数来克服此问题。任何帮助,将不胜感激。
range_1 range_2
-0.639388612 -0.639388612
1.029603565 1.029603565
1.273883288 1.273883288
0.754717135 0.754717135
1.747817835 1.747817835
1.717787291 1.717787291
-0.120625114 -0.120625114
2.173913469 2.173913469
2.836879977 2.836879977
-0.804601995 -0.804601995
0 0
最佳答案
实际上,您的range1
和range2
变量绝对相同。在命令窗口中进行简单检查即可确认:
eq = (range1 == range2)
eq =
11×1 logical array
1
1
1
1
1
1
1
1
1
1
1
copulafit
函数的目标是为高斯Copula计算线性相关参数矩阵的估计,因此整个过程将失败,除非输入变量之间的相关性太高:
c = corr(range1,range2); % 1
range1
和
range2
之间的完美正相关。引发异常的函数
chol
(引用
here)只是生成高斯Copula拟合的过程的一部分,并且由
copulafit
函数在内部进行调用。
range1 = [
-0.639388612
1.029603565
1.273883288
0.754717135
1.747817835
1.717787291
-0.120625114
2.173913469
2.836879977
-0.804601995
0
];
% just an example, I'm tired of using rand function xD
range2 = awgn(range1,1,'measured');
u = ksdensity(range1, range1,'function','cdf');
v = ksdensity(range2, range2,'function','cdf');
rng default ;
[Rho,nu] = copulafit('t',[u v],'Method','ApproximateML');
关于matlab - MatLab:胆碱必须是正定的,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46132290/
我是一名优秀的程序员,十分优秀!