R 相关性中异常值的敏感性分析

R 相关性中异常值的敏感性分析,r,R,假设我有两个向量及其相关性: set.seed(123) x<-c(rnorm(19), 99.1) y<-rnorm(20, 5, 8) cor(x,y) #[1] -0.0721101 cor(x[1:19], y[1:19]) #[1] -0.0331376 set.seed(123) x您可以使用包异常值来检测异常值: outliers::grubbs.test(c(x,y)) Grubbs test for one outlier data: c(x,

假设我有两个向量及其相关性:

set.seed(123)    
x<-c(rnorm(19), 99.1)
y<-rnorm(20, 5, 8)
cor(x,y)
#[1] -0.0721101
cor(x[1:19], y[1:19])
#[1] -0.0331376
set.seed(123)

x您可以使用包
异常值
来检测异常值:

outliers::grubbs.test(c(x,y))



Grubbs test for one outlier

data:  c(x, y)
G = 5.84030, U = 0.10299, p-value < 2.2e-16
alternative hypothesis: highest value 99.1 is an outlier
异常值:grubbs.test(c(x,y)) 一个异常值的Grubbs检验 数据:c(x,y) G=5.84030,U=0.10299,p值<2.2e-16 替代假设:最高值99.1是一个异常值
如果所有数据点都有效,则不应删除异常值。此外,请在此处定义“敏感度”的含义。你的预期产出是多少?