Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/64.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_Algorithm_Math_Correlation_Ranking - Fatal编程技术网

R 模糊数据的一致性系数

R 模糊数据的一致性系数,r,algorithm,math,correlation,ranking,R,Algorithm,Math,Correlation,Ranking,我正在尝试采用一个公式来计算模糊数据的一致性系数。描述它的论文就在这里 我感兴趣的具体等式是(22) 有四个观察者(即k=4)和八个对象(即n=8)。答案应该是0.7485 我可以算出肯德尔的标准方程,但这个方程不行。我想我只是搞乱了行动的顺序 在R中,我认为输入值应为: u <- c(6/7, 4/7, 1, 1/7, 2/7, 3/7, 5/7, 0, 5/7, 4/7, 6/7, 1/7, 2/7, 3/7, 0, 0, 1, 5/7, 2/7, 0, 2/7, 4/7,

我正在尝试采用一个公式来计算模糊数据的一致性系数。描述它的论文就在这里

我感兴趣的具体等式是(22)

有四个观察者(即k=4)和八个对象(即n=8)。答案应该是0.7485

我可以算出肯德尔的标准方程,但这个方程不行。我想我只是搞乱了行动的顺序

在R中,我认为输入值应为:

u <- c(6/7, 4/7, 1, 1/7, 2/7, 3/7, 5/7, 0,
5/7, 4/7, 6/7, 1/7, 2/7, 3/7, 0, 0,
    1, 5/7, 2/7, 0, 2/7, 4/7, 6/7, 1/7,
        5/7, 3/7, 4/7, 0, 2/7, 0, 6/7, 1/7)
v<-c(1/7, 3/7, 0, 6/7, 5/7, 4/7, 2/7, 1,
1/7, 2/7, 0, 5/7, 4/7, 3/7, 0, 6/7,
    0, 2/7, 4/7, 1, 4/7, 3/7, 1/7, 6/7,
        1/7, 3/7, 2/7, 6/7, 4/7, 0, 0, 5/7)

u你的向量是正确的,k=4和n=8的值也是正确的。这意味着肯德尔的协和系数计算有误差。如果不显示代码,就无法进一步帮助您,除了我放了执行此计算的电子表格kendall_concordance.ods,希望它能为您完成这项工作。我得到了0.7485的预期结果

你应该做的是:

1. Build u, v vectors (you have done this)

2. Calculate averages of each column in u and v (2n averages).

3. Subtract 0.5 from all averages and square them (for all av in u:
   av = (av - 1/2)^2, same for v) so they are now distances from
   ideal concordance for each column

4. Sum all 16 distances and multiply by 6(n-1)/(n(n+1))

我为R中的公式构建了如下函数:

vagueKendall<-function(u,v,n){
  u<-matrix (u, ncol=n, byrow = TRUE)
  v<-matrix (v, ncol=n, byrow = TRUE)
    ## divide by n-1 
  uColNo<-u/(n-1)
  vColNo<-v/(n-1)
    ## take the averages
  colMeansU<-colMeans(uColNo)
  colMeansV<-colMeans(vColNo)
    ## measure the distances from the averages 
  au = (colMeansU - 1/2)^2
  av = (colMeansV - 1/2)^2
    ## calculate component before sum
  outside<-6*(n-1)/(n*(n+1))
    ## sum of squared distances from averages 
  sumSqdDiff<-sum(au+av)
    ## The product of these gives the modified Kendall's W
  W<-outside*sum(au+av)
  return(W)
}

非常感谢你的帮助。我将建立一个有效的R函数,并将其作为一个答案添加。我对它一无所知,但在方程中,它指定在哪里执行第2点,计算列平均值?@ManassaMauler在你的方程中(对应于文件中的等式22)u_a(x_j)和v_a(x_j)是成员函数和非成员函数u和v的值的平均值(文件中的mi和v,等式14和15)
## Extract p-value function
vagueKendallP<-function(W,k,n){
## Calculate correlation coefficient 
r<-(k*W-1)/(k-1)
## Calculate Chi Squared
Chi<-k*(n-1)*W
## degrees of freedom
df<-n-1
## p-value 
pValue<-pchisq(Chi,df, lower.tail = FALSE)
return(pValue)
}