internals_for_qqplot

0th

Percentile

Internal functions for qqplot of package distr

These functions are used internally by qqplot of package distr.

Keywords
internal
Usage
.inGaps(x,gapm) .isReplicated(x, tol = .Machine$double.eps) .NotInSupport(x,D) .SingleDiscrete(x,D) .makeLenAndOrder(x,ord)
.BinomCI.in(t,p.bi,x.i, del.i=0,D.i,n.i,alpha.i) .BinomCI(x,p.b,D,n,alpha, silent0 = TRUE) .BinomCI.nosym(x,p.b,D,n,alpha, silent0 = TRUE)
.q2kolmogorov(alpha,n,exact=(n<100), silent0 =" TRUE)" .q2pw(x,p.b,d,n,alpha,exact="(n<100),nosym=FALSE,">
.confqq(x,D, datax=FALSE, withConf.pw  = TRUE, withConf.sim = TRUE, alpha, col.pCI, lty.pCI, lwd.pCI, pch.pCI, cex.pCI, col.sCI, lty.sCI, lwd.sCI, pch.sCI, cex.sCI, n,exact.sCI=(n<100),exact.pci=(n<100), nosym.pci =" FALSE," with.legend =" TRUE," legend.bg =" "white"," legend.pos =" "topleft"," legend.cex =" 0.8," legend.pref =" ""," legend.postf =" ""," legend.alpha =" alpha," qqb0 =" NULL," transf0="NULL," debug =" FALSE)
.deleteItemsMCL(mcl) .distrExInstalled
Arguments
x
a (numeric) vector
gapm
matrix; the gap matrix as in slot gaps of an "AbscontDistribution" or "UnivarLebDecDistribution" object.
tol
numeric; tolerance for separating points.
D
object of class "UnivariateDistribution"
datax
logical; (to be used in distrMod) shall data be plotted on x-axis?
ord
integer; the result of a call to order
alpha
numeric in [0,1]; confidence level
n
integer; sample size
exact
logical; shall finite sample version be used?
t
current (half of the) width of the confidence interval.
p.bi
(local) (binomial) c.d.f. value at x.i.
x.i
a (numeric) vector
del.i
numeric; a (local) asymmetry parameter to pass on to optim and uniroot --- the endpoints of the searched interval are x.i+t/sqrt(n)+del.i/sqrt(n) and x.i-t/sqrt(n)+del.i/sqrt(n).
D.i
object of class "UnivariateDistribution"
n.i
integer; (local) sample size
alpha.i
numeric in [0,1]; (local) confidence level
p.b
(binomial) c.d.f. value at x.
nosym
logical; shall we compute shortest (asymmetric) confidence intervals;
withConf.pw
logical; shall pointwise confidence lines be plotted?
withConf.sim
logical; shall simultaneous confidence lines be plotted?
exact.pCI
logical; shall pointwise CIs be determined with exact Binomial distribution?
exact.sCI
logical; shall simultaneous CIs be determined with exact kolmogorov distribution?
nosym.pCI
logical; shall we use (shortest) asymmetric CIs?
col.pCI
color for the pointwise CI
lty.pCI
line type for the pointwise CI
lwd.pCI
line width for the pointwise CI
pch.pCI
symbol for points (for discrete mass points) in pointwise CI
cex.pCI
magnification factor for points (for discrete mass points) in pointwise CI
col.sCI
color for the simultaneous CI
lty.sCI
line type for the simultaneous CI
lwd.sCI
line width for the simultaneous CI
pch.sCI
symbol for points (for discrete mass points) in simultaneous CI
cex.sCI
magnification factor for points (for discrete mass points) in simultaneous CI
with.legend
logical; shall a legend be plotted?
legend.bg
background color for the legend
legend.pos
position for the legend
legend.cex
magnification factor for the legend
legend.pref
character to be prepended to legend text
legend.postf
character to be appended to legend text
legend.alpha
nominal coverage probability
mcl
arguments in call as a list
qqb0
precomputed return value of qqbounds
transf0
optional transformation of x-values (by default NULL and then ignored)
debug
logical; if TRUE additional output to debug confidence bounds.
silent0
logical; it is used as argument silent in try-catches within this function.
Details

.inGaps produces a logical vector of same length as x with entries TRUE if the corresponding component of x lies within a gap as given by gap matrix gapm and FALSE otherwise.

.isReplicated produces a logical vector of same length as x with entries TRUE if the corresponding component of x appears at least twice within x and FALSE otherwise.

.NotInSupport produces a logical vector of same length as x with entries TRUE if the corresponding component of x does not lie within the support of D and FALSE otherwise.

.SingleDiscrete produces a numerical vector of same length as x with values 0 if the corresponding component of x is discrete mass point of D, 1 if the corresponding component of x lies within the continuous support of D, 2 and 3 if the corresponding component of x is a left resp. right end point of a gap of D, and 4 if the corresponding component of x does not lie within the support of D at all.

.makeLenAndOrder by standard recycling roules respectively by truncation at the end, forces x to length length{ord} and then orders the result according to ord.

.q2kolmogorov, in the finite sample version (exact==TRUE), returns the corresponding alpha-quantile of the exact Kolmogorov distribution multiplied by $sqrt(n)$, and in the asymptotic version (exact==FALSE), the the corresponding (upper) alpha-quantile of the asymptotic Kolmogorov distribution. Doing so we make use of C-function "pkolmogorov2x" (from ks.test in package stats) and R-function pkstwo (again from ks.test in package stats).

.BinomCI.in in a non-vectorized form, computes, for given t, x, $\code{alpha}$, $\code{del}$, and for $X distributed as D$, the discrepancy $$P(\sqrt{n} |X-x-\delta| \leq t) - \alpha$$

.BinomCI, in a vectorized form, computes, for given x, $\code{alpha}$, $\code{del}$, values t such that, pointwise in x and for $X distributed as D$, $$P(\sqrt{n} |X-x-\delta| \leq t) = \alpha$$

.BinomCI.nosym, in an outer loop, by varying del in the former formula, tries to minimize the length of a corresponding level alpha confidence interval containing the estimate.

.q2pw computes pointwise finite sample or asymptotic confidence widths by means of binomial probabilities / quantiles, in the former case either symmetric (default) or shortest asymmetric; in the asymptotic case, for distributions without a Lebesgue density, for the corresponding density value at the quantile appearing in the expression for the asymptotic variance, we make an approximation of (D-E(D))/sd(D) by the standard normal, using the density of the latter one; this latter approximation is only available if .distrExInstalled == TRUE; otherwise the corresponding columns will be filled with NA.

.confqq calls qqbound to compute the confidence intervals and plots them; returns the return value of qqbound.

.deleteItemsMCL deletes arguments from a call list which functions like plot, lines, points cannot digest; this is necessary in the manipulation of an original call to a specific qqplot method to pass on the ... argument correctly to calls the mentioned functions.

.distrExInstalled is a constant logical --- TRUE if package distrEx is installed.

Value

.inGaps
a logical vector of same length as x.
.isReplicated
a logical vector of same length as x.
.NotInSupport
a logical vector of same length as x.
.SingleDiscrete
a vector of same length as x with entries in the set ${0,1,2,3,4}$.
.makeLenAndOrder
a numeric of length length(ord.
.BinomCI.in
a numeric of length 1: the discrepancy $$P(\sqrt{n} |X-x-\delta| \leq t) - \alpha$$
.BinomCI
a numeric matrix with two columns "left" and "right" with the corresponding pointwise confidence widths.
.BinomCI.nosym
a numeric matrix with two columns "left" and "right" with the corresponding pointwise confidence widths.
.q2kolmogorov
a numeric of length 1; a corresponding quantile of the (exact/asymptotic) Kolmogorov distribution
.q2pw
a numeric matrix with two columns "left" and "right" with the corresponding pointwise confidence widths.
.confqq
invisible(NULL)
.deleteItemsMCL
the manipulated list of arguments

See Also

ks.test, qqplot , qqplot, qqplot

Aliases
  • internals_for_qqplot
  • .inGaps
  • .isReplicated
  • .NotInSupport
  • .SingleDiscrete
  • .makeLenAndOrder
  • .q2kolmogorov
  • .BinomCI.in
  • .BinomCI
  • .BinomCI.nosym
  • .q2pw
  • .confqq
  • .deleteItemsMCL
  • .distrExInstalled
Documentation reproduced from package distr, version 2.6, License: LGPL-3

Community examples

Looks like there are no examples yet.