R中的稳健相关性?

机器算法验证 相关性 强大的
2022-04-10 17:39:14

我想对小样本(n<30)进行稳健的相关性。最好的估计方法是什么?

我试图对 R 中提供的用于稳健统计的大量方法进行概述 - 如果有人能给我一些建议,我会很高兴

2个回答

MASS::cov.rob链接到手册页)有两种稳健协方差的方法,您可以将它们标准化为与cov2cor. @whuber 是对的,“最好”的方法将取决于你想用它做什么,虽然..

我在 R 中实现了这些相关性措施,使用robustbase包非常容易:

http://www.stat.tugraz.at/AJS/ausg111+2/111+2Shevlyakov.pdf

文章末尾提供了污染样本案例的性能评估(n=20 和 n=1000)。你可以专注于Qn相关性,根据评估,它的效果最好。

UPD:我最近发现自己在谷歌上搜索 R 中的健壮相关代码并再次发现了这个线程。这是代码: robust_correlation <- function(robust_std, estimation_of_center_x, estimation_of_center_y, x, y) { square_root_of_two <- sqrt(2) std_of_x <- robust_std(x) std_of_y <- robust_std(y) first_component = (x - estimation_of_center_x) / (square_root_of_two * std_of_x) second_component = (y - estimation_of_center_y) / (square_root_of_two * std_of_y) u = first_component + second_component v = first_component - second_component var_of_u = robust_std(u) ** 2 var_of_v = robust_std(v) ** 2 r = (var_of_u - var_of_v) / (var_of_u + var_of_v + 10**-10) return® }