[R] Applying qqmath using gamma distribution...

David Winsemius
Fri, 04 Sep 2009 17:04:52 -0000

You should pay close attention to the definitions of the parameters
passed to the various gamma functions.

x <- rgamma(1000, 2, 2)
library(mhsmm)
  qsh <- gammafit(x)$shape; qsc <- gammafit(x)$scale

 > qsh
          x
x 2.009260
 > qsc
           x
x 0.4827448


On Sep 4, 2009, at 11:59 AM, Petar Milin wrote:

> Thank you very much for the answer!
> However, instead of x being some uniform values, I have real values.
> Hence, if I have dat$V1 of my interest, formula should be like this:
>
> qqmath(~ V1, data=dat, distribution=function(V1) qgamma(V1,
> shape=gammafit(dat$V1)$shape, scale=gammafit(dat$V1)$scale))
>
> Is that correct?
> (gammafit() from mhsmm package calculates parameters of gamma
> function)
>
> Thank you, again. Best,
> PM
>
> Duncan Murdoch wrote:
>> On 9/4/2009 8:36 AM, Petar Milin wrote:
>>> Hello ALL!
>>> Can anyone tell me how to specify qqmath() function with
>>> distribution qgamma?
>>> In help it is bit vague how to pass shape and scale parameters for
>>> gamma.
>> Take a look at the first example, which passes in the df parameter
>> for a t distribution.  You want something like
>> x <- runif(1000)  # not a gamma, plot should look bad
>> qqmath(~ x, distribution=function(x) qgamma(x, shape=2, scale=2))
>> Duncan Murdoch
>>
>
> ______________________________________________
> R-help at r-project.org 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.

David Winsemius, MD
Heritage Laboratories
West Hartford, CT