| plot.lnre {zipfR} | R Documentation |
Plot LNRE Population Distribution (zipfR)
Description
Visualisation of LNRE population distribution, showing either the (log-transformed) type or probability density function or the cumulative probability distribution function.
Usage
## S3 method for class 'lnre'
plot(x, y, ...,
type=c("types", "probability", "cumulative"),
xlim=c(1e-9, 1), ylim=NULL, steps=200,
xlab=NULL, ylab=NULL, legend=NULL, grid=FALSE,
main="LNRE Population Distribution",
lty=NULL, lwd=NULL, col=NULL, bw=zipfR.par("bw"))
Arguments
x, y, ... |
one or more objects of class |
type |
what type of plot should be drawn, |
xlim, ylim |
visible range on x- and y-axis. The default |
steps |
number of steps for drawing curves (increase for extra smoothness) |
xlab, ylab |
labels for the x-axis and y-axis (with suitable defaults depending on |
legend |
optional vector of character strings or expressions
specifying labels for a legend box, which will be drawn in the upper
right-hand or left-hand corner of the screen. If |
grid |
whether to display a suitable grid in the background of the plot |
main |
a character string or expression specifying a main title for the plot |
lty, lwd, col |
style vectors that can be used to
override the global styles defined by |
bw |
if |
Details
There are two useful ways of visualising a LNRE population distribution, selected with the
type argument:
types-
A plot of the type density function
g(\pi)over the type probability\pion a log-transformed scale (so that the number of types corresponds to an integral over\log_{10} \pi, seeltdlnre). The log transformation is essential so that the density function remains in a reasonable range; a logarithmic y-axis would be very counter-intuitive. Note that density values correspond to the number of types per order of magnitude on the x-axis. probability-
A plot of the probability density function
\pi g(\pi)over the type probability\pion a log-transformed scale (so that probability mass corresponds to an integral over\log_{10} \pi, seeldlnre). Note that density values correspond to the total probability mass of types across one order of magnitude on the x-axis. cumulative-
A plot of the cumulative probability distribution, i.e. the distribution function
F(\rho) = P(\pi \le \rho)showing the total probability mass of types with type probability\pi \le \rho. The x-axis shows\rhoon a logarithmic scale (but is labelled more intuitively with\piby default). No special transformations are required because0 \le F(\rho) \le 1.
Line styles are defined globally through zipfR.par,
but can be overridden with the optional parameters
lty, lwd and col. In most cases, it is more advisable to
change the global settings temporarily for a sequence of plots, though.
The bw parameter is used to switch between B/W and colour
modes. It can also be set globally with zipfR.par.
Other standard graphics parameters (such as cex or mar) cannot
be passed to the plot function an need to be set up with par
in advance.
See Also
lnre, ltdlnre, plnre
zipfR.par, zipfR.plotutils
plot.tfl offers a different visualisation of the LNRE population distribution,
in the form of a Zipf-Mandelbrot law rather than type density.
Examples
## visualise three LNRE models trained on same data
m1 <- lnre("zm", Dickens.spc)
m2 <- lnre("fzm", Dickens.spc)
m3 <- lnre("gigp", Dickens.spc)
plot(m1, m2, m3, type="types",
xlim=c(1e-8, 1e-2), ylim=c(0, 7.5e4), legend=TRUE)
plot(m1, m2, m3, type="probability",
xlim=c(1e-8, 1e-2), grid=TRUE, legend=TRUE)
## cumulative probability distribution is not available for GIGP
plot(m1, m2, type="cumulative", grid=TRUE,
xlim=c(1e-8, 1e-2), legend=c("ZM", "fZM"))
## first argument can also be a list of models with explicit call
models <- lapply(seq(.1, .9, .2),
function (x) lnre("zm", alpha=x, B=.1))
plot.lnre(models, type="cum", grid=TRUE, legend=TRUE)
plot.lnre(models, type="prob", grid=TRUE, legend=TRUE)