Plot method for an estimated distance function. Estimated distance functions are of class 'dfunc'.
# S3 method for dfunc
plot(x, include.zero = FALSE, nbins="Sturges", ...)
An estimated distance function resulting from a call to F.dfunc.estim
.
Boolean value specifying whether to include 0 in the plot. A value of TRUE will include 0 on the left hand end of the x-axis regardless of the range of distances. A value of FALSE will plot only the range on input distanced.
Internally, this function uses hist
to compute histogram bars for the plot.
This argument is the breaks
argument to hist
. This can be either a vector giving the
breakpoints between bars, a single number giving the suggested number of bars, a string naming an algorithm
to compute the number of bars, or a function to compute the number of bars. See help(hist)
for all options.
Other arguments to barplot
, such as cex
, col
, bty
, etc.
The following plot parameters cannot be included in …:
space
, density
, ylim
, xlim
, and border
. In addition,
main
, ylab
, and xlab
should not be used because the internal
values will overwrite whatever values are given.
The input distance function is returned, with two additional components related to the plot that may be needed if additional lines or text is to added to the plot by the user. These additional components are:
Scaling factor for horizontal coordinates. Due to the way barplot
works,
the x-axis has been scaled. The internal coordinates of the bars are 1, 2, …, nbars.
To plot something at a distance coordinate of x, x must be divided by this value. For example,
to draw a vertical line at a value of 10 on the x-axis, the correct call is abline(v=10/obj$xscl.plot)
.
Scaling factor for vertical coordinates. The histogram and distance function plotted by
this routine are scaled so that height of the distance function at w.lo
is g0
. Usually, this means
the distance curve is scaled so that the y-intercept is 1, or that g(0) = 1. To add a plot feature
at a real coordinate of y, y must be divided by this returned parameters. For example, to draw
a horizontal line at y-axis coordinate of 1.0, issue abline(h=1/obj$yscl)
.
A scaled histogram is plotted, and the estimated distance function is plotted over the top of it. The form of the likelihood and any series expansions is printed in the main title. Convergence of the distance function is checked. If the distance funtion did not converge, a warning is printed over the top of the histogram. If one or more parameter estimates are at their limits (likely indicating non-covergence or poor fit), another warning is printed. If the distance function did converge, the ESW is printed on the plot.
# NOT RUN {
set.seed(87654)
x <- rgamma(1000, 2,2)
fit <- F.dfunc.estim(x, likelihood="Gamma")
plot(fit)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab