hnp | R Documentation |
unitquantreg
objectsProduces a (half-)normal probability plot from a fitted model
object of class unitquantreg
.
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"),
...
)
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 |
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
is
TRUE
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 the nsim
ordered statistics
of the residuals, then for each set compute the quantile level
/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
or
G^{-1} \left(\frac{i - 0.375}{n + 0.25}\right)
for normal plots, i.e., halfnormal=FALSE
, where G(\cdot)
is the the
cumulative distribution function of standard Normal distribution for
quantile
residuals or the standard exponential distribution for the
cox-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.
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 |
André F. B. Menezes
Atkinson, A. C., (1981). Two graphical displays for outlying and influential observations in regression. Biometrika 68(1), 13–20.
residuals.unitquantreg
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.