Skip to content

qqnorm with histogram?

7 messages · Jim Lemon, Spencer Graves, Charles C. Berry +2 more

#
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.
#
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:
#
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:
#
Spencer Graves <spencer.graves <at> structuremonitoring.com> writes:
Not sure I have a *favorite*, but the so-called "Fisher's iris data" 
provide an illustration of an obvious mixture and the value of conditioning.

Try:

 qqnorm(iris$Petal.Length,col=as.numeric(iris$Species))
 qqnorm(residuals(lm(Petal.Length~Species,iris)))

As a bonus, you can reference this pretty page:

 http://en.wikipedia.org/wiki/Iris_%28plant%29

where the contributions of the iris to water purification, art, and
symbolism are noted. 

Maybe a section on the iris in statistics... ;-)


HTH,

Chuck
#
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
-pd
On 04 Aug 2014, at 18:55 , Spencer Graves <spencer.graves at structuremonitoring.com> wrote:

            

  
    
#
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 a single function, but the subplot function in the TeachingDemos
package can be used to add the histogram and/or density plot in the
empty part of a qqplot.



On Sun, Aug 3, 2014 at 1:38 PM, Spencer Graves
<spencer.graves at structuremonitoring.com> wrote: