開始使用免費開始

多變量離群值偵測

同一地區有 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)
編輯並執行程式碼