plot.EM | R Documentation |
Produce diagnostic plots of EM fits returned from mixfit
.
## S3 method for class 'EM'
plot(x, size = 1.25, link = c("identity", "logit", "log"), ...)
x |
EM fit |
size |
Optional argument passed to |
link |
Choice of an applied link function. Can take one of the
values |
... |
Ignored. Overlays the fitted mixture density with a histogram and a density
plot of the raw sample fitted. Applying a link function can be
beneficial, for example a |
A list of ggplot
plots for
diagnostics of the EM run. Detailed EM diagnostic plots are
included only if the global option RBesT.verbose
is set to
TRUE
. These include plots of the parameters of each
component vs the iteration. The plot of the mixture density with a
histogram and a density of the fitted sample is always returned.
The returned plot is a ggplot2 object. Please refer to the
"Customizing Plots" vignette which is part of RBesT
documentation for an introduction. For simple modifications (change
labels, add reference lines, ...) consider the commands found in
bayesplot-helpers
. For more advanced
customizations please use the ggplot2 package directly. A
description of the most common tasks can be found in the
R Cookbook and a full
reference of available commands can be found at the
ggplot2 documentation
site.
Other EM:
mixfit()
bmix <- mixbeta(rob=c(0.2, 1, 1), inf=c(0.8, 10, 2))
bsamp <- rmix(bmix, 1000)
bfit <- mixfit(bsamp, type="beta", Nc=2)
pl <- plot(bfit)
print(pl$mixdens)
print(pl$mix)
# a number of additional plots are generated in verbose mode
.user_option <- options(RBesT.verbose=TRUE)
pl_all <- plot(bfit)
# recover previous user options
options(.user_option)
names(pl_all)
# [1] "mixdist" "a" "b" "w" "m" "N" "Lm" "lN" "Lw" "lli" "mixdens" "mixecdf" "mix"
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.