library(distionary)
a <- dst_norm(0, 1)
b <- dst_norm(5, 2)
m1 <- mix(a, b, weights = c(1, 4))
plot(a, col = "red", lty = 2, from = -3, to = 11)
plot(b, add = TRUE, col = "blue", lty = 2)
plot(m1, add = TRUE)
legend(
"topright",
legend = c("Mixture", "N(0,1)", "N(5,2)"),
col = c("black", "red", "blue"),
lty = c(1, 2, 2)
)
Run the code above in your browser using DataLab