plot.Mix: 'plot' Method for 'Mix' Objects

Description Usage Arguments See Also Examples

View source: R/0_Mix_utils.R

Description

plot method for Mix objects visualizing the mixture density, optionally showing the component densities.

Usage

1
2
3
4
5
6
## S3 method for class 'Mix'
plot(x, ylim, xlim = NULL, xout = NULL, n = 511, type = NULL,
     xlab = "x", ylab = "f(x)", main = attr(obj, "name"), 
     lwd = 1.4, log = FALSE, components = TRUE, h0 = FALSE, 
     parComp = list(col= NULL, lty = 3, lwd = 1),
     parH0   = list(col= NULL, lty = 3, lwd = 1), ...)

Arguments

x

object of class Mix.

ylim

range of y values to use; if not specified (or containing NA), the function tries to construct reasonable default values.

xlim

range of x values to use; particularly important if xout is not specified. If both are left unspecified, the function tries to construct reasonable default values.

xout

numeric or NULL giving the abscissae at which to draw the density.

n

number of points to generate if xout is unspecified (for continuous distributions).

type

character denoting the type of plot, see e.g. lines. Defaults to "l" if the mixture distribution is continuous and to "h" otherwise.

xlab,ylab

labels for the x and y axis with defaults.

main

main title of plot, defaulting to the Mix name.

lwd

line width for plotting with a non-standard default.

log

logical; if TRUE, probabilities/densities f are plotted as log(f). Only works if components is set to FALSE.

h0

logical indicating whether the line y = 0 should be drawn.

components

logical indicating whether the individual mixture components should be plotted, set to TRUE by default.

parH0

graphical parameters for drawing the line y = 0 if h0 is set to TRUE.

parComp

graphical parameters for drawing the individual components if components is set to TRUE.

...

further arguments passed to the function plotting the mixture density.

See Also

Mix for the construction of Mix objects, dMix for the density of a mixture.

Examples

1
2
3
4
5
6
7
# define 'Mix' object
normLocMix <- Mix("norm", w = c(0.3, 0.4, 0.3), mean = c(10, 13, 17), sd = c(1, 1, 1))
poisMix <- Mix("pois", w = c(0.45, 0.45, 0.1), lambda = c(1, 5, 10))

# plot 'Mix' object
plot(normLocMix)
plot(poisMix)

anjaweigel/mixComp_package documentation built on Sept. 2, 2020, 3:55 p.m.