plotly_compCDF: Plot the Component CDF using 'plotly'

View source: R/plotly_compCDF.R

plotly_compCDFR Documentation

Plot the Component CDF using plotly

Description

Plot the components' CDF via the posterior probabilities using plotly.

Usage

plotly_compCDF(data, weights, x=seq(min(data, na.rm=TRUE), max(data, na.rm=TRUE), 
               len=250), comp=1:NCOL(weights), makeplot=TRUE,
               cex = 3, width = 3,
               legend.text = "Composition", legend.text.size = 15, legend.size = 15,
               title = "Empirical CDF", title.x = 0.5, title.y = 0.95, title.size = 15,
               xlab = "Data", xlab.size = 15, xtick.size = 15,
               ylab = "Probability", ylab.size = 15, ytick.size = 15,
               col.comp = NULL) 

Arguments

data

A matrix containing the raw data. Rows are subjects and columns are repeated measurements.

weights

The weights to compute the empirical CDF; however, most of time they are the posterior probabilities.

x

The points at which the CDFs are to be evaluated.

comp

The mixture components for which CDFs are desired.

makeplot

Logical: Should a plot be produced as a side effect?

cex

Size of markers.

width

Line width.

title

Text of the main title.

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.

col.comp

Color of compositions. Number of color specified needs to be consistent with number of compositions.

Details

When makeplot is TRUE, a line plot is produced of the CDFs evaluated at x. The plot is not a step function plot; the points (x, CDF(x)) are simply joined by line segments.

Value

A matrix with length(comp) rows and length(x) columns in which each row gives the CDF evaluated at each point of x.

References

McLachlan, G. J. and Peel, D. (2000) Finite Mixture Models, John Wiley and Sons, Inc.

Elmore, R. T., Hettmansperger, T. P. and Xuan, F. (2004) The Sign Statistic, One-Way Layouts and Mixture Models, Statistical Science 19(4), 579–587.

See Also

makemultdata, multmixmodel.sel, multmixEM, compCDF.

Examples

## The sulfur content of the coal seams in Texas
set.seed(100)
A <- c(1.51, 1.92, 1.08, 2.04, 2.14, 1.76, 1.17)
B <- c(1.69, 0.64, .9, 1.41, 1.01, .84, 1.28, 1.59)
C <- c(1.56, 1.22, 1.32, 1.39, 1.33, 1.54, 1.04, 2.25, 1.49)
D <- c(1.3, .75, 1.26, .69, .62, .9, 1.2, .32)
E <- c(.73, .8, .9, 1.24, .82, .72, .57, 1.18, .54, 1.3)
dis.coal <- makemultdata(A, B, C, D, E,
                         cuts = median(c(A, B, C, D, E)))
temp <- multmixEM(dis.coal)
## Now plot the components' CDF via the posterior probabilities
plotly_compCDF(dis.coal$x, temp$posterior, xlab="Sulfur")

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