[R] overlay lattice histograms with goodness-of-fit pdfs
Brad Christoffersen
bchristo at email.arizona.edu
Mon Sep 10 12:08:01 CEST 2007
Hello,
I am new to R exploratory data analysis and plotting. Is anyone aware of a way
to overlay a set of conditional histograms with conditional PDFs? Below, I
generate a lattice plot of precipitation histograms based on different months
and stations, given a subset of the dataset:
histogram(~ data | month * station,
data = sta.stack[sta.stack[,"type"]=="precip" & (sta.stack[,"month"]=="Dec" |
sta.stack[,"month"]=="Jan" | sta.stack[,"month"]=="Feb"),],
xlab = "Precipitation (mm)")
I previously used a combination of the low-level 'lines()' and 'dgamma()'
functions to overlay a gamma PDF onto a single histogram. Now what I would
like to do is to do the same thing, but with a function that allows me to
specify a formula similar to that in the histogram function above
[SomeKindOfPDF] ~ [x-range] | month * station
which will plot the PDF with the appropriate factors (month and station).
All I'm looking for is for someone to get me going in the right direction with a
useful package or function to use.
Any help is much appreciated!
Brad Christoffersen
More information about the R-help
mailing list