plot.mixdata: Mixdata Object Plotting

Description Usage Arguments Details See Also Examples

View source: R/plot.mixdata.R

Description

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

Usage

1
2
3
## S3 method for class '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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
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)

Example output

   length freq
1   3.005    6
2   3.255    7
3   3.505    9
4   3.755    3
5   4.005    3
6   4.255    4
7   4.505    6
8   4.755   11
9   5.005   26
10  5.255   24
11  5.505   17
12  5.755   17
13  6.005   14
14  6.255   11
15  6.505    8
16  6.755    4
17  7.005    7
18  7.255   11
19  7.505   11
20  7.755   11
21  8.005    9
22  8.255    6
23  8.505    4
24  8.755    3
25  9.005    3
26  9.255    2
27  9.505    2
28  9.755    4
29 10.005    3
30 10.255    2
31 10.505    2
32 10.755    1
33 11.005    1
34 11.255    0
35 11.505    1
36 11.755    0
37 12.005    1
38 12.255    0
39 12.505    1
40    Inf    1

mixdist documentation built on May 2, 2019, 3:34 p.m.