Dear all! I want to apply gamma distribution to a data set. I obtained ty pdf values and I want to transform this values in absolute frequencies. I used dgamma, without success. Please help me to solve this problem. Best regards! CR -- - - Catalin-Constantin ROIBU ? Lecturer PhD, Forestry engineer Forestry Faculty of Suceava Str. Universitatii no. 13, Suceava, 720229, Romania office phone +4 0230 52 29 78, ext. 531 mobile phone +4 0745 53 18 01 FAX: +4 0230 52 16 64 silvic.usv.ro <http://www.usv.ro/> [[alternative HTML version deleted]]
On 25/02/2016 6:36 AM, catalin roibu wrote:> Dear all! > > I want to apply gamma distribution to a data set. I obtained ty pdf values > and I want to transform this values in absolute frequencies. I used dgamma, > without success. Please help me to solve this problem.It's not clear what you want to do here. Could you put together a short example showing what input you have and what output you'd like? Duncan Murdoch
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.
Thank you very much for your response. But the problem still remained. I obtained my distribution parameters for all diameter data (without lump).I sow that you create the fitted freq using a difference from the neighborhood classes (8-4), but I have a huge interval from 96 fo 4. If I put diff(pgamma(c(96,8), shape, rate)) I obtaining the same values for all classes. Thank you very much for your help! Best regards! On 26 February 2016 at 14:41, Duncan Murdoch <murdoch.duncan at gmail.com> wrote:> 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. > > >-- - - Catalin-Constantin ROIBU ? Lecturer PhD, Forestry engineer Forestry Faculty of Suceava Str. Universitatii no. 13, Suceava, 720229, Romania office phone +4 0230 52 29 78, ext. 531 mobile phone +4 0745 53 18 01 FAX: +4 0230 52 16 64 silvic.usv.ro <http://www.usv.ro/> [[alternative HTML version deleted]]