[R] Indexing ANOVA table

2003-11-29 Thread Pascal . Niklaus
Hi all,

I'd like to extract a value from an ANOVA table, but experience the following
problem:

### This works:

 s.pseudo - summary(aov(m ~ block + mix*graz,data=split1))
 s.pseudo
Df  Sum Sq Mean Sq F value  Pr(F)
block2 1114.66  557.33  4.4296 0.04192 *
mix  16.146.14  0.0488 0.82956
graz 21.450.72  0.0057 0.99427
mix:graz 23.821.91  0.0152 0.98495
Residuals   10 1258.19  125.82
---
Signif. codes:  0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1
 s.pseudo[[1]][mix ,Pr(F)]
[1] 0.8295556

### But this doesn't -- why?

 s.split -  summary(aov(m ~ block + mix*graz + Error(Plot),data=split1))
 s.split

Error: Plot
  Df  Sum Sq Mean Sq F value Pr(F)
block  2 1114.66  557.33  0.8994 0.5265
mix16.146.14  0.0099 0.9298
Residuals  2 1239.37  619.68

Error: Within
  Df  Sum Sq Mean Sq F value Pr(F)
graz   2  1.4464  0.7232  0.3073 0.7437
mix:graz   2  3.8206  1.9103  0.8117 0.4776
Residuals  8 18.8278  2.3535
 s.split[[Error: Plot]]  ## extracting first list element works
  Df  Sum Sq Mean Sq F value Pr(F)
block  2 1114.66  557.33  0.8994 0.5265
mix16.146.14  0.0099 0.9298
Residuals  2 1239.37  619.68
 s.split[[Error: Plot]][mix ,Pr(F)]  ### == FAILS
Error in s.split[[Error: Plot]][mix , Pr(F)] :
incorrect number of dimensions

So where is the difference between the two?

Thanks for any hint

Pascal




-
This mail sent through IMP: http://horde.org/imp/

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] significance in difference of proportions: What problema

2003-11-29 Thread Ted Harding
On 28-Nov-03 Torsten Hothorn wrote:
 yes, thats my understanding too. The enumerative techniques as
 you call it condition on the data actually observed and determine
 the null distribution of the associated test statistic from the data.
 In contrast, unconditional procedures require some assumptions to the
 underlying data generating process from which the null distribution is
 derived. The appropriate choice depends of the kind of experiment
 under test: In a randomized trial we would like to see all possible
 outcomes of the trial caused by rerandomization and the enumerative
 techniques are natural here. When we draw many samples from predefined
 populations, men and women, say, rerandomization of gender is of
 course not that easy and we may assume something about the data
 generating process :-)

Nice example, but it depends on how you look at it!

Suppose you have samples of n1 Men and n2 Women and record, for instance,
whether or not each is suffering from a cold (r1 and r2 respectively).
Do M  W differ in their risk of catching cold?

NH: No difference; implies that the R = (r1+r2) colds have selected
a random subset of the N=(n1+n2) individuals as victims; implies
that the n1 Men out of N are a random subset of the R+(N-R)
Colds/NonColds. So you then have a hypergeometric distribution and are
back with an exact test. But are we assuming somthing about the
data generating process here?

(Of course, in the background lurks the Ogre of Exchangeability,
in that the probability of catching cold may vary from person to
person, whether Man or Woman, but nothing in the information
plus NH suggests any reason to distinguish any arrangement of the
N people from any other; equivalent to a re-randomisation of
gender ... ??).

Best wishes,
Ted.



E-Mail: (Ted Harding) [EMAIL PROTECTED]
Fax-to-email: +44 (0)870 167 1972
Date: 29-Nov-03   Time: 10:09:18
-- XFMail --

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Indexing ANOVA table

2003-11-29 Thread Peter Dalgaard
[EMAIL PROTECTED] writes:

 Hi all,
 
 I'd like to extract a value from an ANOVA table, but experience the following
 problem:
 
 ### This works:
 
  s.pseudo - summary(aov(m ~ block + mix*graz,data=split1))
  s.pseudo
 Df  Sum Sq Mean Sq F value  Pr(F)
 block2 1114.66  557.33  4.4296 0.04192 *
 mix  16.146.14  0.0488 0.82956
 graz 21.450.72  0.0057 0.99427
 mix:graz 23.821.91  0.0152 0.98495
 Residuals   10 1258.19  125.82
 ---
 Signif. codes:  0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1
  s.pseudo[[1]][mix ,Pr(F)]
 [1] 0.8295556
 
 ### But this doesn't -- why?
 
  s.split -  summary(aov(m ~ block + mix*graz + Error(Plot),data=split1))
  s.split
 
 Error: Plot
   Df  Sum Sq Mean Sq F value Pr(F)
 block  2 1114.66  557.33  0.8994 0.5265
 mix16.146.14  0.0099 0.9298
 Residuals  2 1239.37  619.68
 
 Error: Within
   Df  Sum Sq Mean Sq F value Pr(F)
 graz   2  1.4464  0.7232  0.3073 0.7437
 mix:graz   2  3.8206  1.9103  0.8117 0.4776
 Residuals  8 18.8278  2.3535
  s.split[[Error: Plot]]  ## extracting first list element works
   Df  Sum Sq Mean Sq F value Pr(F)
 block  2 1114.66  557.33  0.8994 0.5265
 mix16.146.14  0.0099 0.9298
 Residuals  2 1239.37  619.68
  s.split[[Error: Plot]][mix ,Pr(F)]  ### == FAILS
 Error in s.split[[Error: Plot]][mix , Pr(F)] :
 incorrect number of dimensions
 
 So where is the difference between the two?
 
 Thanks for any hint

There's an extra list level:

 example(aov)
...
 str(summary(npk.aovE)[[Error: Within]])
List of 1
 $ :Classes anova  and `data.frame':7 obs. of  5 variables:
  ..$ Df : num [1:7] 1 1 1 1 1 1 12
  ..$ Sum Sq : num [1:7] 189.3   8.4  95.2  21.3  33.1 ...
  ..$ Mean Sq: num [1:7] 189.3   8.4  95.2  21.3  33.1 ...
  ..$ F value: num [1:7] 12.259  0.544  6.166  1.378  2.146 ...
  ..$ Pr(F) : num [1:7] 0.00437 0.47490 0.02880 0.26317 0.16865 ...
 - attr(*, class)= chr [1:2] summary.aov listof
 summary(npk.aovE)[[Error: Within]][[1]][N:P,Pr(F)]
[1] 0.2631653

As to *why* there's this extra level, you have to ask the author...

-- 
   O__   Peter Dalgaard Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics 2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark  Ph: (+45) 35327918
~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Indexing ANOVA table

2003-11-29 Thread Prof Brian Ripley
On Sat, 29 Nov 2003 [EMAIL PROTECTED] wrote:

 Hi all,
 
 I'd like to extract a value from an ANOVA table, but experience the following
 problem:
 
 ### This works:
 
  s.pseudo - summary(aov(m ~ block + mix*graz,data=split1))
  s.pseudo
 Df  Sum Sq Mean Sq F value  Pr(F)
 block2 1114.66  557.33  4.4296 0.04192 *
 mix  16.146.14  0.0488 0.82956
 graz 21.450.72  0.0057 0.99427
 mix:graz 23.821.91  0.0152 0.98495
 Residuals   10 1258.19  125.82
 ---
 Signif. codes:  0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1
  s.pseudo[[1]][mix ,Pr(F)]
 [1] 0.8295556
 
 ### But this doesn't -- why?

Why should it?

  s.split -  summary(aov(m ~ block + mix*graz + Error(Plot),data=split1))
  s.split
 
 Error: Plot
   Df  Sum Sq Mean Sq F value Pr(F)
 block  2 1114.66  557.33  0.8994 0.5265
 mix16.146.14  0.0099 0.9298
 Residuals  2 1239.37  619.68
 
 Error: Within
   Df  Sum Sq Mean Sq F value Pr(F)
 graz   2  1.4464  0.7232  0.3073 0.7437
 mix:graz   2  3.8206  1.9103  0.8117 0.4776
 Residuals  8 18.8278  2.3535
  s.split[[Error: Plot]]  ## extracting first list element works
   Df  Sum Sq Mean Sq F value Pr(F)
 block  2 1114.66  557.33  0.8994 0.5265
 mix16.146.14  0.0099 0.9298
 Residuals  2 1239.37  619.68
  s.split[[Error: Plot]][mix ,Pr(F)]  ### == FAILS
 Error in s.split[[Error: Plot]][mix , Pr(F)] :
 incorrect number of dimensions

You should have written

s.split[[Error: Plot]][[1]][mix ,Pr(F)]

 So where is the difference between the two?

One is an aov object, the other an aovlist object.  Take a closer look 
at print.summary.aov, for example.

More generally, learn how to look at R objects instead of assuming you
know what you are doing: unclass(s.split[[Error: Plot]]) would have been
informative.

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] performance gap between R 1.7.1 and 1.8.0

2003-11-29 Thread Martin Maechler
 AndyL == Liaw, Andy [EMAIL PROTECTED]
 on Fri, 28 Nov 2003 22:19:27 -0500 writes:

AndyL Dear R-help, A colleague of mine was running some
AndyL code on two of our boxes, and noticed a rather large
AndyL difference in running time.  We've so far isolated
AndyL the problem to the difference between R 1.7.1 and
AndyL 1.8.0, but not more than that.  The exact same code
AndyL took 933.5 seconds in 1.7.1, and 3594.4 seconds in
AndyL 1.8.1, on the same box.

I understand your concern.  I do believe that it must be some
peculiarity of your (or the non-standard packages you used
code).

Some wild guessing: 
Looking at your profiling table, and seeing  read.dcf()  makes
me think about library() -- which does call read.dcf() only when
called on a package that's not yet attached --- and the
bioconductor extra package management -- which for me makes only
the first time (!) attachment of bioconductor packages
relatively slow.  
I still have no idea how this could influence bootstrapping,
unless you detach() and attach() packages many times.
In any case, it might depend on the exact list (and order!?) of
packages present in search() when calling your code.

A very first step of diagnosis might be to activate
  trace(read.dcf)
  trace(library)
  options(verbose = TRUE)

A step further might be to patch read.dcf such that it prints
info 
   if(getOption(verbose)) { print what I am trying to read }

Martin

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] MASS fitdistr()

2003-11-29 Thread Bernardo Rangel Tura
At 15:49 27-11-2003, you wrote:
Dear R experts,

I am trying to use the R MASS library fitdistr() to fit the following
list:

k21stsList-c(0.76697,0.57642,0.75938,0.82616,0.93706,0.77377,0.58923,0.37157,0.60796,1.00070,0.97529,0.62858,0.63504,0.68697,0.61714,0.75227,1.16390,0.66702,0.83578)

as follows,

library(MASS)
fitdistr(k21stsList, normal)

But, I get

Error in fitdistr(k21stsList, normal) : 'start' must be a named list

Hi

You donĀ“t put the start list, something like this

fitdistr(k21stsList, normal,list(mean = 0.5 sd = 0.1))

  mean  sd
  0.74584591   0.17908744 
 (0.04108548) (0.02904255)




Bernardo Rangel Tura, MD, MSc
National Institute of Cardiology Laranjeiras
Rio de Janeiro Brazil

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] problems with xlab

2003-11-29 Thread Celso Barros


Dear R-list members,

I'm using the 'effects' package to plot a graph with fixed values. For some reason, I 
cannot change the label for the 'x' axis using 'xlab='. The usual commands work for 
the y axis and for the main title. My last attempt used the following syntax:

model.effects-(all.effects(model.1))
plot (model.effects, main=Figure 1,xlab=Year,ylab=Change)

The resulting graph has the default label for the x axis instead of 'Year'. The main 
title and the label for 'y' are as expected.
 
Anyone knows what may be happening?

All the Best,

   Celso


   Celso F. Rocha de Barros
  DPhil Candidate in Sociology
 Lady Margaret Hall, Oxford University

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] compile problem with gzfile

2003-11-29 Thread Prof Brian Ripley
Try compiling after configure --without-zlib (available in a less 
obselete system than 1.7.1).  This skips your system's zlib (which is 
apparently fragile) and compiles that in the R sources.

On Sat, 29 Nov 2003, Thomas W Blackwell wrote:

 William  -
 
 I don't have an answer for you, just some stream of
 consciousness rambling about how I would go about
 diagnosing this, if it were my problem.
 
 In my installation directory (of R-1.7.1 on linux) there
 is a file  config.log  which contains all of the configure
 script's queries and replies.  Yes, there is a difference
 between configuring and compiling, but that file might be
 one place to start looking for where the problem begins.
 For me, 'grep gzfile config.log' returns no matching lines.

Nor should it: it is lib/zlib that is being invoked, and gzfile() is an R 
function.

 However, 'grep methods config.log' returns three lines
 which say
 
 config.status:884: creating src/library/methods/DESCRIPTION
 config.status:884: creating src/library/methods/Makefile
 config.status:884: creating src/library/methods/src/Makefile
 
 Seems odd that the 'methods' package would be the only one
 which fails to unpack.  

Not at all.  That is the only package that is installed as a compressed 
saved image rather than as a text source file.

 Perhaps the problem is more general,
 and, likely, more elementary.
 
 Ah.  When you downloaded the source files, did you set 'binary'
 in ftp or equivalent ?
 
 HTH  -  tom blackwell  -  u michigan medical school  -  ann arbor  -
 
 On Fri, 28 Nov 2003, William D. McCoy wrote:
 
  I just finished compiling today's r-patched (R 1.8.1 patched) on my
  old Sparc 20 using gcc 3.3 along with Sun's f77.
 
  As it was compiling, I noticed an error regarding gzfile.  The compile
  process left the methods directory and continued on.  Obviously, there
  was a problem, but I don't have the original error message from the
  compiler.  After installing R, I get the following error message when
  I start R:
 
  Error in open.connection(con, rb) : unable to open connection
  In addition: Warning message:
  cannot open compressed file
  `/usr/local/lib/R/library/methods/R/all.rda'
 
  A check for the file 'all.rda' showed that it does not exist.  I do
  have gzip installed and I have libz.so.1.1.4 in /usr/local/lib.  I
  realize this isn't much to go on, but does anyone have an idea what
  might be wrong?  Has anyone had a similar error?
 
  --
  William D. McCoy
  Geosciences
  University of Massachusetts
  Amherst, MA  01003
 
  __
  [EMAIL PROTECTED] mailing list
  https://www.stat.math.ethz.ch/mailman/listinfo/r-help
 
 
 __
 [EMAIL PROTECTED] mailing list
 https://www.stat.math.ethz.ch/mailman/listinfo/r-help
 
 

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] problems with xlab

2003-11-29 Thread John Fox
Dear Celso,

At 04:52 PM 11/29/2003 +, Celso Barros wrote:


Dear R-list members,

I'm using the 'effects' package to plot a graph with fixed values. For 
some reason, I cannot change the label for the 'x' axis using 'xlab='. 
The usual commands work for the y axis and for the main title. My last 
attempt used the following syntax:

model.effects-(all.effects(model.1))
plot (model.effects, main=Figure 1,xlab=Year,ylab=Change)
The resulting graph has the default label for the x axis instead of 
'Year'. The main title and the label for 'y' are as expected.

Anyone knows what may be happening?
I'm afraid that you've found a bug in plot.effect(): I omitted specifying 
the xlab argument to xyplot() in one of the six cases that plot.effect() 
distinguishes. The fix is simple, and I'll shortly upload a new version of 
the package with it, but in the meantime, I'll send you (privately) the 
fixed version of plot.effect().

I apologize for the problem,
 John
-
John Fox
Department of Sociology
McMaster University
Hamilton, Ontario, Canada L8S 4M4
email: [EMAIL PROTECTED]
phone: 905-525-9140x23604
web: www.socsci.mcmaster.ca/jfox
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] compile problem with gzfile

2003-11-29 Thread William D. McCoy
Thanks to Brian Ripley and Thomas Blackwell for responses concerning
my problem.  I am following Brian's suggestion and recompiling after
configuring with --without-zlib.  The compile takes a couple of hours
on the old Sparc 20, but the process has passed the point where it
failed before and has successfully completed compiliation of the
methods package.  So it looks like it will be alright.

Prof Brian Ripley writes:
  Try compiling after configure --without-zlib (available in a less 
  obselete system than 1.7.1).  This skips your system's zlib (which is 
  apparently fragile) and compiles that in the R sources.
  
  On Sat, 29 Nov 2003, Thomas W Blackwell wrote:
  
   William  -
   
   I don't have an answer for you, just some stream of
   consciousness rambling about how I would go about
   diagnosing this, if it were my problem.
   
   In my installation directory (of R-1.7.1 on linux) there
   is a file  config.log  which contains all of the configure
   script's queries and replies.  Yes, there is a difference
   between configuring and compiling, but that file might be
   one place to start looking for where the problem begins.
   For me, 'grep gzfile config.log' returns no matching lines.
  
  Nor should it: it is lib/zlib that is being invoked, and gzfile() is an R 
  function.
  
   However, 'grep methods config.log' returns three lines
   which say
   
   config.status:884: creating src/library/methods/DESCRIPTION
   config.status:884: creating src/library/methods/Makefile
   config.status:884: creating src/library/methods/src/Makefile
   
   Seems odd that the 'methods' package would be the only one
   which fails to unpack.  
  
  Not at all.  That is the only package that is installed as a compressed 
  saved image rather than as a text source file.
  
   Perhaps the problem is more general,
   and, likely, more elementary.
   
   Ah.  When you downloaded the source files, did you set 'binary'
   in ftp or equivalent ?
   
   HTH  -  tom blackwell  -  u michigan medical school  -  ann arbor  -
   
   On Fri, 28 Nov 2003, William D. McCoy wrote:
   
I just finished compiling today's r-patched (R 1.8.1 patched) on my
old Sparc 20 using gcc 3.3 along with Sun's f77.
   
As it was compiling, I noticed an error regarding gzfile.  The compile
process left the methods directory and continued on.  Obviously, there
was a problem, but I don't have the original error message from the
compiler.  After installing R, I get the following error message when
I start R:
   
Error in open.connection(con, rb) : unable to open connection
In addition: Warning message:
cannot open compressed file
`/usr/local/lib/R/library/methods/R/all.rda'
   
A check for the file 'all.rda' showed that it does not exist.  I do
have gzip installed and I have libz.so.1.1.4 in /usr/local/lib.  I
realize this isn't much to go on, but does anyone have an idea what
might be wrong?  Has anyone had a similar error?
   
--
William D. McCoy
Geosciences
University of Massachusetts
Amherst, MA  01003
   
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
   
   
   __
   [EMAIL PROTECTED] mailing list
   https://www.stat.math.ethz.ch/mailman/listinfo/r-help
   
   
  
  -- 
  Brian D. Ripley,  [EMAIL PROTECTED]
  Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
  University of Oxford, Tel:  +44 1865 272861 (self)
  1 South Parks Road, +44 1865 272866 (PA)
  Oxford OX1 3TG, UKFax:  +44 1865 272595
  
  __
  [EMAIL PROTECTED] mailing list
  https://www.stat.math.ethz.ch/mailman/listinfo/r-help
  

-- 
William D. McCoy
Geosciences
University of Massachusetts
Amherst, MA  01003

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] Classic Levene Test of variances

2003-11-29 Thread Sebastian Zank
Hello,

I am searching for the classic Levene test of variances in R but I don't find the 
function. Is there any command or do I have to programm the test by myself? Does 
anybody know? Help would be fine because R is very new to me.

S.Zank
[[alternative HTML version deleted]]

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Classic Levene Test of variances

2003-11-29 Thread Peter Dalgaard
Sebastian Zank [EMAIL PROTECTED] writes:

 Hello,
 
 I am searching for the classic Levene test of variances in R but I don't find the 
 function. Is there any command or do I have to programm the test by myself? Does 
 anybody know? Help would be fine because R is very new to me.

There's one inside the Rcmdr package.

http://cran.r-project.org/src/contrib/PACKAGES.html#Rcmdr

-- 
   O__   Peter Dalgaard Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics 2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark  Ph: (+45) 35327918
~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] tcltk problem with Button-2

2003-11-29 Thread Gabor Grothendieck


The following R code works as expected:

require( tcltk )
tt - tktoplevel()

# create a button labelled A that changes to B when pressed
pressed - function() tkconfigure( tt.but, text=B )
tt.but - tkbutton( tt, text=A, command=pressed )
tkpack(tt.but)

# if Control-Button-1 pressed change button label to C
e - expression( tkconfigure( tt.but, text=C ), break )
tkbind(tt.but, Control-Button-1, e )

But if I simply replace Control-Button-1 with Button-2 in the tkbind
command, i.e. the last line, then nothing happens when I press 
Button-2 (which I assume is the right mouse button).

I also tried removing the break and using a function instead of an
expression but it also does not respond, i.e. I tried replacing
the last line with:

tkbind(tt.but, Button-2, function() tkconfigure( tt.but, text=C ) ) 

I am using Windows 2000 and R 1.8.1 and am pasting the script 
into Rterm to make sure that the Rgui does not interfere with it.

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help