Plot histogram of Gaussian Mixture
We can use histograms to get a general overview of the distribution of a mixture model. From a histogram, we may be able to infer how many components it might have and if the distributional assumptions are suitable.
Latihan ini adalah bagian dari kursus
Mixture Models in R
Petunjuk latihan
- Using
ggplot(), create the histogram for the simulated datamixture. To do so, first, transform themixtureinto a data frame that has a variablex. - Then, using the function
geom_histogram(), specify that theyaxis should be the density and the number of bins is 50.
Latihan interaktif praktis
Cobalah latihan ini dengan menyelesaikan kode contoh berikut.
# Transform into a data frame
mixture <- ___(x = ___)
# Create histogram especifiying that is a density plot
mixture %>%
ggplot() + geom_histogram(aes(x = x, y = ___), bins = ___)