hnp {unitquantreg} | R Documentation |
(Half-)Normal probability plots with simulated envelopes for
unitquantreg
objects
Description
Produces a (half-)normal probability plot from a fitted model
object of class unitquantreg
.
Usage
hnp(object, ...)
## S3 method for class 'unitquantreg'
hnp(
object,
nsim = 99,
halfnormal = TRUE,
plot = TRUE,
output = TRUE,
level = 0.95,
resid.type = c("quantile", "cox-snell"),
...
)
Arguments
object |
fitted model object of class |
... |
currently not used. |
nsim |
number of simulations used to compute envelope. Default is 99. |
halfnormal |
logical. If |
plot |
Should the (half-)normal plot be plotted? Default is |
output |
Should the output be returned? Default is |
level |
confidence level of the simulated envelope. Default is 0.95. |
resid.type |
type of residuals to be used. The default is |
Details
Residuals plots with simulated envelope were proposed by Atkinson (1981) and can be construct as follows:
generate sample set of
n
independent observations from the estimated parameters of the fitted model;fit the model using the generated sample, if
halfnormal
isTRUE
compute the absolute values of the residuals and arrange them in order;repeat steps (1) and (2)
nsim
number of times;consider the
n
sets of thensim
ordered statistics of the residuals, then for each set compute the quantilelevel
/2, the median and the quantile 1 -level
/2;plot these values and the ordered residuals of the original sample set versus the expected order statistics of a (half)-normal distribution, which is approximated as
G^{-1} \left(\frac{i + n - 0.125}{2n + 0.5} \right)
for half-normal plots, i.e.,
halfnormal=TRUE
orG^{-1} \left(\frac{i - 0.375}{n + 0.25}\right)
for normal plots, i.e.,
halfnormal=FALSE
, whereG(\cdot)
is the the cumulative distribution function of standard Normal distribution forquantile
residuals or the standard exponential distribution for thecox-snell
residuals.
According to Atkinson (1981), if the model was correctly specified then no
more than level
100% of the observations are expected to appear
outside the envelope bands. Additionally, if a large proportion of the
observations lies outside the envelope, thus one has evidence against
the adequacy of the fitted model.
Value
A list with the following components in ordered
(and absolute if halfnormal
is TRUE
) values:
obs |
the observed residuals. |
teo |
the theoretical residuals. |
lower |
lower envelope band. |
median |
median envelope band. |
upper |
upper envelope band. |
time_elapsed |
time elapsed to fit the |
Author(s)
André F. B. Menezes
References
Atkinson, A. C., (1981). Two graphical displays for outlying and influential observations in regression. Biometrika 68(1), 13–20.