[R] Overlaying graphs
spencer.graves at pdf.com
Wed Sep 3 19:19:21 CEST 2003
To "demonstrate that [a variable] is normally distributed", have you
considered normal probability plots (e.g., via qqnorm)? They are much
more sensitive to departures from normality and much more informative on
the nature of those departures, e.g., showing skewness, mixtures,
outliers, ... .
hope this helps. spencer graves
Peter Dalgaard BSA wrote:
> "Paul Meagher" <paul at datavore.com> writes:
>>I am wanting to construct a probability distribution for height and then,
>>hopefully, visually and analytically demonstrate that it is normally
>>These are the commands I have developed so far:
>>fat <- read.table("fat.dat", header=TRUE)
>>mu <- mean(fat$height)
>>sdev <- sd(fat$height)
>>hist(fat$height, br=20, freq=FALSE, xlab="Male Height in Inches")
>>curve(dnorm(x, mu, sdev), from=64, to=78)
>>I do not know how to overlay the curve graphic on top of hist graphic.
>>I am hoping to show visually that the normal curve overlays the obtained
>>probability distribution when plotted on the same graph. Unfortunately, I
>>an not sure how to overlay them. Can anyone point me in the right direction
>>or show me the code.
> Using the "add" argument to curve gets you most of the way, but
> getting the y axis right is a little tricky. You could take a look at
> the scripts in the ISwR package (sec.1.3), or the book itself...
More information about the R-help