Learn R Programming

mixdist (version 0.5-5)

plot.mixdata: Mixdata Object Plotting

Description

A function for plotting of Mixdata objects. It is called via the generic function plot.

Usage

# S3 method for mixdata
plot(x, mixpar = NULL, dist = "norm", root = FALSE, ytop = NULL, 
     clwd = 1, main, sub, xlab, ylab, bty, …)

Arguments

x

an object of class "mixdata", usually, the results returned by the function mixgroup.

mixpar

NULL or a data frame containing the values for parameters of component distributions, which are, in order, the proportions, means, and standard deviations.

dist

the distribution of components, it can be "norm", "lnorm", "gamma", "weibull", "binom", "nbinom" and "pois".

root

if TRUE, a hanging rootogram will be displayed.

ytop

a scalar which determines the top of the y-axis.

clwd

a positive number denoting line width, defaulting to 1.

main

an overall title for the plot.

sub

a subtitle for the plot.

xlab

a title for the x-axis.

ylab

a title for the y-axis.

bty

A character string which determined the type of box which is drawn about plots. If bty is one of "o", "l", "7", "c", "u", or "]" the resulting box resembles the corresponding upper case letter. A value of "n" suppresses the box.

additional arguments to the function plot.default.

Details

If the argument mixpar is NULL, then only the histogram of the data will be displayed; if mixpar gives the values of parameters, the component distributions and the mixture distribution are computed from the parameter values and superimposed on the histogram.

See Also

plot.mix for plotting Mix objects, plot.default for additional arguments.

Examples

Run this code
# NOT RUN {
data(cassie)
as.mixdata(cassie) # if the result isn't `NULL', then cassie is mixed data
plot.mixdata(cassie)
data(pikeraw)
data(pikepar)
pikemd <- mixgroup(pikeraw, breaks = c(0, seq(19.75, 65.75, 2), 80))
plot(pikemd)
plot(pikemd, pikepar, "lnorm")
fit <- mix(pikemd, pikepar, "lnorm", constr = mixconstr(consigma = "CCV"), emsteps = 3)
plot(fit)
plot(pikemd, pikepar, "lnorm", root = TRUE)
plot(fit, root = TRUE)
# }

Run the code above in your browser using DataLab