Learn R Programming

mixtools (version 0.1.0)

plot.mixEM: 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, loglik = TRUE, density = FALSE, 
                     w = 1.0, alpha = 0.05, marginal = FALSE,
                     \dots)

Arguments

x
An object of class mixEM.
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.
w
A graphical parameter to control the height of the y-axis on the histogram when the univariate mixture of normal component's density curves are overlaid.
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 plot command.

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:
  • normalmixEMA histogram of the raw data is produced along with k density curves determined by normalmixEM.
  • repnormmixEMA histogram of the raw data produced in a similar manner as for normalmixEM.
  • mvnormalmixEMA 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 - alpha)% bivariate normal density contours. These ellipses are constructed by assigning each value to their component of most probable membership and then using normal theory. Optional marginal histograms may also be produced.
  • regmixEMA 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 - alpha)% Working-Hotelling confidence bands. These bands are constructed by assigning each value to their component of most probable membership and then performing least squares estimation.
  • logisregmixEMA 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.mixedProvides a 2x2 matrix of plots summarizing the posterior slope and posterior intercept terms from a mixture of random effects regression. See post.beta for a more detailed description.

See Also

post.beta

Examples

Run this code
##Analyzing the Old Faithful geyser data with a 2-component mixture of normals.

data(faithful)
attach(faithful)
out<-normalmixEM(waiting, arbvar = FALSE, verb = TRUE)
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)
plot(out.1, density = TRUE, alpha = c(0.01, 0.05, 0.10), 
     marginal = TRUE)

Run the code above in your browser using DataLab