Description:
The function 'normplot' produces log-density plots for assessing normality in univiariate data sets.
Usage:
normplot <- function(x,logplot=TRUE,PCH=1,robust=TRUE,TEST=TRUE,NSIM=1000,YLIM=0)
Arguments:
|
x:
|
a vector of data, the normality of whose distribution is to be assessed |
|
logplot:
|
logical; if TRUE, then a log-density plot is produce. If FALSE then the plot is produced on the density, rather than log-density, scale. |
|
PCH:
|
plotting character to be used in the log-density plot. |
|
robust:
|
logical; if TRUE, then robust estimates of mean and variance are employed. If FALSE, the sample mean and variance are used as estimates. |
|
TEST:
|
logical; if TRUE a Monte Carlo permutation test for normality is performed. |
|
NSIM:
|
numer of Monte Carlo simulations employed in test |
|
YLIM:
|
limits for the y-axis in log-density plot. If YLIM is a single number then these limits are chosen automatically. |
Details:
This function produces a plot of the empirical density of the data on the log-scale. The empirical density at datum x is defined to be a kernel density estimate constructed from the data and evaluated at x. The log-density for an appropriately chosen normal distribution is plotted as a reference curve against which the empirical log-density can be judged. A Monte Carlo permutation test for normality can be constructed based on the sum of squared differences between the empirical and refence densities, evaluated at the data points. This test is particularly sensitive to departures from normality in the tails of the data.
Value:
Nothing is returned by the function, but a log-density plot and Monte Carlo P-value (if desired) are printed out.
Reference:
Hazelton, M.L. (2003). A Graphical Tool for Assessing Normality, The American Statistician (in press).
See Also:
'qqnorm', 'shapiro.test'
Example:
x <- rt(25, df=1) # Cauchy data
normplot(x)