Description Usage Arguments Author(s) Examples
Estimates parameters of a univariate Normal mixture with k-means clustering and EM-algorithm.
1 2 |
data |
vector containing the sample, or list obtained with rnorm_mix. |
g |
number of components in the mixture. |
criteria |
the stop criteria to be used, could be "dif.psi" to calculate differences on parameters matrix or "dif.lh" to calculate differences on Likelihood function. |
plot.it |
logical, TRUE to plot the histogram with estimated distribution curve. |
empirical |
logical, TRUE to add the empirical curve ("Kernel Density Estimation") in the plot. |
col.estimated |
a colour to be used in the curve of estimated density. |
col.empirical |
a colour to be used in the curve of empirical density. |
... |
further arguments and graphical parameters passed to hist. |
CASTRO, M. O.; MONTALVO, G. S. A.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | ## Generate a sample.
data = rnorm_mix(n = 1000, pi = c(0.6, 0.4), mean = c(10, 18), sd = c(1, 2))
## And now, estimate the parameters, using the 'data' list.
inorm_mix(data, g = 2)
## Or using the sample vector.
inorm_mix(data$sample, g = 2)
## Using the diference in the log-likelihood as stop criteria.
inorm_mix(data, g = 2, criteria = "dif.lh")
## Not plotting the graphic.
inorm_mix(data, g = 2, plot.it = FALSE)
## Adding the empirical curve to the graphic.
inorm_mix(data, g = 2, empirical = TRUE)
## Changing the color of the curves.
inorm_mix(data, g = 2, empirical = TRUE, col.estimated = "pink", col.empirical = "red3")
## Using "..."
inorm_mix(data, g = 2, empirical = TRUE, col.estimated = "pink", col.empirical = "red3",
breaks = 300)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.