resp.check: Plots for response variable

View source: R/resp.check.R

resp.checkR Documentation

Plots for response variable

Description

It produces a histogram of the response along with the estimated density from the assumed distribution as well as a normal Q-Q plot for the (randomised) normalised quantile response. It also provides the log-likelihood for AIC calculation, for instance.

Usage


resp.check(y, margin = "N", main = "Histogram and Density of Response",
           xlab = "Response", print.par = FALSE, plots = TRUE, 
           loglik = FALSE, os = FALSE,  
           intervals = FALSE, n.sim = 100, prob.lev = 0.05, 
           i.f = FALSE, 
           min.dn = 1e-40, min.pr = 1e-16, max.pr = 0.999999, ...)

Arguments

y

Response.

margin

The distributions allowed are: normal ("N"), log-normal ("LN"), generelised Pareto ("GP"), discrete generelised Pareto ("DGP"), Gumbel ("GU"), reverse Gumbel ("rGU"), logistic ("LO"), Weibull ("WEI"), inverse Gaussian ("iG"), gamma ("GA"), Dagum ("DAGUM"), Singh-Maddala ("SM"), beta ("BE"), Fisk ("FISK"), Poisson ("PO"), zero truncated Poisson ("ZTP"), negative binomial - type I ("NBI"), negative binomial - type II ("NBII"), Poisson inverse Gaussian ("PIG").

main

Title for the plot.

xlab

Title for the x axis.

print.par

If TRUE then the estimated parameters used to construct the plots are returned.

plots

If FALSE then no plots are produced and only parameter estimates returned.

loglik

If TRUE then it returns the logLik.

os

If TRUE then the estimated parameters are returned on the original scale.

intervals

If TRUE then intervals for the qqplot are produced.

n.sim

Number of replicate datasets used to simulate quantiles of the residual distribution.

prob.lev

Overall probability of the left and right tails of the probabilities' distribution used for interval calculations.

i.f

Internal fitting option. This is not for user purposes.

min.dn, min.pr, max.pr

Allowed minimum and maximum for estimated probabities and densities for parameter estimation.

...

Other graphics parameters to pass on to plotting commands.

Details

Prior to fitting a model with discrete and/or continuous margins, the distributions for the responses may be chosen by looking at the histogram of the response along with the estimated density from the assumed distribution, and at the normalised quantile responses. These will provide a rough guide to the adequacy of the chosen distribution. The latter are defined as the quantile standard normal function of the cumulative distribution function of the response with scale and location estimated by MLE. These should behave approximately as normally distributed variables (even though the original observations are not). Therefore, a normal Q-Q plot is appropriate here.

If loglik = TRUE then this function also provides the log-likelihood for AIC calculation, for instance.

The shapiro test can also be performed.

Author(s)

Maintainer: Giampiero Marra giampiero.marra@ucl.ac.uk

See Also

gjrm


GJRM documentation built on July 9, 2023, 7:15 p.m.