Skip to contents

Produces a (half-)normal probability plot from a fitted model object of class unitquantreg.

Usage

hnp(object, ...)

# S3 method for 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 unitquantreg.

...

currently not used.

nsim

number of simulations used to compute envelope. Default is 99.

halfnormal

logical. If TRUE, a half-normal plot is produced. If FALSE, a normal plot is produced.

plot

Should the (half-)normal plot be plotted? Default is TRUE.

output

Should the output be returned? Default is TRUE.

level

confidence level of the simulated envelope. Default is 0.95.

resid.type

type of residuals to be used. The default is quantile. See residuals.unitquantreg for further details.

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 nsim models.

Details

Residuals plots with simulated envelope were proposed by Atkinson (1981) and can be construct as follows:

  1. generate sample set of \(n\) independent observations from the estimated parameters of the fitted model;

  2. fit the model using the generated sample, if halfnormal is TRUE compute the absolute values of the residuals and arrange them in order;

  3. repeat steps (1) and (2) nsim number of times;

  4. 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;

  5. 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 level100% 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.

References

Atkinson, A. C., (1981). Two graphical displays for outlying and influential observations in regression. Biometrika 68(1), 13--20.

Author

André F. B. Menezes