多变量离群点检测
同一地区的 100 位居民因周日晚的冰雹风暴导致房屋受损而提出理赔。数据集 hailinsurance 含有 100 条观测和 2 个变量。第一列为保险公司向每位客户支付的赔付金额,第二列为最近一次的房价。
在本练习中,您将先对该数据集使用经典估计量。随后,您会将结果与稳健估计量进行比较。
本练习是课程的一部分
R 中的欺诈检测
交互式实操练习
通过完成这段示例代码来试试这个练习。
# Create a scatterplot
plot(hailinsurance, xlab = "price house", ylab = "claim")
# Compute the sample mean and sample covariance matrix
clcenter <- colMeans(___)
clcov <- cov(___)
# Add 97.5% tolerance ellipsoid
rad <- sqrt(qchisq(___, ___))
ellipse(center = clcenter, shape = clcov, radius = rad,col = "blue", lty = 2)