ComenzarEmpieza gratis

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.

Este ejercicio forma parte del curso

Mixture Models in R

Ver curso

Instrucciones del ejercicio

  • Using ggplot(), create the histogram for the simulated data mixture. To do so, first, transform the mixture into a data frame that has a variable x.
  • Then, using the function geom_histogram(), specify that the y axis should be the density and the number of bins is 50.

Ejercicio interactivo práctico

Prueba este ejercicio completando el código de muestra.

# Transform into a data frame
mixture <- ___(x = ___)

# Create histogram especifiying that is a density plot
mixture %>% 
  ggplot() + geom_histogram(aes(x = x, y = ___), bins = ___)
Editar y ejecutar código