plot.mixEM {mixtools} | R Documentation |
Various Plots Pertaining to Mixture Models
Description
Takes an object of class mixEM
and returns various graphical output for select mixture models.
Usage
## S3 method for class 'mixEM'
plot(x, whichplots = 1,
loglik = 1 %in% whichplots,
density = 2 %in% whichplots,
xlab1="Iteration", ylab1="Log-Likelihood",
main1="Observed Data Log-Likelihood", col1=1, lwd1=2,
xlab2=NULL, ylab2=NULL, main2=NULL, col2=NULL,
lwd2=2, alpha = 0.05, marginal = FALSE, ...)
Arguments
x |
An object of class |
whichplots |
vector telling which plots to produce: 1 = loglikelihood
plot, 2 = density plot. Irrelevant if |
loglik |
If TRUE, a plot of the log-likelihood versus the EM iterations is given. |
density |
Graphics pertaining to certain mixture models. The details are given below. |
xlab1 , ylab1 , main1 , col1 , lwd1 |
Graphical parameters |
xlab2 , ylab2 , main2 , col2 , lwd2 |
Same as |
alpha |
A vector of significance levels when constructing confidence ellipses and confidence bands for the mixture of multivariate normals and mixture of regressions cases, respectively. The default is 0.05. |
marginal |
For the mixture of bivariate normals, should optional marginal histograms be included? |
... |
Graphical parameters passed to |
Value
plot.mixEM
returns a plot of the log-likelihood versus the EM iterations by default for all objects of class
mixEM
. In addition, other plots may be produced for the following k-component mixture model functions:
normalmixEM |
A histogram of the raw data is produced along with k density curves determined by |
repnormmixEM |
A histogram of the raw data produced in a similar manner as for |
mvnormalmixEM |
A 2-dimensional plot with each point color-coded to denote its most probable component membership. In
addition, the estimated component means are plotted along with (1 - |
regmixEM |
A plot of the response versus the predictor with each point color-coded to denote its most probable component
membership. In addition, the estimated component regression lines are plotted along with (1 - |
logisregmixEM |
A plot of the binary response versus the predictor with each point color-coded to denote its most probable compopnent membership. In addition, the estimate component logistic regression lines are plotted. |
regmixEM.mixed |
Provides a 2x2 matrix of plots summarizing the posterior slope and posterior intercept terms from a
mixture of random effects regression. See |
See Also
Examples
##Analyzing the Old Faithful geyser data with a 2-component mixture of normals.
data(faithful)
attach(faithful)
set.seed(100)
out <- normalmixEM(waiting, arbvar = FALSE, verb = TRUE,
epsilon = 1e-04)
plot(out, density = TRUE, w = 1.1)
##Fitting randomly generated data with a 2-component location mixture of bivariate normals.
x.1 <- rmvnorm(40, c(0, 0))
x.2 <- rmvnorm(60, c(3, 4))
X.1 <- rbind(x.1, x.2)
out.1 <- mvnormalmixEM(X.1, arbvar = FALSE, verb = TRUE,
epsilon = 1e-03)
plot(out.1, density = TRUE, alpha = c(0.01, 0.05, 0.10),
marginal = TRUE)