I know similar questions have been asked before but nothing that is specific to my problem:
gamma_j <- function(x) {
y <- .120605*dgamma(x, shape = 2.2181, scale = 4.310067) +
.879395*dgamma(x, shape = 5.2007, scale = 8.7208)
return(y)
}
j_plot <- plot(gamma_j(0:120), type = "l")
Above is a gamma mixture I created. How do I stack this on top of my original histogram, which I made using ggplot?
pop_dist <- ggplot(HHMembers, aes(Age)) +
geom_histogram(binwidth = 1)
pop_dist
I'm sorry I don't know how to input the Age data itself. There's tens of thousands of data points so things like dput are too big for the console for me to copy and paste.
But as you can see one was using ggplot and the other was using the built-in plot function so I'm not sure how to stack them together. Plus one is a density and the other is a frequency. Would dividing the frequency by the total fix part of the problem?
Thanks (: