Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/82.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R尾波“;第三阶的前导小调不是正定的;_R - Fatal编程技术网

R尾波“;第三阶的前导小调不是正定的;

R尾波“;第三阶的前导小调不是正定的;,r,R,有人能给我解释一下这个错误消息是什么意思吗 我有一个名为hitandrun(在未完成的包中)的MCMC采样方法,它给了我一个矩阵列表,这些矩阵的列作为单个样本的多元输出,下面是一个实例: > A = matrix(1, ncol = 3) > b = 1 > ## gives me solutions of Ax = b (a.k.a x + y + z = 1) > h = hitandrun(A,b, n=10, chains = 2) > h [[1]]

有人能给我解释一下这个错误消息是什么意思吗

我有一个名为hitandrun(在未完成的包中)的MCMC采样方法,它给了我一个矩阵列表,这些矩阵的列作为单个样本的多元输出,下面是一个实例:

> A = matrix(1, ncol = 3)
> b = 1
> ## gives me solutions of Ax = b (a.k.a x + y + z = 1)
> h = hitandrun(A,b, n=10, chains = 2)
> h
[[1]]
          [,1]      [,2]      [,3]      [,4]      [,5]       [,6]      [,7]      [,8]      [,9]
[1,] 0.1804431 0.3340590 0.4195820 0.2061222 0.3591085 0.09984353 0.6707110 0.3926639 0.1283919
[2,] 0.6135745 0.4256909 0.3619727 0.2918238 0.5057426 0.81919629 0.2368842 0.1178713 0.2666737
[3,] 0.2059824 0.2402501 0.2184453 0.5020541 0.1351489 0.08096018 0.0924048 0.4894647 0.6049344
         [,10]
[1,] 0.1322112
[2,] 0.4736057
[3,] 0.3941831

[[2]]
           [,1]      [,2]      [,3]      [,4]       [,5]       [,6]      [,7]       [,8]      [,9]
[1,] 0.32883534 0.1284182 0.1735151 0.2005726 0.94511422 0.61653717 0.5130324 0.33228224 0.2088865
[2,] 0.65868549 0.3066952 0.5182009 0.3065610 0.01214334 0.07007548 0.1191157 0.01137002 0.3311197
[3,] 0.01247917 0.5648866 0.3082840 0.4928664 0.04274244 0.31338735 0.3678519 0.65634774 0.4599938
          [,10]
[1,] 0.61412223
[2,] 0.32289039
[3,] 0.06298738
我想看看Gelman Rubin对这些数据的诊断,看看我需要多少来细化它,但是当我把它放到函数中时,我得到了一个模糊的错误,我不知道它意味着什么。这是:

> mclist = lapply(h, function(x) mcmc(t(x), thin = 5))
> gelman.diag(mclist)
Error in chol.default(W) : 
  the leading minor of order 1 is not positive definite

(我猜现在是1级,但在3级之前)有没有尾波专家?我试过调试它,但它让我找到了一个内部函数La_chol,我不知道从那里该怎么办。

获得Gelman-Rubin诊断的多变量估计值似乎有问题。设置
multivariable=FALSE
可修复问题,并为每个变量输出单个变量估计值。然而,由于我试图解决的问题的性质,我的大多数变量都是相关的,因此我怀疑(并希望)这会给我一个过高的诊断值

最近我的模型出现了这个问题-我发现我的矩阵不是对称的,因为它是一个不对称的GRM矩阵。我使用此函数使其对称,问题得到解决(摘自):


symmetrise@Mike:hitandrun
函数是怎么得到的?我写的。它在一个未完成的包中。如果您想看它,它位于:,@MetricsThank;如果您在问题中指定
hitandrun
函数是不相关的,则更好,因为此处显示了馈送到
mcmc()
的整个矩阵。我认为这个问题很好(所以我把它从-1提高到了0),但可能更适合。我猜它指的是一个执行Cholesky分解的函数,它需要一个正(半?)定矩阵。这可能是一个多阶段的问题,下一阶段可能属于交叉验证或数学。
symmetrise <- function(mat){   rowscols <- which(lower.tri(mat), arr.ind=TRUE)   sparseMatrix(i=rowscols[,1], 
               j=rowscols[,2], 
               x=mat[lower.tri(mat)], 
               symmetric=TRUE, 
               dims=c(nrow(mat),ncol(mat)) )   }