首页 > 解决方案 > 用于产生 NaN 的典型相关的 Wilks Lambda 检验

问题描述

新来的,希望对我在 Rstudio 中进行 CCA 分析的 Wilks Lambda 测试的结果有所了解。我有 12 个预测变量(参数)和 13 个标准变量(ASC)。获取前 4 个 Pearson R 值的 NaN 和警告消息。

代码:

fit.cca <- function(X, Y){
  
  library(candisc)
  
  
  # Fit CCA
  cca_model = candisc::cancor(X, Y)
  
  # Return fitted model containing canonical correlations and wilks lambdas
  return(cca_model)
  
}

cca_model = fit.cca(params, ASC)
cca_model$cancor
Wilks(cca_model)

输出:


Test of H0: The canonical correlations in the 
current row and all that follow are zero

      CanR LR test stat    approx F numDF    denDF   Pr(> F)    
1  1.00000      0.00000 -7299828308   144 -23.9250       NaN    
2  1.00000      0.00000         NaN   121 -16.2770       NaN    
3  1.00000      0.00000   -39750398   100  -9.6216       NaN    
4  1.00000      0.00000         NaN    81  -3.9561       NaN    
5  1.00000      0.00000        2660    64   0.7233   0.04474 *  
6  1.00000      0.00000         124    49   4.4226 5.768e-05 ***
7  0.89551      0.05849           0    36   7.1522   0.99980    
8  0.74240      0.29530           0    25   8.9316   0.99996    
9  0.53585      0.65791           0    16   9.8028   0.99998    
10 0.22582      0.92290           0     9   9.8856   0.99998    
11 0.14621      0.97249           0     4  10.0000   0.99723    
12 0.07914      0.99374           0     1   6.0000   0.85224    
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Warning message:
In pf(Fstat, df1, df2, lower.tail = FALSE) : NaNs produced

我想知道导致 NaN 的原因以及可能如何解决它。

标签: rpearson-correlation

解决方案


推荐阅读