Learn R Programming

lmomco (version 0.88)

gen.freq.curves: Plot Randomly Generated Frequency Curves from a Parent Distribution

Description

This function generates random samples of specified size from a specified parent distribution. Subsequently, the type of parent distribution is fit to the L-moments of the generated sample. The fitted distribution is then plotted with the built-in function lines. It is the user's responsibility to have an active plot already drawn; unless the callplot option is TRUE. This function is useful to demonstration of sample size on the uncertainty of a fitted distribution---a motivation for this function is for class room exercise.

Usage

gen.freq.curves(n, para, F=NULL, nsim=10, callplot=TRUE, 
aslog=FALSE, asprob=FALSE, showsample=FALSE, showparent=FALSE, ...)

Arguments

n
Sample size to draw from parent as specified by para.
para
The parameters from lmom2par or similar.
F
The nonexceedance probabilities for horizontal axis---defaults to nonexceeds when the argument is NULL.
nsim
The number of simulations to perform (frequency curves to draw)---the default is 10.
callplot
Calls plot to acquire a graphics device---default is TRUE, but the called plot is left empty.
aslog
Compute log10 of quantiles---note that NaNs produced in: log(x, base) will be produced for less than zero values. Otherwise this is a harmless message.
asprob
The qnorm function is used to convert nonexceedance probabilities, which are produced by nonexceeds, to standard normal deviates. The normal distribution will plot as straight line when this
showsample
Each simulated sample is drawn through plotting positions (pp).
showparent
The curve for the parent distribution is plotted on exit from the function if TRUE. Further plotting options can not be controlled---unlike the situation with the drawing of the simulated frequency curves.
...
Additional parameters are passed to the lines call within the function---except for the drawing of the parent distribution (see argument showparent.

Value

  • No value is returned. This function is used for its graphical side effects.

See Also

lmom2par, nonexceeds, rlmomco, lmoms

Examples

Run this code
para <- vec2par(c(140,4),type='gam') # build a gamma parent
F    <- nonexceeds() # vector of nonexceedance probabilities
Q    <- quagam(F,para) # the quantiles of parent distribution
# simulated are grey, parent is black
gen.freq.curves(10,para,nsim=15,asprob=TRUE,showparent=TRUE,col=8)

Run the code above in your browser using DataLab