< Can you help me to overlap a histogram and theoretical density curve of
poison distribution?>
There is more than one Poisson distribution you could possibly overlap but a
common choice is the Poisson with parameter = observed mean of the data - in
your case, 0.7.

I think the below is somewhat clumsy but it gives one idea how to do it (and
r-experts will cheerfully show a better way :)

> par(bg = "cornsilk")
> 
> #number of snails, 
> r <- c(0, 1, 2, 3, 4, 5, 8, 15)
> #frequency of r
> f <- c(69, 18, 7, 2, 1, 1, 1, 1)
> 
> #a clumsy way to bin the observed values
> breakz <- (0:16) - 0.5
> 
> x <- rep(r,f)
> 
> xbar <- mean(x)
> xbar
[1] 0.7
> 
> hist(x, breaks = breakz,
+ freq = FALSE,
+ font.main = 6, 
+         col = "lightgray")
> 
> #change lambda to change the Poisson dist
> points(x, dpois(x, lambda = xbar),
+         type = "l", col = 2)
>

bob


-----Original Message-----
From: szhan@uoguelph.ca [mailto:szhan@uoguelph.ca] 
Sent: Thursday, January 15, 2004 11:20 AM
To: r-help@stat.math.ethz.ch
Subject: [R] how to overlap plots

Dear R experts:
Can you help me to overlap a histogram and theoretical density curve of
poison 
distribution? for example data like this:
The numbers of sanils found in each of 100 sampling quadrats in an area were

as follows:
number of snails, r 0 1  2 3 4 5 8 15
f=frequency of r   69 18 7 2 1 1 1 1
apparently this is not Poison but near to Poison, How to overlap the 
theoretical desity curve to the histgram of this data?
Thanks in advance!
Josh

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html

	[[alternative HTML version deleted]]


