[R] Code Verification

Christoph Buser buser at stat.math.ethz.ch
Wed Jul 20 13:44:57 CEST 2005


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 at 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 at 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 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




More information about the R-help mailing list