ggplot(faithful, aes(x = waiting)) +
stat_distrmix_line() +
stat_distrmix_eq()
ggplot(faithful, aes(x = waiting)) +
stat_distrmix_area() +
stat_distrmix_eq()
ggplot(faithful, aes(x = waiting)) +
stat_distrmix_area(aes(fill = after_stat(quant.splits != 2)),
quantiles = c(0.025, 0.975),
show.legend = FALSE)
ggplot(faithful, aes(x = waiting)) +
stat_distrmix_line(components = "sum") +
stat_distrmix_eq(use_label("eq", "n", "method"))
ggplot(faithful, aes(x = waiting)) +
stat_distrmix_line(components = "sum") +
stat_distrmix_eq(geom = "label_npc")
ggplot(faithful, aes(x = waiting)) +
stat_distrmix_line(components = "sum") +
stat_distrmix_eq(geom = "text", label.x = "center", label.y = "bottom")
ggplot(faithful, aes(x = waiting)) +
stat_distrmix_line(components = "sum") +
stat_distrmix_eq(geom = "text", hjust = "inward")
ggplot(faithful, aes(x = waiting)) +
stat_distrmix_line(components = "members") +
stat_distrmix_eq(components = "members")
ggplot(faithful, aes(x = waiting)) +
stat_distrmix_line(components = "members") +
stat_distrmix_eq(components = "members", se = TRUE)
ggplot(faithful, aes(y = waiting)) +
stat_distrmix_line(components = "sum") +
stat_distrmix_eq(label.x = "right")
ggplot(faithful, aes(x = waiting)) +
geom_histogram(aes(y = after_stat(density)), bins = 20) +
stat_distrmix_line(aes(colour = after_stat(component),
fill = after_stat(component)),
geom = "area", linewidth = 1, alpha = 0.25) +
stat_distrmix_eq(aes(colour = after_stat(component)))
ggplot(faithful, aes(x = waiting)) +
stat_distrmix_line(aes(colour = after_stat(component),
fill = after_stat(component)),
geom = "area", linewidth = 1, alpha = 0.25,
components = "members") +
stat_distrmix_eq(aes(colour = after_stat(component)),
components = "members")
ggplot(faithful, aes(x = waiting)) +
stat_distrmix_line(geom = "area", linewidth = 1, alpha = 0.25,
colour = "black", outline.type = "upper",
components = "sum", se = FALSE) +
stat_distrmix_eq(components = "sum")
# special case of no mixture
ggplot(subset(faithful, waiting > 66), aes(x = waiting)) +
stat_distrmix_line(k = 1) +
stat_distrmix_eq(k = 1)
ggplot(subset(faithful, waiting > 66), aes(x = waiting)) +
stat_distrmix_line(k = 1) +
stat_distrmix_eq(k = 1, se = TRUE)
Run the code above in your browser using DataLab