計算變異數—共變異數矩陣
除了平均數之外,多變量觀測同樣重要的統計量是它的變異數—共變異數矩陣。變異數—共變異數矩陣把變異數的概念推廣到多個維度。
本練習屬於課程
R 的多變量機率分配
練習說明
- 計算第 2 到第 5 欄中前四個數值變數的變異數—共變異數矩陣。
- 將變異數—共變異數矩陣的數值四捨五入到小數點後兩位。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Calculate the variance-covariance matrix of the variables Alcohol, Malic, Ash, Alcalinity
var.wine <- var(___)
# Round the matrix values to two decimal places
round(___, ___)