Hi. I have a vector of quantiles and a vector of probabilites that, when plotted, look very like the gamma cumulative distribution function. I can guess some shape and scale parameters that give a similar result, but I'd rather let the parameters be estimated. Is there a direct way to do this in R? Thanks, Tim. week <- c(0,5,6,7,9,11,14,19,39) fraction <- c(0,0.23279,0.41093,0.58198,0.77935,0.88057,0.94231,0.98583,1) weeks <- 1:160/4 plot(weeks, pgamma(weeks,shape=6,scale=1.15),type="l") points(week,fraction,col="red")
Stephen Tucker
2007-Feb-27 14:59 UTC
[R] fitting the gamma cumulative distribution function
Hi Tim, I believe fitdistr() in the MASS package is the function you are looking for. (example given in help page)... Best regards, ST --- Tim Bergsma <timb at metrumrg.com> wrote:> Hi. > > I have a vector of quantiles and a vector of probabilites that, when > plotted, look very like the gamma cumulative distribution function. I > can guess some shape and scale parameters that give a similar result, > but I'd rather let the parameters be estimated. Is there a direct way > to do this in R? > > Thanks, > > Tim. > > week <- c(0,5,6,7,9,11,14,19,39) > fraction <- c(0,0.23279,0.41093,0.58198,0.77935,0.88057,0.94231,0.98583,1) > weeks <- 1:160/4 > plot(weeks, pgamma(weeks,shape=6,scale=1.15),type="l") > points(week,fraction,col="red") > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >____________________________________________________________________________________ TV dinner still cooling? Check out "Tonight's Picks" on Yahoo! TV.