# [R] Normal probability plot examples for Wikipedia (was "qqnorm with histogram?")

Spencer Graves spencer.graves at structuremonitoring.com
Tue Aug 5 16:51:20 CEST 2014

```Thanks to Charles Berry for suggesting "iris{datasets}" and to Peter
Dalgaard for suggesting Confidence Intervals as produced by qqPlot{car}.

Spencer

On 8/5/2014 2:55 AM, peter dalgaard wrote:
> Not that I want to get deeply involved with this, but techniques that allow you to take the random variation of the plots into account are badly needed in practice. I mean, running qqnorm(rnorm(10)) a dozen times _ought_ to cure you of overinterpreting plots that are not bang-on a straight line but have apparent curvature, outliers, etc., but tell that to students these days...
>
> Confidence bands would be good to include. Various techniques are in circulation; I believe John Fox implemented one for Rcmdr/car. I seem to recall that these are based on the binomial distribution or its asymptotic approximation.
>
> If you are qqnorm()-in residuals, the theory for constructing CI's for the normal plot breaks down and you need to resort to simulation techniques, e.g. something like
>
>> Y <-  rgamma(10, 5)
>> qqnorm(scale(Y))
>> for (i in 1:10) lines(qqnorm(sort(scale(rnorm(10))),plot=FALSE), col="lightgray")
> -pd
>
> On 04 Aug 2014, at 18:55 , Spencer Graves <spencer.graves at structuremonitoring.com> wrote:
>
>> Hi, Jim et al.:
>>
>>
>>       Thanks for the reply, Jim.
>>
>>
>>       What are your favorite examples using normal probability plots to identify outliers, skewness, kurtosis, mixtures, and the need for transformations in plots of raw data and residuals from model fits -- or using half-normal plots with estimated parameters?
>>
>>
>>       I ask, because I believe the current Wikipedia article on "Normal probability plot" could be improved dramatically with a set of great examples.  I also plan to write a function to display a normal probability plot with a histogram, a density estimate, and a boxplot and use it with the examples.  My current plan is to create this with a function qqnormPlus(..., datax=TRUE, histargs, densityargs, boxplotargs) that passes histargs, densityargs and boxplotargs to truehist{MASS}, density, and boxplot, respectively.  I plan to add this to the Ecfun package (for which I'm the author and maintainer).
>>
>>
>>       This wikipedia article received 14774 views in the past 90 days, averaging not quite 700 per day, so I think it's worth doing.  I could use suggestions (and help from other Wikipedians on this list).
>>
>>
>>       Thanks,
>>       Spencer
>>
>>
>> On 8/3/2014 2:59 PM, Jim Lemon wrote:
>>> Hi Spencer,
>>> The last example for the twoord.plot function (plotrix) does this.
>>>
>>> Jim
>>>
>>> On Sun, 3 Aug 2014 12:38:10 PM Spencer Graves wrote:
>>>>         Does a function exist that combines a normal probability plot
>>>> with a histogram and maybe a density estimate on the same plot?
>>>>
>>>>
>>>>         I'm revising the Wikipedia article on "Normal probability plot",
>>>> and I think it would be good to provide examples of this.
>>>>
>>>>
>>>>         Thanks,
>>>>         Spencer
>>>>
>>>>
>>>> p.s.  Please reply also with suggestions for how to improve that
>>>> Wikipedia article if you feel so inclined.
>>>>
>>>> ______________________________________________
>>>> R-help at r-project.org mailing list
>>>> https://stat.ethz.ch/mailman/listinfo/r-help