dgaitdplot {VGAM}R Documentation

Plotting the GAITD Combo Density

Description

Plots a 1- or 2-parameter GAITD combo probability mass function.

Usage

dgaitdplot(theta.p, fam = "pois", a.mix = NULL, i.mix = NULL,
    d.mix = NULL, a.mlm = NULL, i.mlm = NULL,
    d.mlm = NULL, truncate = NULL, max.support = Inf,
    pobs.mix = 0, pobs.mlm = 0,
    pstr.mix = 0, pstr.mlm = 0,
    pdip.mix = 0, pdip.mlm = 0, byrow.aid = FALSE,
    theta.a = theta.p, theta.i = theta.p, theta.d = theta.p,
    deflation = FALSE, plot.it = TRUE, new.plot = TRUE,
    offset.x = ifelse(new.plot, 0, 0.25), type.plot = "h",
    xlim = c(0, min(100, max.support + 2)),
    ylim = NULL, xlab = "", ylab = "Probability", main = "",
    cex.main = 1.2, posn.main = NULL,
    all.col = NULL, all.lty = NULL, all.lwd = NULL, 
    lty.p = "solid", lty.a.mix = "longdash", lty.a.mlm = "longdash",
    lty.i.mix = "dashed", lty.i.mlm = "dashed",
    lty.d.mix = "solid", lty.d.mlm = "solid", lty.d.dip = "dashed",
    col.p = "pink2",
    col.a.mix = artichoke.col, col.a.mlm = asparagus.col,
    col.i.mix = indigo.col, col.i.mlm = iris.col,
    col.d.mix = deer.col, col.d.mlm = dirt.col, col.d.dip = desire.col,
    col.t = turquoise.col, cex.p = 1, lwd.p = NULL, lwd.a = NULL,
    lwd.i = NULL, lwd.d = NULL, iontop = TRUE, dontop = TRUE,
    las = 0, lend = "round", axes.x = TRUE, axes.y = TRUE,
    Plot.trunc = TRUE, cex.t = 1, pch.t = 1,
    baseparams.argnames = NULL, nparams = 1, flip.args = FALSE, ...)

Arguments

theta.p

Numeric, usually scalar but may have length 2. This matches with, e.g., lambda.p for Gaitdpois. A length 2 example is c(size.p, munb.p) for Gaitdnbinom, in which case fam = "nbinom". Another length 2 example is c(mean.p, dispind.p) for Gaitgenpois1, in which case fam = "genpois1".

fam

Character, paste0("dgait", fam) should be a d-type function returning the PMF. The default is for the GAITD Poisson combo.

a.mix, i.mix, a.mlm, i.mlm

See Gaitdpois and gaitdpoisson.

d.mix, d.mlm

See Gaitdpois and gaitdpoisson.

truncate, max.support

See Gaitdpois and gaitdpoisson.

pobs.mix, pobs.mlm, byrow.aid

See Gaitdpois and gaitdpoisson.

pstr.mix, pstr.mlm, pdip.mix, pdip.mlm

See Gaitdpois and gaitdpoisson.

theta.a, theta.i, theta.d

Similar to theta.p, and they should have the same length too.

deflation

Logical. Plot the deflation (dip) probabilities?

plot.it

Logical. Plot the PMF?

new.plot, offset.x

If new.plot then plot is called. If multiple plots are desired then use offset.x to shift the lines.

xlim, ylim, xlab, ylab

See par and plot.default. Argument xlim should be integer-valued.

main, cex.main, posn.main

Character, size and position of main for the title. See title, par and plot.default. The position is used if it is a 2-vector.

all.col, all.lty, all.lwd

These arguments allow all the colours, line types and line widths arguments to be assigned to these values, i.e., so that they are the same for all values of the support. For example, if all.lwd = 2 then this sets lwd.p, lwd.a, lwd.i and lwd.d all equal to 2.

lty.p, lty.a.mix, lty.a.mlm, lty.i.mix, lty.i.mlm

Line type for parent, altered and inflated. See par and plot.default.

col.p, col.a.mix, col.a.mlm, col.i.mix, col.i.mlm

Line colour for parent (nonspecial), altered, inflated, truncated and deflated values. See par and plot.default. Roughly, by default and currently, the parent is pink-like, the altered are greenish, the inflated are purplish/violet, the truncated are light blue, and the deflated are brownish with the dip probabilities being reddish. The proper colour names are similar to being acrostic. For each operator, the colours of "mix" vs "mlm" are similar but different—this is intentional. Warning: the default colours might change, depending on style!

lty.d.mix, lty.d.mlm, lty.d.dip

Similar to above. Used when deflation = TRUE.

col.d.mix, col.d.mlm, col.d.dip

Similar to above. Used when deflation = TRUE. The website https://www.spycolor.com was used to choose some of the default colours; the first two are also called "dirt" and "deer" respectively, which are both brownish.

col.t

Point colour for truncated values, the default is "tan".

type.plot, cex.p

The former matches 'type' argument in plot.default. The latter is the size of the point if type.plot = "p" or type.plot = "b", etc.

lwd.p, lwd.a, lwd.i, lwd.d

Line width for parent, altered and inflated. See par and plot.default. By default par()\$lwd is used for all of them.

las, lend

See par.

iontop, dontop

Logicals. Draw the inflated and deflated bars on top? The default is to draw the spikes on top, but if FALSE then the spikes are drawn from the bottom—this makes it easier to see their distribution. Likewise, if deflation = TRUE then dontop is used to position the deflation (dip) probabilities.

axes.x, axes.y

Logical. Plot axes? See par and plot.default.

Plot.trunc, cex.t, pch.t

Logical. Plot the truncated values? If so, then specify the size and plotting character. See par and plot.default.

baseparams.argnames

Character string specifying the argument name for the generic parameter theta, e.g., "lambda" for gaitdpoisson, By appending .p, there is an argument called lambda.p in dgaitdpois. Another example is for gaitdlog: "shape" appended with .p means that dgaitdlog should have an argument called shape.p. This argument is optional and increases the reliability of the do.call call internally.

nparams, flip.args

Not for use by the user. It is used internally to handle the NBD.

...

Currently unused but there is provision for passing graphical arguments in in the future; see par.

Details

This is meant to be a crude function to plot the PMF of the GAITD combo model. Some flexibility is offered via many graphical arguments, but there are still many improvements that could be done.

Value

A list is returned invisibly. The components are:

x

The integer values between the values of xlim.

pmf.z

The value of the PMF, by calling the d-type function with all the arguments fed in.

sc.parent

The same level as the scaled parent distribution. Thus for inflated values, the value where the spikes begin. And for deflated values, the value at the top of the dips. This is a convenient way to obtain them as it is quite cumbersome to compute them manually. For any nonspecial value, such as non-inflated and non-deflated values, they are equal to pmf.z.

unsc.parent

Unscaled parent distribution. If there is no alteration, inflation, deflation and truncation then this is the basic PMF stipulated by the parent distribution only. Usually this is FYI only.

Note

This utility function may change a lot in the future. Because this function is called by a shiny app, if any parameter values lie outside the parameter space then stop will be called. For example, too much deflation results in NaN values returned by dgaitdnbinom.

Author(s)

T. W. Yee.

See Also

plotdgaitd, spikeplot, meangaitd, Gaitdpois, gaitdpoisson, Gaitdnbinom, multilogitlink.

Examples

## Not run:   i.mix <- seq(0, 25, by = 5)
mean.p <- 10; size.p <- 8
dgaitdplot(c(size.p, mean.p), fam = "nbinom", xlim = c(0, 25),
     a.mix = i.mix + 1, i.mix = i.mix, pobs.mix = 0.1,
     pstr.mix = 0.1, lwd.i = 2,lwd.p = 2, lwd.a = 2)

## End(Not run)

[Package VGAM version 1.1-11 Index]