s-news
[Top] [All Lists]

FW: help with S-Plus

To: <s-news@lists.biostat.wustl.edu>
Subject: FW: help with S-Plus
From: "Carlos Alzola" <calzola@cox.net>
Date: Wed, 23 Jun 2004 09:50:17 -0400
Cc: "'CLIFTON D. SUTTON'" <csutton@osf1.gmu.edu>
Importance: Normal
Good morning,

A professor of mine is asking the question below. Can someone clarify
why the p-value component is two-dimensional?

Thanks

Carlos 


Carlos Alzola
calzola@cox.net
(703) 242-6747



-----Original Message-----
From: CLIFTON D. SUTTON [mailto:csutton@osf1.gmu.edu] 
Sent: Tuesday, June 22, 2004 10:11 PM
To: jgentle@gmu.edu; jshine1@gmu.edu; Carlos Alzola; jzhang5@gmu.edu;
cchang6@gmu.edu
Subject: help with S-Plus


I'm supervising some independent study projects this summer, and two of
the students are using S-Plus to perform Monte Carlo studies comparing
various test procedures.  A robust procedure called Levene's test makes
use of the standard one-way ANOVA F test.  I figured out how I can do
the test and get the desired p-value, but I'm puzzled about why the
p-value object is of dimension 2 (as opposed to 1).

If y1, y2, and y3 are three samples of sizes n1, n3, and n3, then I can
do
   y <- c(y1, y2, y3)
   group <- c(rep(1, n1), rep(2, n2), rep(3, n3))
   result <- aov(y ~ factor(group))
   result2 <- summary(result)
where of course the last 2 statements could be combined into 1.

Now
  objects(result2)
lists
  Pr(F)
as an object, but
  result2$Pr(F)
creates an error of sorts.  However,
  result2$Pr
gives me the correct p-value (that I checked using more straightforward
software).  So I find it odd that the object is listed as "Pr(F)" but
one needs to use just "Pr" to make it work.  But what is really odd is
that
  result2$Pr
is two-dimensional, and for me to compare the p-value to 0.05 and 0.01 I
need to use
  result2$Pr[1]
My guess is that because some objects, such as "Df", of result2 are
two-dimensional, that all of them are, even though
  result2$Pr[2]
takes the value NA.  Is this right?  Since
  result2$Pr[1]
is the value I need to use, I guess I've got a working solution, but I
wonder if there is an easier way to just get that one-way ANOVA p-value
that I want.  It seems
  pv <- summary(aov(y ~ factor(gr)))$Pr[1]
will do it in one line (after I have y and gr set up), and that's fine,
but it just strikes me as odd that the object was listed as "Pr(F)" but
it needs to be just "Pr" to make it work, and that "Pr" is
two-dimensional instead of one-dimensional.

If you have any comments, please reply back to all, since then my two
students can benefit from your words of wisdom.

Thanks,
CDS

** Carol: You don't run into these things in your two-sample study, but
I figured that one thing you want to get out of this summer is to learn
about S-Plus, and so you may at some point benefit from taking a look at
how one needs to do Levene's test when there are 3 or more samples.





<Prev in Thread] Current Thread [Next in Thread>