qgeneric(pdist, p, ...)
pnorm
for the normal distribution,
which must be defined in the current workspace. This should
accept and return vectorised parameters and values.
It should also return the correct values for the entire real line,
for example a positive distribution should have pdist(x)==0
for $xpdist
. These MUST be named explicitly. This may also contain the standard arguments log.p
(logical;
default FALSE
, if TRUE
, probabilities p are given as
log(p)), and lower.tail
(logical; if TRUE
(default),
probabilities are P[X <= x]="" otherwise,="" p[x=""> x].).=>
If the distribution is bounded above or below, then this should contain
arguments lbound
and ubound
respectively, and these
will be returned if p
is 0 or 1 respectively. Defaults to
-Inf
and Inf
respectively.
p
.
"q"
functions for
new distributions, in cases where the distribution function pdist
is
available analytically, but the quantile function is not. It works by finding the root of the equation $h(q) = pdist(q) - p = 0$.
Starting from the interval $(-1, 1)$, the interval width
is expanded by 50% until $h()$ is of opposite sign at either end.
The root is then found using uniroot
.
This assumes a suitably smooth, continuous distribution.
An identical function is provided in the msm package.
qnorm(c(0.025, 0.975), 0, 1)
qgeneric(pnorm, c(0.025, 0.975), mean=0, sd=1) # must name the arguments
Run the code above in your browser using DataLab