Re: [R] gamma distribution don't allow negative value in GLMs?

2006-10-15 Thread chao gai
I think the 0 values for snail are hurting you.

Kees

On Sunday 15 October 2006 13:10, zhijie zhang wrote:
 Dear friends,
  when i use glm() to fit my data,  i use
 glm(formula = snail ~ vegtype + mhveg + humidity + elevation + soiltem,
 *family = Gamma(link = inverse),* data =a,))
 It shows:  error in eval(expr, envir, enclos) : *gamma distribution don't
 allow negative value*.

 But i use
 result-glm(formula = snail ~ vegtype + mhveg + humidity + elevation +
 soiltem, family = poisson, data =a) #this works
  In fact , there isn't any negative value in my dataset, who can tell me
 the reason?
 Thanks very much!
  I copy my data here so you can check it:
   vegtype mhveg humidity soiltem elevation snail
 1 diluo  35.0 0.27985121.1   low   162
 2 diluo  25.0 0.31609223.1   low   113
 3 yuhao  35.0 0.29723821.7   low   105
 4   huanghuacai   1.5 0.31068723.1   low 5
 5   huanghuacai   2.0 0.26786828.3   low 1
 6 yuhao  25.0 0.29013521.9   low10
 7   huanghuacai   1.0 0.28520727.7   low 6
 8   huanghuacai   2.0 0.25297328.3   low 1
 9   huanghuacai   1.5 0.2728.1   low 1
 10  huanghuacai   2.5 0.3029.1   low 1
 11  huanghuacai   2.0 0.29615429.1   low 0
 12  huanghuacai   2.0 0.30287427.5   low 3
 13  huanghuacai   1.5 0.30149928.9   low 0
 14  huanghuacai   3.0 0.29151330.3   low 1
 15  huanghuacai   1.0 0.27343831.1   low 3
 16  huanghuacai   1.5 0.29011627.9   low19
 17  huanghuacai   2.5 0.19893231.9   low 0
 18  huanghuacai   2.0 0.3930.5  high 4
 19  huanghuacai   2.5 0.28259530.7  high 0
 20  huanghuacai   1.0 0.26609724.7  high14
 21yuhao  30.0 0.24051626.9  high51
 22yuhao  35.0 0.22754126.7  high84
 23yuhao  20.0 0.25283328.3   low30
 24diluo  40.0 0.30303027.9   low91
 25hucao  80.0 0.30386724.5   low   114
 26diluo  25.0 0.33494826.7   low   115
 27hucao  60.0 0.30689726.5   low23
 28hucao  75.0 0.31446525.7   low43
 29yuhao  30.0 0.25178326.1   low77
 30diluo  10.0 0.2826.1   low62
 31yuhao  25.0 0.29171626.1   low78
 32hucao  90.0 0.28880024.5   low35
 33diluo  25.0 0.33783026.3  high75
 34yuhao  13.0 0.29659927.7  high23
 35hucao  70.0 0.27949826.3  high   116
 36diluo   3.0 0.28148128.1  high25
 37hucao  70.0 0.29600023.7  high83
 38diluo  10.0 0.27266227.7   low56
 39hucao  70.0 0.28979625.3  high   112
 40diluo   5.0 0.33971627.9  high84
 41yuhao  35.0 0.23142724.9  high88
 42hucao  80.0 0.27381024.1  high   134
 43yuhao  40.0 0.27278925.1  high53
 44yuhao  45.0 0.22603625.1  high88
 45yuhao  55.0 0.28549523.9  high76
 46hucao  80.0 0.25218523.9  high   106
 47diluo  15.0 0.28993324.5  high   194
 48hucao  95.0 0.26175623.1  high35
 49hucao  55.0 0.23981924.7  high21
 50hucao  75.0 0.25430723.9  high41
 51  huanghuacai   1.0 0.28643223.7   low18
 52  huanghuacai   2.0 0.30134223.1   low 2
 53  huanghuacai   2.0 0.36956523.3   low 5
 54  huanghuacai   1.5 0.24583324.3   low 4
 55  huanghuacai   1.0 0.31567924.1   low 4
 56  huanghuacai   2.5 0.29612423.7   low 4
 57  huanghuacai   2.0 0.31266725.7   low 3
 58  huanghuacai   3.0 0.30087025.7   low 0
 59  huanghuacai   2.0 0.30374326.5   low 2
 60  huanghuacai   1.0 0.26979925.3   low 7
 61hucao  75.0 0.28125022.5   low14
 62yuhao  35.0 0.35035023.3   low63
 63hucao  65.0 0.30454522.7   low17
 64diluo   7.0 0.31005624.9   low45
 65hucao  80.0 0.28800022.9   low27
 66hucao  80.0 0.28421122.7   low46
 67diluo  25.0 0.28137923.5   low   161
 68hucao  80.0 0.29053323.3   low   117
 69yuhao  27.0 0.31656824.1   low   106
 70yuhao  28.0 0.28515625.1   low82
 71yuhao  30.0 0.2724.5   low55
 72hucao  85.0 0.29034523.9   low54
 73yuhao  35.0 0.31578924.1   low81
 74diluo  15.0 0.28659828.3   low   102
 75yuhao  45.0 0.31421124.1   low85
 76yuhao  25.0 0.26879425.1   low63
 77hucao  80.0 

Re: [R] gamma distribution

2005-07-28 Thread Uwe Ligges
Answering both messges here:


1. [EMAIL PROTECTED] wrote:
  Hi I appreciate your response. This is what I observed..taking
  the log transform of the raw gamma does change the p value of
  the test. That is what I am importing into excel (the p - values)

Well, so you made a mistake! And I still do not know why anybody realy 
want to import data to Excel, if the data is already in R.

For me, the results are identical (and there is no reason why not).


  and then calculating the power of the test (both raw and
  transformed).
 
  can you tell me what exactly your code is doing?

See below.


2. [EMAIL PROTECTED] wrote:
 Hi
 I ran your code. I think it should give me the number of p values below 0.05
 significance level  (thats what i could understand from your code), but after
 running your code there is neither any error that shows up nor any value that
 the console displays.

You are right in the point what the code I sent does:

   erg - replicate(1000, {
x-rgamma(10, 2.5, scale = 10)
y-rgamma(10, 2.5, scale = 10)
wilcox.test(x, y, var.equal = FALSE)$p.value
})
sum(erg  0.05) # 45


and it works for me. It results in a random number close to 50, hopefully.

Since both points above seem to be very strange on your machine: Which 
version of R are you using? We assume the most recent one which is R-2.1.1.

Uwe Ligges

__
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


Re: [R] gamma distribution

2005-07-28 Thread pantd
thanks for your response. btw i am calculating the power of the wilcoxon test. i
divide the total no. of rejections by the no. of simulations. so for 1000
simulations, at 0.05 level of significance if the no. of rejections are 50 then
the power will be 50/1000 = 0.05. thats y im importing in excel the p values.

is my approach correct??

thanks n regards
-dev


Quoting Uwe Ligges [EMAIL PROTECTED]:

 Answering both messges here:


 1. [EMAIL PROTECTED] wrote:
   Hi I appreciate your response. This is what I observed..taking
   the log transform of the raw gamma does change the p value of
   the test. That is what I am importing into excel (the p - values)

 Well, so you made a mistake! And I still do not know why anybody realy
 want to import data to Excel, if the data is already in R.

 For me, the results are identical (and there is no reason why not).


   and then calculating the power of the test (both raw and
   transformed).
  
   can you tell me what exactly your code is doing?

 See below.


 2. [EMAIL PROTECTED] wrote:
  Hi
  I ran your code. I think it should give me the number of p values below
 0.05
  significance level  (thats what i could understand from your code), but
 after
  running your code there is neither any error that shows up nor any value
 that
  the console displays.

 You are right in the point what the code I sent does:

erg - replicate(1000, {
 x-rgamma(10, 2.5, scale = 10)
 y-rgamma(10, 2.5, scale = 10)
 wilcox.test(x, y, var.equal = FALSE)$p.value
 })
 sum(erg  0.05) # 45


 and it works for me. It results in a random number close to 50, hopefully.

 Since both points above seem to be very strange on your machine: Which
 version of R are you using? We assume the most recent one which is R-2.1.1.

 Uwe Ligges



__
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


Re: [R] gamma distribution

2005-07-28 Thread Uwe Ligges
[EMAIL PROTECTED] wrote:

 thanks for your response. btw i am calculating the power of the wilcoxon 
 test. i
 divide the total no. of rejections by the no. of simulations. so for 1000
 simulations, at 0.05 level of significance if the no. of rejections are 50 
 then
 the power will be 50/1000 = 0.05. thats y im importing in excel the p values.

No, since H1 is NOT true in your case (the power is undefined under H0).
In this case it is an estimator for the alpha error, but not the power. 
You might want to reread some basic textbook on testing theory.

BTW: Why do you think R cannot calculate 50/1000 and Excel does better?

 is my approach correct??

No.

Uwe Ligges



 thanks n regards
 -dev
 
 
 Quoting Uwe Ligges [EMAIL PROTECTED]:
 
 
Answering both messges here:


1. [EMAIL PROTECTED] wrote:
  Hi I appreciate your response. This is what I observed..taking
  the log transform of the raw gamma does change the p value of
  the test. That is what I am importing into excel (the p - values)

Well, so you made a mistake! And I still do not know why anybody realy
want to import data to Excel, if the data is already in R.

For me, the results are identical (and there is no reason why not).


  and then calculating the power of the test (both raw and
  transformed).
 
  can you tell me what exactly your code is doing?

See below.


2. [EMAIL PROTECTED] wrote:

Hi
I ran your code. I think it should give me the number of p values below

0.05

significance level  (thats what i could understand from your code), but

after

running your code there is neither any error that shows up nor any value

that

the console displays.

You are right in the point what the code I sent does:

   erg - replicate(1000, {
x-rgamma(10, 2.5, scale = 10)
y-rgamma(10, 2.5, scale = 10)
wilcox.test(x, y, var.equal = FALSE)$p.value
})
sum(erg  0.05) # 45


and it works for me. It results in a random number close to 50, hopefully.

Since both points above seem to be very strange on your machine: Which
version of R are you using? We assume the most recent one which is R-2.1.1.

Uwe Ligges


 
 
 __
 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


Re: [R] gamma distribution

2005-07-28 Thread Christoph Buser
Hi 

Again to come back on the question why you don't get identical
p.values for the untransformed and the transformed data.

I ran your script below and I get always 2 identical test per
loop. In your text you are talking about the first 1000 values
for the untransformed and the next 1000 values for the
transformed. 

But did you consider that in each loop there is a test for the
untransformed and the transformed, so the tests are printed
alternating. 
This might be a reason why you did not get equal results.

Hope this helps,

Christoph

--
Christoph Buser [EMAIL PROTECTED]
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/
--


[EMAIL PROTECTED] writes:
  Hi R Users
  
  
  This is a code I wrote and just want to confirm if the first 1000 values are 
  raw
  gamma (z) and the next 1000 values are transformed gamma (k) or not. As I get
  2000 rows once I import into excel, the p - values beyond 1000 dont look that
  good, they are very high.
  
  
  --
  sink(a1.txt);
  
  for (i in 1:1000)
  {
  x-rgamma(10, 2.5, scale = 10)
  y-rgamma(10, 2.5, scale = 10)
  z-wilcox.test(x, y, var.equal = FALSE)
  print(z)
  x1-log(x)
  y1-log(y)
  k-wilcox.test(x1, y1, var.equal = FALSE)
  print(k)
  }
  
  ---
  any suggestions are welcome
  
  thanks
  
  -devarshi
  
  __
  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


Re: [R] gamma distribution

2005-07-28 Thread Christoph Buser
Hi 

As Uwe mentioned be careful about the difference the
significance level alpha and the power of a test.

To do power calculations you should specify and alternative
hypothesis H_A, e.g. if you have two populations you want to
compare and we assume that they are normal distributed (equal
unknown variance for simplicity). We are interested if there is
a difference in the mean and want to use the t.test.
Our Null hypothesis H_0: there is no difference in the means

To do a power calculation for our test, we first have to specify
and alternative H_A: the mean difference is 1 (unit)
Now for a fix number of observations we can calculate the power
of our test, which is in that case the probability that (if the
true unknown difference is 1, meaning that H_A is true) our test
is significant, meaning if I repeat the test many times (always
taking samples with mean difference of 1), the number of
significant test divided by the total number of tests is an
estimate for the power.


In you case the situation is a little bit more complicated. You
need to specify an alternative hypothesis.
In one of your first examples you draw samples from two gamma
distributions with different shape parameter and the same
scale. But by varying the shape parameter the two distributions
not only differ in their mean but also in their form.
 
I got an email from Prof. Ripley in which he explained in
details and very precise some examples of tests and what they
are testing. It was in addition to the first posts about t tests
and wilcoxon test. 
I attached the email below and recommend to read it carefully. It
might be helpful for you, too.

Regards,

Christoph Buser

--
Christoph Buser [EMAIL PROTECTED]
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/
--
 


From: Prof Brian Ripley [EMAIL PROTECTED]
To: Christoph Buser [EMAIL PROTECTED]
cc: Liaw, Andy [EMAIL PROTECTED]
Subject: Re: [R] Alternatives to t-tests (was Code Verification)
Date: Thu, 21 Jul 2005 10:33:28 +0100 (BST)

I believe there is a rather more to this than Christoph's account.  The 
Wilcoxon test is not testing the same null hypothesis as the t-test, and 
that may very well matter in practice and it does in the example given.

The (default in R) Welch t-test tests a difference in means between two 
samples, not necessarily of the same variance or shape.  A difference in 
means is simple to understand, and is unambiguously defined at least if 
the distributions have means, even for real-life long-tailed 
distributions.  Inference from the t-test is quite accurate even a long 
way from normality and from equality of the shapes of the two 
distributions, except in very small sample sizes.  (I point my beginning 
students at the simulation study in `The Statistical Sleuth' by Ramsey and 
Schafer, stressing that the unequal-variance t-test ought to be the 
default choice as it is in R.  So I get them to redo the simulations.)

The Wilcoxon test tests a shift in location between two samples from 
distributions of the same shape differing only by location.  Having the 
same shape is part of the null hypothesis, and so is an assumption that 
needs to be verified if you want to conclude there is a difference in 
location (e.g. in means).  Even if you assume symmetric distributions (so 
the location is unambiguously defined) the level of the test depends on 
the shapes, tending to reject equality of location in the presence of 
difference of shape.  So you really are testing equality of distribution, 
both location and shape, with power concentrated on location-shift 
alternatives.

Given samples from a gamma(shape=2) and gamma(shape=20) distributions, we 
know what the t-test is testing (equality of means).  What is the Wilcoxon 
test testing?  Something hard to describe and less interesting, I believe.

BTW, I don't see the value of the gamma simulation as this 
simultaneously changes mean and shape between the samples.  How about
checking holding the mean the same:

n - 1000
z1 - z2 - numeric(n)
for (i in 1:n) {
   x - rgamma(40, 2.5, 0.1)
   y - rgamma(40, 10, 0.1*10/2.5)
   z1[i] - t.test(x, y)$p.value
   z2[i] - wilcox.test(x, y)$p.value
}
## Level
1 - sum(z10.05)/1000  ## 0.049
1 - sum(z20.05)/1000  ## 0.15

? -- the Wilcoxon test is shown to be a poor test of equality of means. 
Christoph's simulation shows that it is able to use difference in shape as 
well as location in the test of these two distributions, whereas the 
t-test is designed only to use the difference in means.  Why compare the 
power of two tests testing different null hypotheses?

I would say a very good reason to use a t-test is if you are actually 
interested in the hypothesis it tests 






Re: [R] gamma distribution

2005-07-28 Thread pantd
Hi Christopher and Uwe. thanks for your time and guidance.
I deeply appreciate it.


-dev


Quoting Christoph Buser [EMAIL PROTECTED]:

 Hi

 As Uwe mentioned be careful about the difference the
 significance level alpha and the power of a test.

 To do power calculations you should specify and alternative
 hypothesis H_A, e.g. if you have two populations you want to
 compare and we assume that they are normal distributed (equal
 unknown variance for simplicity). We are interested if there is
 a difference in the mean and want to use the t.test.
 Our Null hypothesis H_0: there is no difference in the means

 To do a power calculation for our test, we first have to specify
 and alternative H_A: the mean difference is 1 (unit)
 Now for a fix number of observations we can calculate the power
 of our test, which is in that case the probability that (if the
 true unknown difference is 1, meaning that H_A is true) our test
 is significant, meaning if I repeat the test many times (always
 taking samples with mean difference of 1), the number of
 significant test divided by the total number of tests is an
 estimate for the power.


 In you case the situation is a little bit more complicated. You
 need to specify an alternative hypothesis.
 In one of your first examples you draw samples from two gamma
 distributions with different shape parameter and the same
 scale. But by varying the shape parameter the two distributions
 not only differ in their mean but also in their form.

 I got an email from Prof. Ripley in which he explained in
 details and very precise some examples of tests and what they
 are testing. It was in addition to the first posts about t tests
 and wilcoxon test.
 I attached the email below and recommend to read it carefully. It
 might be helpful for you, too.

 Regards,

 Christoph Buser

 --
 Christoph Buser [EMAIL PROTECTED]
 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/
 --

 

 From: Prof Brian Ripley [EMAIL PROTECTED]
 To: Christoph Buser [EMAIL PROTECTED]
 cc: Liaw, Andy [EMAIL PROTECTED]
 Subject: Re: [R] Alternatives to t-tests (was Code Verification)
 Date: Thu, 21 Jul 2005 10:33:28 +0100 (BST)

 I believe there is a rather more to this than Christoph's account.  The
 Wilcoxon test is not testing the same null hypothesis as the t-test, and
 that may very well matter in practice and it does in the example given.

 The (default in R) Welch t-test tests a difference in means between two
 samples, not necessarily of the same variance or shape.  A difference in
 means is simple to understand, and is unambiguously defined at least if
 the distributions have means, even for real-life long-tailed
 distributions.  Inference from the t-test is quite accurate even a long
 way from normality and from equality of the shapes of the two
 distributions, except in very small sample sizes.  (I point my beginning
 students at the simulation study in `The Statistical Sleuth' by Ramsey and
 Schafer, stressing that the unequal-variance t-test ought to be the
 default choice as it is in R.  So I get them to redo the simulations.)

 The Wilcoxon test tests a shift in location between two samples from
 distributions of the same shape differing only by location.  Having the
 same shape is part of the null hypothesis, and so is an assumption that
 needs to be verified if you want to conclude there is a difference in
 location (e.g. in means).  Even if you assume symmetric distributions (so
 the location is unambiguously defined) the level of the test depends on
 the shapes, tending to reject equality of location in the presence of
 difference of shape.  So you really are testing equality of distribution,
 both location and shape, with power concentrated on location-shift
 alternatives.

 Given samples from a gamma(shape=2) and gamma(shape=20) distributions, we
 know what the t-test is testing (equality of means).  What is the Wilcoxon
 test testing?  Something hard to describe and less interesting, I believe.

 BTW, I don't see the value of the gamma simulation as this
 simultaneously changes mean and shape between the samples.  How about
 checking holding the mean the same:

 n - 1000
 z1 - z2 - numeric(n)
 for (i in 1:n) {
x - rgamma(40, 2.5, 0.1)
y - rgamma(40, 10, 0.1*10/2.5)
z1[i] - t.test(x, y)$p.value
z2[i] - wilcox.test(x, y)$p.value
 }
 ## Level
 1 - sum(z10.05)/1000  ## 0.049
 1 - sum(z20.05)/1000  ## 0.15

 ? -- the Wilcoxon test is shown to be a poor test of equality of means.
 Christoph's simulation shows that it is able to use difference in shape as
 well as location in the test of these two distributions, whereas the
 t-test is designed only to use the 

Re: [R] gamma distribution

2005-07-27 Thread Christoph Buser
Hi

I am a little bit confused. You create two sample (from a gamma
distribution) and you do a wilcoxon test with this two samples.
Then you use the same monotone transformation (log) for both
samples and redo the wilcoxon test.
But since the transformations keeps the order of your samples
the second wilcoxon test is identical to the first one:

x-rgamma(10, 2.5, scale = 10)
y-rgamma(10, 2.5, scale = 10)
wilcox.test(x, y, var.equal = FALSE)
x1-log(x)
y1-log(y)
wilcox.test(x1, y1, var.equal = FALSE)

Maybe you can give some more details about the hypothesis you'd
like to test.

Regards,

Christoph Buser

--
Christoph Buser [EMAIL PROTECTED]
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/
--



[EMAIL PROTECTED] writes:
  Hi R Users
  
  
  This is a code I wrote and just want to confirm if the first 1000 values are 
  raw
  gamma (z) and the next 1000 values are transformed gamma (k) or not. As I get
  2000 rows once I import into excel, the p - values beyond 1000 dont look that
  good, they are very high.
  
  
  --
  sink(a1.txt);
  
  for (i in 1:1000)
  {
  x-rgamma(10, 2.5, scale = 10)
  y-rgamma(10, 2.5, scale = 10)
  z-wilcox.test(x, y, var.equal = FALSE)
  print(z)
  x1-log(x)
  y1-log(y)
  k-wilcox.test(x1, y1, var.equal = FALSE)
  print(k)
  }
  
  ---
  any suggestions are welcome
  
  thanks
  
  -devarshi
  
  __
  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


Re: [R] gamma distribution

2005-07-27 Thread Uwe Ligges
[EMAIL PROTECTED] wrote:

 Hi R Users
 
 
 This is a code I wrote and just want to confirm if the first 1000 values are 
 raw
 gamma (z) and the next 1000 values are transformed gamma (k) or not. As I get
 2000 rows once I import into excel, the p - values beyond 1000 dont look that
 good, they are very high.

He?
- log() transforming the data does not change the Wilcoxon statistics 
(based on ranks!)!
- Why is this related to Excel?
- What are you going to show?

I get

  erg - replicate(1000, {
  x-rgamma(10, 2.5, scale = 10)
  y-rgamma(10, 2.5, scale = 10)
  wilcox.test(x, y, var.equal = FALSE)$p.value
  })
  sum(erg  0.05) # 45

which seems plausible to me.


Uwe Ligges



 
 --
 sink(a1.txt);
 
 for (i in 1:1000)
 {
 x-rgamma(10, 2.5, scale = 10)
 y-rgamma(10, 2.5, scale = 10)
 z-wilcox.test(x, y, var.equal = FALSE)
 print(z)
 x1-log(x)
 y1-log(y)
 k-wilcox.test(x1, y1, var.equal = FALSE)
 print(k)
 }
 
 ---
 any suggestions are welcome
 
 thanks
 
 -devarshi
 
 __
 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


Re: [R] gamma distribution

2005-07-27 Thread pantd
Hi
You are right but here I am taking into account the p values I get from the
tests on the raw and the transformed samples. And then I calculate the power of
the tests based on the # of rejections of the p values.
DO you think its a good way to determine the power of a test?

thanks

-dev


Quoting Christoph Buser [EMAIL PROTECTED]:

 Hi

 I am a little bit confused. You create two sample (from a gamma
 distribution) and you do a wilcoxon test with this two samples.
 Then you use the same monotone transformation (log) for both
 samples and redo the wilcoxon test.
 But since the transformations keeps the order of your samples
 the second wilcoxon test is identical to the first one:

 x-rgamma(10, 2.5, scale = 10)
 y-rgamma(10, 2.5, scale = 10)
 wilcox.test(x, y, var.equal = FALSE)
 x1-log(x)
 y1-log(y)
 wilcox.test(x1, y1, var.equal = FALSE)

 Maybe you can give some more details about the hypothesis you'd
 like to test.

 Regards,

 Christoph Buser

 --
 Christoph Buser [EMAIL PROTECTED]
 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/
 --



 [EMAIL PROTECTED] writes:
   Hi R Users
  
  
   This is a code I wrote and just want to confirm if the first 1000 values
 are raw
   gamma (z) and the next 1000 values are transformed gamma (k) or not. As I
 get
   2000 rows once I import into excel, the p - values beyond 1000 dont look
 that
   good, they are very high.
  
  
   --
   sink(a1.txt);
  
   for (i in 1:1000)
   {
   x-rgamma(10, 2.5, scale = 10)
   y-rgamma(10, 2.5, scale = 10)
   z-wilcox.test(x, y, var.equal = FALSE)
   print(z)
   x1-log(x)
   y1-log(y)
   k-wilcox.test(x1, y1, var.equal = FALSE)
   print(k)
   }
  
   ---
   any suggestions are welcome
  
   thanks
  
   -devarshi
  
   __
   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


Re: [R] gamma distribution

2005-07-27 Thread pantd
Hi
I ran your code. I think it should give me the number of p values below 0.05
significance level  (thats what i could understand from your code), but after
running your code there is neither any error that shows up nor any value that
the console displays.


thanks in advance

-dev.

Quoting Uwe Ligges [EMAIL PROTECTED]:
 [EMAIL PROTECTED] wrote:

  Hi R Users
 
 
  This is a code I wrote and just want to confirm if the first 1000 values
 are raw
  gamma (z) and the next 1000 values are transformed gamma (k) or not. As I
 get
  2000 rows once I import into excel, the p - values beyond 1000 dont look
 that
  good, they are very high.

 He?
 - log() transforming the data does not change the Wilcoxon statistics
 (based on ranks!)!
 - Why is this related to Excel?
 - What are you going to show?

 I get

   erg - replicate(1000, {
   x-rgamma(10, 2.5, scale = 10)
   y-rgamma(10, 2.5, scale = 10)
   wilcox.test(x, y, var.equal = FALSE)$p.value
   })
   sum(erg  0.05) # 45

 which seems plausible to me.


 Uwe Ligges



 
  --
  sink(a1.txt);
 
  for (i in 1:1000)
  {
  x-rgamma(10, 2.5, scale = 10)
  y-rgamma(10, 2.5, scale = 10)
  z-wilcox.test(x, y, var.equal = FALSE)
  print(z)
  x1-log(x)
  y1-log(y)
  k-wilcox.test(x1, y1, var.equal = FALSE)
  print(k)
  }
 
  ---
  any suggestions are welcome
 
  thanks
 
  -devarshi
 
  __
  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