BaşlayınÜcretsiz Başlayın

Get the components

The fitted model from last exercise is in the object fit_with_covariance. The aim here is to extract the means and the covariance matrices for both clusters.

Bu egzersiz

Mixture Models in R

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Use the function parameters() with the corresponding component number to extract the means and the covariance matrices for each cluster. Save the results into the objects comp_number.
  • The first two values of comp_number correspond to the mean. Save them into the objects mean_comp_number.
  • The last four values of comp_number correspond to the covariance matrix. Save these values into a 2x2 matrices.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Get the parameters
comp_1 <- ___(___, component = 1)
comp_2 <- parameters(fit_with_covariance, component = ___)

# The means
mean_comp_1 <- ___[1:2]
mean_comp_1
mean_comp_2 <- comp_2[___]
mean_comp_2

# The covariance matrices
covariance_comp_1 <- matrix(comp_1[___], nrow = 2)
covariance_comp_1
covariance_comp_2 <- matrix(comp_2[___], nrow = ___)
covariance_comp_2
Kodu Düzenle ve Çalıştır