Plotting the GAITD Combo Density
dgaitdplot.RdPlots 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.pforGaitdpois. A length 2 example isc(size.p, munb.p)forGaitdnbinom, in which casefam = "nbinom". Another length 2 example isc(mean.p, dispind.p)forGaitgenpois1, in which casefam = "genpois1".- fam
Character,
paste0("dgait", fam)should be ad-type function returning the PMF. The default is for the GAITD Poisson combo.- a.mix, i.mix, a.mlm, i.mlm
See
Gaitdpoisandgaitdpoisson.- d.mix, d.mlm
See
Gaitdpoisandgaitdpoisson.- truncate, max.support
See
Gaitdpoisandgaitdpoisson.- pobs.mix, pobs.mlm, byrow.aid
See
Gaitdpoisandgaitdpoisson.- pstr.mix, pstr.mlm, pdip.mix, pdip.mlm
See
Gaitdpoisandgaitdpoisson.- 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.plotthenplotis called. If multiple plots are desired then useoffset.xto shift the lines.- xlim, ylim, xlab, ylab
See
parandplot.default. Argumentxlimshould be integer-valued.- main, cex.main, posn.main
Character, size and position of
mainfor the title. Seetitle,parandplot.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 = 2then this setslwd.p,lwd.a,lwd.iandlwd.dall 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
parandplot.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
parandplot.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 (former?) websitehttps://www.spycolor.comwas 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 turquoise.
- type.plot, cex.p
The former matches 'type' argument in
plot.default. The latter is the size of the point iftype.plot = "p"ortype.plot = "b", etc.- lwd.p, lwd.a, lwd.i, lwd.d
Line width for parent, altered and inflated. See
parandplot.default. By defaultpar()\$lwdis 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
FALSEthen the spikes are drawn from the bottom—this makes it easier to see their distribution. Likewise, ifdeflation = TRUEthendontopis used to position the deflation (dip) probabilities.- axes.x, axes.y
Logical. Plot axes? See
parandplot.default.- Plot.trunc, cex.t, pch.t
Logical. Plot the truncated values? If so, then specify the size and plotting character. See
parandplot.default.- baseparams.argnames
Character string specifying the argument name for the generic parameter
theta, e.g.,"lambda"forgaitdpoisson, By appending.p, there is an argument calledlambda.pindgaitdpois. Another example is forgaitdlog:"shape"appended with.pmeans thatdgaitdlogshould have an argument calledshape.p. This argument is optional and increases the reliability of thedo.callcall 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.