elodie gillain
2007-Oct-07 00:33 UTC
[R] a function to compute the cumulative distribution function (cdf) of the gamma
Un texte encapsul? et encod? dans un jeu de caract?res inconnu a ?t? nettoy?... Nom : non disponible Url : https://stat.ethz.ch/pipermail/r-help/attachments/20071006/065906cc/attachment.pl
Ben Bolker
2007-Oct-08 11:52 UTC
[R] a function to compute the cumulative distribution function (cdf) of the gamma
elodie gillain wrote:> > Dear Forum, > > I would need to write a function to calculate the cumulative distribution > function (cdf) of the gamma random variable. I am allowed to use the > following precoded functions: rgamma, pgamma, and dgamma. I am a little > overwhelmed by this project, I am wondering how I should start. Should I > sum dgamma (or pgamma) from 0 to x, in order to obtain the cdf at x? > >This is a little bit confusing since pgamma() *is* the cumulative distribution function of a gamma random variable. (Also, "allowed to use" makes this sound a little like a homework problem ...) If you really wanted to do things the hard, inefficient way, you could use integrate() to numerically integrate (not sum) dgamma() from 0 to x -- but why not use pgamma() ?? Ben Bolker -- View this message in context: http://www.nabble.com/a-function-to-compute-the-cumulative-distribution-function-%28cdf%29-of-the-gamma-tf4581664.html#a13095089 Sent from the R help mailing list archive at Nabble.com.