Density Comparison Plot

plot_density(x, fits, nbins)

x | numeric vector of sample data |
---|---|

fits | a list object produced from fit_univariate, fit_empirical, or fit_univariate_man |

nbins | number of bins for histogram |

ggplot of empirical histogram of x compared to theoretical density distributions

library(ggplot2)#> Warning: package 'ggplot2' was built under R version 3.4.4set.seed(37) x <- rgamma(10000, 5) dists <- c('gamma', 'lnorm', 'weibull') fits <- lapply(dists, fit_univariate, x = x) plot_density(x, fits, 30) + theme_bw()