[R] QQ plotting of various distributions...

Petar Milin pmilin at ff.uns.ac.rs
Sun Sep 27 12:11:24 CEST 2009

Thanks for the answer. Now, only problem is to to get parameter(s) of a 
given function. For gamma, I shall try with gammafit() from mhsmm 
package. Also, I shall look for others appropriate parameter estimates. 
Will use SuppDists too.


Sunil Suchindran wrote:
> #same shape
> some_data <- rgamma(500,shape=6,scale=2)
> test_data <- rgamma(500,shape=6,scale=2)
> plot(sort(some_data),sort(test_data))
> # You can also use qqplot(some_data,test_data)
> abline(0,1)
> # different shape
> some_data <- rgamma(500,shape=6,scale=2)
> test_data <- rgamma(500,shape=4,scale=2)
> plot(sort(some_data),sort(test_data))
> abline(0,1)
> It is helpful to assess the sampling variability, by
> creating repeated sets of test_data, and plotting
> all of these along with your observations to create
> a confidence "envelope".
> The SuppDists provides Inverse Gauss.
> On Thu, Sep 17, 2009 at 11:46 AM, Petar Milin <pmilin at ff.uns.ac.rs> wrote:
>     Hello!
>     I am trying with this question again:
>     I would like to test few distributional assumptions for some
>     behavioral response data. There are few theories about true
>     distribution of those data, like: normal, lognormal, gamma,
>     ex-Gaussian (exponential-Gaussian), Wald (inverse Gaussian) etc. The
>     best way would be via qq-plot, to show to students differences.
>     First two are trivial:
>     qqnorm(dat$X)
>     qqnorm(log(dat$X))
>     Then, things are getting more "hairy". I am not sure how to make
>     plots for the rest. I tried gamma with:
>     qqmath(~ X, data=dat, distribution=function(X)
>     � qgamma(X, shape, scale))
>     Which should be the same as:
>     plot(qgamma(ppoints(dat$X), shape, scale), sort(dat$X))
>     Shape and scale parameters I got via mhsmm package that has
>     gammafit() for shape and scale parameters estimation.
>     Am I on right track? Does anyone know how to plot the rest:
>     ex-Gaussian (exponential-Gaussian), Wald (inverse Gaussian)?
>     Thanks,
>     PM
>     ______________________________________________
>     R-help at r-project.org <mailto: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
>     <http://www.r-project.org/posting-guide.html>
>     and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list