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

View source: R/sn-funct.R

plot.fitdistr.groupedR Documentation

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 class 'fitdistr.grouped'
plot(x, freq = FALSE, col = "grey90", 
  border = "grey80",  pdfcol = "blue", main, sub = NULL, xlab, ylab, xlim, ylim, 
  axes = TRUE, labels = FALSE, ...)

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.

Details

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

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.

Author(s)

Adelchi Azzalini

See Also

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

Examples

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)

sn documentation built on April 5, 2023, 5:15 p.m.