lmrd | R Documentation |
Draws an L
-moment ratio diagram.
lmrd(x, y, distributions = "GLO GEV GPA GNO PE3", twopar,
xlim, ylim, pch=3, cex, col, lty, lwd=1,
legend.lmrd = TRUE, xlegend, ylegend,
xlab = expression(italic(L) * "-skewness"),
ylab = expression(italic(L) * "-kurtosis"), ...)
x |
Numeric vector of Alternatively, if argument | |||||||||||||||||||||||||||
y |
Numeric vector of | |||||||||||||||||||||||||||
distributions |
Indicates the three-parameter distributions
whose
The argument should be either a character vector each of whose elements
is one of the above abbreviations or a character string
containing one or more of the abbreviations separated by blanks.
The specified If no three-parameter distributions are to be plotted,
specify | |||||||||||||||||||||||||||
twopar |
Two-parameter distributions whose (
The argument should be either a character vector each of whose elements
is one of the above abbreviations or a character string
containing one or more of the abbreviations separated by blanks.
The default is to plot the two-parameter distributions that are special
cases of the three-parameter distributions specified in
argument If no two-parameter distributions are to be plotted,
specify | |||||||||||||||||||||||||||
xlim |
x axis limits.
Default: | |||||||||||||||||||||||||||
ylim |
y axis limits.
Default: | |||||||||||||||||||||||||||
pch |
Plotting character to be used for the plotted
( | |||||||||||||||||||||||||||
cex |
Symbol size for plotted points, like graphics parameter | |||||||||||||||||||||||||||
col |
Vector specifying the colors. If it is of length 1
and | |||||||||||||||||||||||||||
lty |
Vector specifying the line types to be used for the lines on the plot. By default, colors and line types are matched to the distributions given
in argument
The green and cyan colors are less bright than the standard
| |||||||||||||||||||||||||||
lwd |
Vector specifying the line widths to be used for the lines on the plot. | |||||||||||||||||||||||||||
legend.lmrd |
Controls whether a legend,
identifying the Not used if | |||||||||||||||||||||||||||
xlegend , ylegend |
x and y coordinates of the upper left corner of the legend. Default: coordinates of the upper left corner of the plot region, shifted to the right and downwards, each by an amount equal to 1% of the range of the x axis. Not used if | |||||||||||||||||||||||||||
xlab |
X axis label. | |||||||||||||||||||||||||||
ylab |
Y axis label. | |||||||||||||||||||||||||||
... |
Additional arguments are passed to the function |
lmrd
calls a sequence of graphics functions:
matplot
for the axis box and the curves for three-parameter distributions;
points
for the points for two-parameter distributions and
text
for their labels; legend
for the legend; and
points
for the (x,y)
data points.
Note that the only graphics parameters passed to points
are col
(if of length 1), cex
, and pch
.
If more complex features are required, such as different colors for
different points, follow lmrd
by an additional call to points
,
e.g. follow lmrd(t3, t4)
by points(t3, t4, col=c("red", "green"))
.
A list, returned invisibly, describing what was plotted. Useful for customization of the legend, as in one of the examples below. List elements:
lines |
List containing elements describing the plotted distribution curves (if any).
Each element is a vector with the same length as |
twopar |
Character vector containing the 1-character symbols for the two-parameter distributions that were plotted. |
points |
List containing elements describing the plot (if any) of the data points.
List elements |
If any of the above items was not plotted, the corresponding list element is NULL
.
J. R. M. Hosking jrmhosking@gmail.com
For adding to an L
-moment ratio diagram: lmrdpoints
, lmrdlines
.
data(airquality)
lmrd(samlmu(airquality$Ozone))
# Tweaking a few graphics parameters makes the graph look better
# (in the author's opinion)
lmrd(samlmu(airquality$Ozone), xaxs="i", yaxs="i", las=1)
# An example that illustrates the sampling variability of L-moments
#
# Generate 50 random samples of size 30 from the Gumbel distribution
# - stored in the rows of matrix mm
mm <- matrix(quagum(runif(1500)), nrow=50)
#
# Compute the first four sample L-moments of each sample
# - stored in the rows of matrix aa
aa <- apply(mm, 1, samlmu)
#
# Plot the L-skewness and L-kurtosis values on an L-moment ratio
# diagram that also shows (only) the population L-moment ratios
# of the Gumbel distribution
lmrd(t(aa), dist="", twopar="G", col="red")
# L-moment ratio diagram with curves for GLO, GEV, GPA, and Weibull.
# The Weibull curve is added manually. A legend is added,
# using information returned from lmrd().
#
# - Draw the diagram, with the GLO, GEV, and GPA curves
info <- lmrd(distributions="GLO GEV GPA", xaxs="i", yaxs="i", las=1, legend=FALSE)
#
# - Compute L-skewness and L-kurtosis values for Weibull
sa <- sapply(seq(0, 0.6, by=0.01),
function(tau3) lmrwei(pelwei(c(0,1,tau3)), nmom=4)[3:4])
#
# - Plot the Weibull curve
lmrdlines(sa["tau_3",], sa["tau_4",], col="magenta", lwd=2)
#
# - Add a legend
legend("topleft", bty="n",
legend = c(info$lines$distributions, "WEI"),
col = c(info$lines$col.lines, "magenta"),
lwd = c(info$lines$lwd, 3))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.