problem-9.20
problem-9.20
A plot of both the empirical density and the theoretical density
of the gamma distribution with parameters chosen by
fitdistr() can be produced as follows:
> library(MASS)
> fitdistr(rivers,"gamma")
shape rate
2.5783541 0.0043609
(0.2489438) (0.0004386)
... skip warnings ...
> plot(density(rivers))
> x = 0:4000
> lines(x, dgamma(x,shape=2.578, rate= 0.00436), lty=2)
The gamma shape matches the data, but the tail behavior does not
seem that similar. A quantile-quantile plot will show this:
> qqplot(rivers, rgamma(100,shape=2.578, rate= 0.00436))