Learn R Programming

sn (version 2.1.1)

plot.fitdistr.grouped: Plot an object generated by fitdistr.grouped

Description

The object produced by fitdistr.grouped is plotted in the form of an histogram of the input original observed frequencies with superimposed the fitted parametric density function.

Usage

# S3 method for fitdistr.grouped
plot(x, freq = FALSE, col = "grey90", 
  border = "grey80",  pdfcol = "blue", main, sub = NULL, xlab, ylab, xlim, ylim, 
  axes = TRUE, labels = FALSE, ...)

Value

A list with the following components

hist

an object of class histogram which produces the histogram.

x, y

the values used for plotting the fitted parametric distribution.

Arguments

x

a link{fitdistr.grouped} object.

freq

logical; if TRUE, the histogram graphic is to present a representation of frequencies; if FALSE (default value), densities are plotted.

col

a colour to be used to fill the bars.

border

the colour of the border around the bars.

pdfcol

the colour of the fitted parametric distribution.

main, sub, xlab, ylab

these arguments to title an be omitted, in which case default values are constructed.

xlim, ylim

the range of x and y values with sensible defaults.

axes

logical, indicating if axes should be drawn.

labels

logical or character. Additionally draw labels on top of bars, if not FALSE; if TRUE, draw the counts or rounded densities; if labels is a character, draw itself.

...

further graphical parameters to title and axis.

Author

Adelchi Azzalini

Details

The function builds on plot.histogram, but some lesser features have been dropped.

See Also

fitdistr.grouped for generating a suitable object, plot.histogram for the related more general function.

Examples

Run this code
data(barolo)
attach(barolo)
A75 <- (reseller=="A" & volume==75)
logPrice <- log(price[A75],10) # as used in selm documentation; see its fitting
detach(barolo)
breaks<- seq(1, 3, by=0.25)
f <- cut(logPrice, breaks = breaks)
freq <- tabulate(f, length(levels(f))) 
logPrice.grouped <- fitdistr.grouped(breaks, freq, family='ST')
plot(logPrice.grouped)

Run the code above in your browser using DataLab