dmix | R Documentation |
generates data frame of density points in a provided range for a provided mix of k densities of a singlen family useful for plugging into downstream plotting (eg ggplot 2)
"..." variables depend on density function, arguments should be provided as they would to the corresponding R function (ie with respect to vectorization)
if collapse = TRUE then the density will be summed according to the mixing parameter yielding a single density (ie a fuzzy histogram) summarizing the mixing distribution
dmix(
dens = "dnorm",
xlim = NULL,
n = 500,
alpha = NULL,
plot = F,
fill = T,
collapse = F,
...
)
dens |
character specifying R density function, the possibilities include (with ... arguments shown alongside the density names) dnorm: mean, sd dbinom: size, prob dmultinom: size, prob dgamma: shape, rate dbeta: shape1, shape2 |
xlim |
length 2 vector specifying plot bounds (=NULL) |
n |
integer number of points to draw distribution over (=500) |
alpha |
length(k) numeric vector specifying mixing probability |
plot |
logical flag specifying whether to draw the plot (=FALSE) |
fill |
logical flag specifying whether to fill the colored plots (=TRUE) |
collapse |
collapse logical flag whether to collapse the mixture components into a single mixture) |
... |
additional density specific arguments each with vectorized values of length k, where k is the number of desired mixture componetns, see dens arugment) |
if plot == TRUE then ggplot2 object of plot, otherwise data.frame of data points with fields $id specifying thee mixture id, $x = data value,
Marcin Imielinski
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.