plot.npEM {mixtools} | R Documentation |
Takes an object of class npEM
and returns a set of plots of the
density estimates for each block and each component. There is one plot
per block, with all the components displayed on each block so it is possible
to see the mixture structure for each block.
## S3 method for class 'npEM': plot(x, blocks = NULL, hist=TRUE, addlegend = TRUE, scale=TRUE, title=NULL, breaks="Sturges", ylim=NULL, dens.col, newplot = TRUE, ...) ## S3 method for class 'spEM': plot(x, blocks = NULL, hist=TRUE, addlegend = TRUE, scale=TRUE, title=NULL, breaks="Sturges", ylim=NULL, dens.col, newplot = TRUE, ...)
x |
An object of class npEM such as the output
of the npEM function |
blocks |
Blocks (of repeated measures coordinates) to plot; not relevant for univariate case. Default is to plot all blocks. |
hist |
If TRUE, superimpose density estimate plots on a histogram of the data |
addlegend |
If TRUE, adds legend to the plot. |
scale |
If TRUE, scale each density estimate by its corresponding estimated mixing proportion, so that the total area under all densities equals 1 and the densities plotted may be added to produce an estimate of the mixture density. When FALSE, each density curve has area 1 in the plot. |
title |
Alternative vector of main titles for plots (recycled as many times as needed) |
breaks |
Passed directly to the hist function |
ylim |
ylim parameter to use for all plots, if desired. If not
given, each plot uses its own ylim that ensures that no part of the plot will
go past the top of the plotting area. |
dens.col |
Color values to use for the individual component density
functions, repeated as necessary. Default value is 2:(m+1) . |
newplot |
If TRUE, creates a new plot. |
... |
Any remaining arguments are passed to the hist and
lines functions. |
plot.npEM
returns a list with two elements:
x |
List of matrices. The jth column of the ith matrix is the vector of x-values for the jth density in the ith plot. |
y |
y-values, given in the same form as the x-values. |
npEM
, density.npEM
, spEMsymloc
,
plotseq.npEM
## Examine and plot water-level task data set. ## First, try a 3-component solution where no two coordinates are ## assumed i.d. data(Waterdata) a <- npEM(Waterdata, 3, bw=4) par(mfrow=c(2,4)) plot(a) # This produces 8 plots, one for each coordinate ## Next, same thing but pairing clock angles that are directly opposite one ## another (1:00 with 7:00, 2:00 with 8:00, etc.) b <- npEM(Waterdata, 3, blockid=c(4,3,2,1,3,4,1,2), bw=4) par(mfrow=c(2,2)) plot(b) # Now only 4 plots, one for each block