Re: [R] Code Verification

From: Christoph Buser <buser_at_stat.math.ethz.ch>
Date: Wed 20 Jul 2005 - 21:44:57 EST

Hi

"t.test" assumes that your data within each group has a normal distribution. This is not the case in your example. I would recommend you a non parametric test like "wilcox.test" if you want to compare the mean of two samples that are not normal distributed.
see ?wilcox.test

Be careful. Your example produces two gamma distributed samples with rate = 10, not scale = 10.
rate = 1/scale.
If you want to use scale, you need to specify this argument x<-rgamma(40, 2.5, scale = 10)
see ?rgamma

I do not see the interpretation of your result. Since you do know the distribution and the parameters of your sample, you know the true means and that they are different. It is only a question of the sample size and the power of your test, if this difference is detected.
Is that something you are investigating? Maybe a power calculation or something similar.

Regards,

Christoph Buser



Christoph Buser <buser@stat.math.ethz.ch> Seminar fuer Statistik, LEO C13
ETH (Federal Inst. Technology)	8092 Zurich	 SWITZERLAND
phone: x-41-44-632-4673		fax: 632-1228

http://stat.ethz.ch/~buser/

pantd@unlv.nevada.edu writes:
> Hi R Users
> I have a code which I am running for my thesis work. Just want to make sure that
> its ok. Its a t test I am conducting between two gamma distributions with
> different shape parameters.
>
> the code looks like:
>
> sink("a1.txt");
>
> for (i in 1:1000)
> {
> x<-rgamma(40, 2.5, 10) # n = 40, shape = 2.5, Scale = 10
> y<-rgamma(40, 2.8, 10) # n = 40, shape = 2.8, Scale = 10
> z<-t.test(x, y)
> print(z)
> }
>
>
> I will appreciate it if someone could tell me if its alrite or not.
>
> thanks
>
> -dev
>
> ______________________________________________
> R-help@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



R-help@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 Received on Wed Jul 20 21:49:22 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:33:51 EST