[R] distribution freq

Duncan Murdoch murdoch.duncan at gmail.com
Fri Feb 26 13:41:47 CET 2016


On 26/02/2016 4:09 AM, catalin roibu wrote:
> I'm working in forestry research and need the fitting distribution for
> forest structure in relation with diameter.
> The tree diameter have been lumped into 4 cm diameter classes, forming the
> diameter experimental distribution.
> For fitting I used the gamma distribution and I obtained the distribution
> parameters (scale and rate). After that I used the dgamma function and I
> have the pdf values. My question is how to obtain fitted absolute frequency
> to compare with the true frequency?

Since you're lumping into classes, you don't want the density, you want 
differences in the cumulative probability.  So if your class runs from 4 
to 8 cm, use something like

pgamma(8, shape, rate) - pgamma(4, shape, rate)

or the equivalent but a little obscure

diff(pgamma(c(8, 4), shape, rate))

Duncan Murdoch

P.S. Please keep discussion on the mailing list.  I've cc'd this 
response there.



More information about the R-help mailing list