plotly_npEM: Plot Nonparametric or Semiparametric EM Output

View source: R/plotly_npEM.R

plotly_npEMR Documentation

Plot Nonparametric or Semiparametric EM Output

Description

This is an updater version of plot.npEM function by using plotly. For technical details, please refer to plot.npEM.

Usage

plotly_npEM(x, blocks = NULL, hist=TRUE, addlegend=TRUE,
            scale = TRUE, title=NULL, breaks="Sturges", 
            dens.col = NULL, newplot=TRUE, ylim = NULL ,
            col.hist = "#1f77b4",
            width = 3, title.x = 0.5 , title.y = 0.95, title.size = 15,
            xlab = "X" , xlab.size = 15 , xtick.size = 15,
            ylab = "Density" , ylab.size = 15 , ytick.size = 15,
            legend.text = "Posteriors",
            legend.text.size = 15,
            legend.size = 15)         
plotly_spEM(x, blocks = NULL, hist=TRUE, addlegend=TRUE,
            scale = TRUE, title=NULL, breaks="Sturges", 
            dens.col = NULL, newplot=TRUE, ylim = NULL ,
            col.hist = "#1f77b4",
            width = 3, title.x = 0.5 , title.y = 0.95, title.size = 15,
            xlab = "X" , xlab.size = 15 , xtick.size = 15,
            ylab = "Density" , ylab.size = 15 , ytick.size = 15,
            legend.text = "Posteriors",
            legend.text.size = 15,
            legend.size = 15)

Arguments

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.

col.hist

Color of the histogram to plot.

width

Line width.

title.size

Size of the main title.

title.x

Horsizontal position of the main title.

title.y

Vertical posotion of the main title.

xlab

Label of X-axis.

xlab.size

Size of the lable of X-axis.

xtick.size

Size of tick lables of X-axis.

ylab

Label of Y-axis.

ylab.size

Size of the lable of Y-axis.

ytick.size

Size of tick lables of Y-axis.

legend.text

Title of legend.

legend.text.size

Size of the legend title.

legend.size

Size of legend.

Value

plotly_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.

See Also

npEM, density.npEM, spEMsymloc, plotseq.npEM, plot.npEM

Examples

 
## Not run: 
## Examine and plot water-level task data set.

## First, try a 3-component solution where no two coordinates are
## assumed i.d.
data(Waterdata)
set.seed(100)
a <- npEM(Waterdata[,3:10], 3, bw=4)
plotly_npEM(a , newplot = FALSE)

## 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:10], 3, blockid=c(4,3,2,1,3,4,1,2), bw=4)
plotly_npEM(b , newplot = FALSE)

## End(Not run)


mixtools documentation built on Dec. 5, 2022, 5:23 p.m.