Re: [R] Rcmdr X11 protocol error message

2004-08-31 Thread Peter Dalgaard
Michael Bibo [EMAIL PROTECTED] writes:

 What's happening?
 Both Java and R are reading events from the X11 event loop ``at the same
 time''. As a result, R is reading events meant for Java and vice-versa and bad
 things happen!
 
 There are two solutions:
 
 * use the Java graphics device which uses the Java graphics facilities
 to do the rendering;
 * don't run the GUI and the X11 device at the same time. 
 
 The second solution is clearly not ideal. What we can do is to compile the
 X11 device code to be thread-safe. However, the same effect will be seen if we
 load another X11 event handler (e.g. the Tcl/Tk library). 

I don't think that is the issue. The X11 device and Tk sit on
different connections to the X device, so they shouldn't be seeing
eachother's events (the event loops can starve eachother though
since they are multiplexed). I'd rather suspect a race condition with
the Tk code itself - sending events to a window that is in the process
of being destroyed and things like that. Which Tk version are we
talking about, by the way?

-- 
   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://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] D'agostino test

2004-08-31 Thread Gregor.gawron
Alexandre,

I found once a code to calculate Shapiro_Francia and D'Agostino tests of normality 
written long time ago by Peter B. Mandeville. Below his code and references (It is in 
spanish, I assume):
Gregor


#--
I coded the Shapiro-Francia test which handles from 5 to 5000 observations
from 

Patrick Royston
1993 A Pocket-Calculator Algorithm for the Shapiro-Francia Test for
Non-Normality: An Application to Medicine. Statistics in Medicine vol
12, 181-184
1991 Estimating Departure from Normality. Statistics in Medicine.
vol 10, 1283-1293
1983 A Simple Method for Evaluating the Shapiro-Francia W' Test of 
Non-Normality. The Statistician 32 (1983) 297-300

and the D'Agostino tests from

Ralph B. D'Agostino, Albert Belanger, and Ralph B. D'Agostino, Jr.
1990 A Suggestion for Using Powerful and Informative Tests of Normality.
The American Statistician, November 1990, Vol. 44, No. 4

for testing normality in R.

# Lee 1996:33-34
MOMENTS - function(data,r) sum((data-mean(data))^r)/length(data)

# Peter
SKEW - function(data) MOMENTS(data,3)/(MOMENTS(data,2)*sqrt(MOMENTS(data,2)))

# Peter
KURTOSIS - function(data) MOMENTS(data,4)/(MOMENTS(data,2)*MOMENTS(data,2))

# D'Agostino, Belanger and D'Agostino 1990:316-321
DAGOSTINO - function(data){
cat(  PRUEBAS DE D'AGOSTINO\n)
n - length(data)
cat(SIMETRIA\n)
cat(  COEFICIENTE DE SIMETRIA:,sqrtb1 - SKEW(data),\n)
if(n8){
y - sqrtb1*sqrt((n+1)*(n+3)/(6*(n-2)))
beta2 - 3*(n*n+27*n-70)*(n+1)*(n+3)/((n-2)*(n+5)*(n+7)*(n+9))
w - sqrt(-1+sqrt(2*(beta2-1)))
delta - 1/sqrt(log(w))
ALPHA - sqrt(2/(w*w-1))
cat(  ZETA CALCULADA:,zb1 -
delta*log(y/ALPHA+sqrt((y/ALPHA)^2+1)),\n)
cat(  PROBABILIDAD:,2*(1-pnorm(abs(zb1))),\n)
}else
cat(LA PRUEBA DE SESGO REQUIERE POR LO MENOS 9 REPETICIONES\n)
cat(KURTOSIS\n)
cat(  COEFICIENTE DE KURTOSIS:,b2 - KURTOSIS(data),\n)
if(n19){
   meanb2 - 3*(n-1)/(n+1)
   varb2 - 24*n*(n-2)*(n-3)/((n+1)*(n+1)*(n+3)*(n+5))
   x - (b2-meanb2)/sqrt(varb2)
   moment -
6*(n*n-5*n+2)/((n+7)*(n+9))*sqrt(6*(n+3)*(n+5)/(n*(n-2)*(n-3)))
   a - 5+8/moment*(2/moment+sqrt(1+4/(moment*moment)))
   cat(  ZETA CALCULADA:,zb2 -
(1-2/(9*a)-((1-2/a)/(1+x*sqrt(2/(a-4^(1/3))/sqrt(2/(9*a)),\n)
   cat(  PROBABILIDAD:,2*(1-pnorm(abs(zb2))),\n)
   cat(OMNIBUS\n)
   cat(  JI-CUADRADA CALCULADA:,k2 - zb1*zb1+zb2*zb2,\n)
   cat(  GRADOS DE LIBERTAD: 2\n)
   cat(  PROBABILIDAD:,probji2 - 1-pchisq(k2,2),\n)
}else
   cat(LAS PRUEBAS DE KURTOSIS Y OMNIBUS REQUIEREN POR LO MENOS 20 
REPETICIONES\n)
}

# Royston 1993:183-184
SHAPIRO.FRANCIA - function(data){
cat(  PRUEBA DE NORMALIDAD DE SHAPIRO-FRANCIA\n)
n - length(data)
if(n5 || n5000)
cat(REQUIERE ENTRE 5 Y 5000 REPETICIONES\n)
else{
xbar - mean(data)
sdata - sort(data)
resid - sdata-xbar
uniform - seq(1,n)
np - qnorm((uniform-0.375)/(n+0.25))
cat(W':,w -
(sum(np*sdata))^2/(sum(np*np)*sum(resid*resid)),\n)
u - log(n)
v - log(u)
muy - -1.2725+1.0521*(v-u)
sigmay - 1.0308-0.26758*(v+2/u)
cat(ZETA CALCULADA:,zeta - (log(1-w)-muy)/sigmay,\n)
cat(PROBABILIDAD:,probz - 1-pnorm(zeta),\n)
}
}

Peter B.

Peter B. Mandeville [EMAIL PROTECTED]
Jefe del Depto. de Informática y Bioestadística [EMAIL PROTECTED] 
Facultad de MedicineTel: 48 26-23-45 ext. 232
Universidad Autónoma de San Luis Potosí Fax: 48 28-23-52
Av. V. Carranza 2405
Col. Los Filtros
Apartado Postal 145
San Luis Potosí, S.L.P.
78210 México

#--


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Alexandre Bournery
Sent: Montag, 30. August 2004 18:08
To: [EMAIL PROTECTED]
Subject: [R] D'agostino test


Hi, Does anyone know if the D'agostino test is available with R ? Alex

__
[EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Any information in this communication is confidential and ma...{{dropped}}

__
[EMAIL PROTECTED] 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] (no subject)

2004-08-31 Thread Paolo Tommasini
Hi this is a very simple question ! if a have a set of date like
x=c(1,2,3,4,4,5,6,8,7,8,8)
how can I find out the percentile of 7 ?
thanks
Paolo
__
[EMAIL PROTECTED] 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] (no subject)

2004-08-31 Thread Wolski
sum(x=7)/length(x)*100


*** REPLY SEPARATOR  ***

On 8/31/2004 at 8:16 AM Paolo Tommasini wrote:

Hi this is a very simple question ! if a have a set of date like
x=c(1,2,3,4,4,5,6,8,7,8,8)

how can I find out the percentile of 7 ?

thanks

Paolo

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html



Dipl. bio-chem. Witold Eryk Wolski @ MPI-Moleculare Genetic   
Ihnestrasse 63-73 14195 Berlin'v'
tel: 0049-30-83875219/   \   
mail: [EMAIL PROTECTED]---W-Whttp://www.molgen.mpg.de/~wolski 
  [EMAIL PROTECTED]

__
[EMAIL PROTECTED] 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] Rcmdr X11 protocol error message

2004-08-31 Thread John Fox
Dear Michael,

A question: Do you observe these problems with tcltk in general or just with
the Rcmdr package? Is it possible for you to test a Tcl/Tk program outside
of R?

Regards,
 John

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Peter Dalgaard
 Sent: Tuesday, August 31, 2004 2:32 AM
 To: Michael Bibo
 Cc: [EMAIL PROTECTED]
 Subject: Re: [R] Rcmdr X11 protocol error message
 
 Michael Bibo [EMAIL PROTECTED] writes:
 
  What's happening?
  Both Java and R are reading events from the X11 event loop ``at 
  the same time''. As a result, R is reading events meant for 
 Java and 
  vice-versa and bad things happen!
  
  There are two solutions:
  
  * use the Java graphics device which uses the Java graphics 
  facilities to do the rendering;
  * don't run the GUI and the X11 device at the same time. 
  
  The second solution is clearly not ideal. What we can do is to 
  compile the
  X11 device code to be thread-safe. However, the same effect will be 
  seen if we load another X11 event handler (e.g. the Tcl/Tk library).
 
 I don't think that is the issue. The X11 device and Tk sit on 
 different connections to the X device, so they shouldn't be 
 seeing eachother's events (the event loops can starve 
 eachother though since they are multiplexed). I'd rather 
 suspect a race condition with the Tk code itself - sending 
 events to a window that is in the process of being destroyed 
 and things like that. Which Tk version are we talking about, 
 by the way?
 
 -- 
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://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! 
 http://www.R-project.org/posting-guide.html

__
[EMAIL PROTECTED] 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] appending data to a dataframe

2004-08-31 Thread Dewez Thomas
Dear R users,

I am sorry to ask you such a pathetic newbie question, but how does one
append data at the end of a data frame?
I am working with GRASS/R library, but the question is about R.
I have a data.frame containing the following variables
basinID, distoutlet, drainage_area, slope

These variables are stored for all pixels of Grass Raster objects. For each
drainage basin (basinID), I'd like to find the maximum of distoutlet. How
can I store the pair of info (bv$ID, max(bv$distoutlet)) at each step of the
for loop ?

I presume something like this could do

for (i 1:max(basinID)){
bid - i
length - max(distoutlet[which(basinID == I(i))])
}

But how do I handle the output and record bid and length in parallel in an
object???

Any hint is welcome

Thomas
***
Le contenu de cet e-mail et de ses pièces jointes est destin...{{dropped}}

__
[EMAIL PROTECTED] 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] appending data to a dataframe

2004-08-31 Thread Duncan Murdoch
On Tue, 31 Aug 2004 14:05:59 +0200, Dewez Thomas [EMAIL PROTECTED]
wrote :

Dear R users,

I am sorry to ask you such a pathetic newbie question, but how does one
append data at the end of a data frame?

The rbind() function should work:  it adds rows to matrices and
dataframes.

However, I'd do something different for the problem you give:

I am working with GRASS/R library, but the question is about R.
I have a data.frame containing the following variables
basinID, distoutlet, drainage_area, slope

These variables are stored for all pixels of Grass Raster objects. For each
drainage basin (basinID), I'd like to find the maximum of distoutlet. How
can I store the pair of info (bv$ID, max(bv$distoutlet)) at each step of the
for loop ?

I presume something like this could do

for (i 1:max(basinID)){
bid - i
length - max(distoutlet[which(basinID == I(i))])
}

But how do I handle the output and record bid and length in parallel in an
object???

Appending a row at a time is very slow.  You'll find it much faster to
set up a matrix to hold the results in advance:

results - matrix(NA, max(basinID), 2)
for (i in 1:max(basinID)) {
bid - i
length - max(distoutlet[which(basinID == i)])
results[i,] - c(i, length)
}

Duncan Murdoch

__
[EMAIL PROTECTED] 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] blockwise sums

2004-08-31 Thread Lutz Prechelt
I am looking for a function like 
  my.blockwisesum(vector, n)
that computes sums of disjoint subsequences of length n from vector
and can work with vector lengths that are not a multiple of n.

It should give me for instance
  my.blockwisesum(1:10, 3) == c(6, 15, 24, 10)

Is there a builtin function that can do this?
One could do it by coercing the vector into a matrix of width n,
and then use apply,
but that is cumbersome if the length is not divisible by n, 
is it not?
Any other ideas?

  Lutz

Prof. Dr. Lutz Prechelt;  [EMAIL PROTECTED]
Institut fuer Informatik; Freie Universitaet Berlin
Takustr. 9; 14195 Berlin; Germany
+49 30 838 75115; http://www.inf.fu-berlin.de/inst/ag-se/

__
[EMAIL PROTECTED] 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] blockwise sums

2004-08-31 Thread Liaw, Andy
If you insist, here's one way:

my.blockwisesum - function(x, n, ...) {
tapply(x, seq(1, length(x), by=n), sum, ...)
}

Andy

 From: Lutz Prechelt
 
 I am looking for a function like 
   my.blockwisesum(vector, n)
 that computes sums of disjoint subsequences of length n from vector
 and can work with vector lengths that are not a multiple of n.
 
 It should give me for instance
   my.blockwisesum(1:10, 3) == c(6, 15, 24, 10)
 
 Is there a builtin function that can do this?
 One could do it by coercing the vector into a matrix of width n,
 and then use apply,
 but that is cumbersome if the length is not divisible by n, 
 is it not?
 Any other ideas?
 
   Lutz
 
 Prof. Dr. Lutz Prechelt;  [EMAIL PROTECTED]
 Institut fuer Informatik; Freie Universitaet Berlin
 Takustr. 9; 14195 Berlin; Germany
 +49 30 838 75115; http://www.inf.fu-berlin.de/inst/ag-se/
 
 __
 [EMAIL PROTECTED] mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! 
 http://www.R-project.org/posting-guide.html
 


__
[EMAIL PROTECTED] 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] blockwise sums

2004-08-31 Thread Barry Rowlingson
Liaw, Andy wrote:
If you insist, here's one way:
my.blockwisesum - function(x, n, ...) {
tapply(x, seq(1, length(x), by=n), sum, ...)
}
 Did you test that? I get:
 my.blockwisesum(1:10, 3)
Error in tapply(x, seq(1, length(x), by = n), sum, ...) :
arguments must have same length
 Here's my solution with tapply and rep() to generate a vector like 
c(1,1,1,2,2,2,3,3,3,4):

baz.blockwisesum=
 function(v,n){tapply(v,rep(1:(1+length(v)/n),each=n)[1:length(v)],sum)}
 baz.blockwisesum(1:10,3)
 1  2  3  4
 6 15 24 10
 - just ignore the 1 to 4 names, they cant hurt you.
Baz
__
[EMAIL PROTECTED] 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] blockwise sums

2004-08-31 Thread Wolski
Hi!

ind-c(sort(rep(1:floor(length(x)/ 3 ) ,  3 )) , floor(length(x)/ 3 )+1)



by(x,ind,sum)

my.blockwisesum-function(x,n,...)
{
ind-c(sort(rep(1:floor(length(x)/ n ) ,  n )) , floor(length(x)/ n )+1)
return(tapply(x,ind,sum))
}


/Eryk


*** REPLY SEPARATOR  ***

On 8/31/2004 at 2:19 PM Lutz Prechelt wrote:

I am looking for a function like 
  my.blockwisesum(vector, n)
that computes sums of disjoint subsequences of length n from vector
and can work with vector lengths that are not a multiple of n.

It should give me for instance
  my.blockwisesum(1:10, 3) == c(6, 15, 24, 10)

Is there a builtin function that can do this?
One could do it by coercing the vector into a matrix of width n,
and then use apply,
but that is cumbersome if the length is not divisible by n, 
is it not?
Any other ideas?

  Lutz

Prof. Dr. Lutz Prechelt;  [EMAIL PROTECTED]
Institut fuer Informatik; Freie Universitaet Berlin
Takustr. 9; 14195 Berlin; Germany
+49 30 838 75115; http://www.inf.fu-berlin.de/inst/ag-se/

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html



Dipl. bio-chem. Witold Eryk Wolski @ MPI-Moleculare Genetic   
Ihnestrasse 63-73 14195 Berlin'v'
tel: 0049-30-83875219/   \   
mail: [EMAIL PROTECTED]---W-Whttp://www.molgen.mpg.de/~wolski 
  [EMAIL PROTECTED]

__
[EMAIL PROTECTED] 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] blockwise sums

2004-08-31 Thread Liaw, Andy
 From: Barry Rowlingson 
 
 Liaw, Andy wrote:
  If you insist, here's one way:
  
  my.blockwisesum - function(x, n, ...) {
  tapply(x, seq(1, length(x), by=n), sum, ...)
  }
  
 
   Did you test that? I get:

Of course not (slap on wrist)!!  My apologies...

Andy
 
   my.blockwisesum(1:10, 3)
 Error in tapply(x, seq(1, length(x), by = n), sum, ...) :
  arguments must have same length
 
 
   Here's my solution with tapply and rep() to generate a vector like 
 c(1,1,1,2,2,2,3,3,3,4):
 
 baz.blockwisesum=
   
 function(v,n){tapply(v,rep(1:(1+length(v)/n),each=n)[1:length(
 v)],sum)}
 
   baz.blockwisesum(1:10,3)
   1  2  3  4
   6 15 24 10
 
   - just ignore the 1 to 4 names, they cant hurt you.
 
 Baz
 


__
[EMAIL PROTECTED] 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] blockwise sums

2004-08-31 Thread Dimitris Rizopoulos
Hi Lutz,

you could try the following:

blockwisesum - function(x, n){
  nx - length(x)
  if(nx%%n) x. - c(x, rep(0., n*ceiling(nx/n)-nx)) else x. - x
  x. - matrix(x., ncol=n, byrow=TRUE)
  rowSums(x.)
}

blockwisesum(1:10, 3)

I hope this helps.

Best,
Dimitris


Dimitris Rizopoulos
Doctoral Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven

Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/16/396887
Fax: +32/16/337015
Web: http://www.med.kuleuven.ac.be/biostat/
 http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm


- Original Message - 
From: Lutz Prechelt [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, August 31, 2004 2:19 PM
Subject: [R] blockwise sums


 I am looking for a function like
   my.blockwisesum(vector, n)
 that computes sums of disjoint subsequences of length n from vector
 and can work with vector lengths that are not a multiple of n.

 It should give me for instance
   my.blockwisesum(1:10, 3) == c(6, 15, 24, 10)

 Is there a builtin function that can do this?
 One could do it by coercing the vector into a matrix of width n,
 and then use apply,
 but that is cumbersome if the length is not divisible by n,
 is it not?
 Any other ideas?

   Lutz

 Prof. Dr. Lutz Prechelt;  [EMAIL PROTECTED]
 Institut fuer Informatik; Freie Universitaet Berlin
 Takustr. 9; 14195 Berlin; Germany
 +49 30 838 75115; http://www.inf.fu-berlin.de/inst/ag-se/

 __
 [EMAIL PROTECTED] mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html

__
[EMAIL PROTECTED] 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] blockwise sums

2004-08-31 Thread Pfaff, Bernhard
 
 Liaw, Andy wrote:
  If you insist, here's one way:
  
  my.blockwisesum - function(x, n, ...) {
  tapply(x, seq(1, length(x), by=n), sum, ...)
  }
  
 
   Did you test that? I get:
 
   my.blockwisesum(1:10, 3)
 Error in tapply(x, seq(1, length(x), by = n), sum, ...) :
  arguments must have same length
 
 
   Here's my solution with tapply and rep() to generate a vector like 
 c(1,1,1,2,2,2,3,3,3,4):
 
 baz.blockwisesum=
   
 function(v,n){tapply(v,rep(1:(1+length(v)/n),each=n)[1:length(
 v)],sum)}
 
   baz.blockwisesum(1:10,3)
   1  2  3  4
   6 15 24 10
 
   - just ignore the 1 to 4 names, they cant hurt you.
 
 Baz

To complete the picture: here is another one:

my.blockwisesum - function(vec, n){
  vec - as.vector(vec)
  n - as.integer(n)
  total - length(vec)
  if(total = n){
stop(\nn should be smaller than length of vector.\n)
  }
  start - seq(1, total, n)
  end - start + n - 1
  end[end  total] - max(start)
  index - 1 : length(start)
  return(sapply(index, function(x)sum(test[start[x]:end[x]])))
}

 test - 1:150
 ptn - proc.time()
 baz.blockwisesum(test,3)
  1   2   3   4   5   6   7   8   9  10  11  12  13  14  15  16  17  18  19
20 
  6  15  24  33  42  51  60  69  78  87  96 105 114 123 132 141 150 159 168
177 
 21  22  23  24  25  26  27  28  29  30  31  32  33  34  35  36  37  38  39
40 
186 195 204 213 222 231 240 249 258 267 276 285 294 303 312 321 330 339 348
357 
 41  42  43  44  45  46  47  48  49  50 
366 375 384 393 402 411 420 429 438 447 
 proc.time()-ptn
[1] 0.00 0.00 0.22   NA   NA
 
 ptn - proc.time()
 my.blockwisesum(test,3)
 [1]   6  15  24  33  42  51  60  69  78  87  96 105 114 123 132 141 150 159
168
[20] 177 186 195 204 213 222 231 240 249 258 267 276 285 294 303 312 321 330
339
[39] 348 357 366 375 384 393 402 411 420 429 438 447
 proc.time()-ptn
[1] 0.00 0.00 0.19   NA   NA
 

HTH,
Bernhard



The information contained herein is confidential and is inte...{{dropped}}

__
[EMAIL PROTECTED] 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] blockwise sums

2004-08-31 Thread Peter Dalgaard
Barry Rowlingson [EMAIL PROTECTED] writes:

 Liaw, Andy wrote:
  If you insist, here's one way:
  my.blockwisesum - function(x, n, ...) {
  tapply(x, seq(1, length(x), by=n), sum, ...)
  }
 
 
   Did you test that? I get:
 
   my.blockwisesum(1:10, 3)
 Error in tapply(x, seq(1, length(x), by = n), sum, ...) :
  arguments must have same length
 
 
   Here's my solution with tapply and rep() to generate a vector like
 c(1,1,1,2,2,2,3,3,3,4):
 
 baz.blockwisesum=
   function(v,n){tapply(v,rep(1:(1+length(v)/n),each=n)[1:length(v)],sum)}
 
   baz.blockwisesum(1:10,3)
   1  2  3  4
   6 15 24 10

Slight variant

pd.blockwisesum - 
 function(v,n){N - length(v); tapply(x,gl(ceiling(N/n), n, N), sum)}

 pd.blockwisesum(1:10,3)
 1  2  3  4
 6 15 24 10


-- 
   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://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] blockwise sums

2004-08-31 Thread Gabor Grothendieck
Lutz Prechelt prechelt at pcpool.mi.fu-berlin.de writes:

: 
: I am looking for a function like 
:   my.blockwisesum(vector, n)
: that computes sums of disjoint subsequences of length n from vector
: and can work with vector lengths that are not a multiple of n.
: 
: It should give me for instance
:   my.blockwisesum(1:10, 3) == c(6, 15, 24, 10)

tapply(v, (seq(v)-1)%/%n, sum)

__
[EMAIL PROTECTED] 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] I've forgotten, why is box() the default?

2004-08-31 Thread Simon Fear
I've searched on CRAN for axes, axis, and other terms 
I've already forgotten, without (re)discovering the 
reason for S using non-joining axes by default, instead
of box(l).

MASS points me towards Cleveland (1993) but I don't 
have ready access to this any more. Could someone 
give me a one-liner to justify this choice to a sceptic?

It's something to do with not mis-interpreting the axes
intersection as (0,0), isn't it?

TIA,
Simon  
 
Simon Fear 
Senior Statistician 
Syne qua non Ltd 
Tel: +44 (0) 1379 69 
Fax: +44 (0) 1379 65 
email: [EMAIL PROTECTED] 
web: http://www.synequanon.com 
  
Number of attachments included with this message: 0 
 
  
This message (and any associated files) is confidential and\...{{dropped}}

__
[EMAIL PROTECTED] 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] D'agostino test

2004-08-31 Thread Douglas G. Scofield
 -Original Message-
 From: Alexandre Bournery [mailto:[EMAIL PROTECTED] 
 Sent: Monday, August 30, 2004 11:08 AM
 To: [EMAIL PROTECTED]
 Subject: [R] D'agostino test
 
 Hi, Does anyone know if the D'agostino test is available with R ?
 Alex
 
 
 

Hi, 

See below, taken pretty much verbatim from Zar (1999)

Douglas G. Scofield, PhDDepartment of Biology 
[EMAIL PROTECTED]Indiana University
off: (812) 856-0115 1001 E. 3rd St.
fax: (812) 855-6705 Bloomington, IN  47405-3700
cell: (786) 514-9141
 
---

dagostino.pearson.test - function(x) {
# from Zar (1999), implemented by Doug Scofield,
[EMAIL PROTECTED]
DNAME - deparse(substitute(x))
n - length(x)
x2 - x * x
x3 - x * x2
x4 - x * x3
# compute Z_g1
k3 - ((n*sum(x3)) - (3*sum(x)*sum(x2)) + (2*(sum(x)^3)/n)) /
((n-1)*(n-2))
g1 - k3 / sqrt(var(x)^3)
sqrtb1 - ((n - 2)*g1) / sqrt(n*(n - 1))
A - sqrtb1 * sqrt(((n + 1)*(n + 3)) / (6*(n - 2)))
B - (3*(n*n + 27*n - 70)*(n+1)*(n+3)) / ((n-2)*(n+5)*(n+7)*(n+9))
C - sqrt(2*(B - 1)) - 1
D - sqrt(C)
E - 1 / sqrt(log(D))
F - A / sqrt(2/(C - 1))
Zg1 - E * log(F + sqrt(F*F + 1))
# compute Z_g2
G - (24*n*(n-2)*(n-3)) / (((n+1)^2)*(n+3)*(n+5))
k4 - (((n*n*n + n*n)*sum(x4)) - (4*(n*n + n)*sum(x3)*sum(x)) -
(3*(n*n - n)*sum(x2)^2) + (12*n*sum(x2)*sum(x)^2) - (6*sum(x)^4)) /
(n*(n-1)*(n-2)*(n-3))
g2 - k4 / var(x)^2
H - ((n-2)*(n-3)*abs(g2)) / ((n+1)*(n-1)*sqrt(G))
J - ((6*(n*n - 5*n + 2)) / ((n+7)*(n+9))) * sqrt((6*(n+3)*(n+5)) /
(n*(n-2)*(n-3)))
K - 6 + (8/J)*(2/J + sqrt(1 + 4/(J*J)))
L - (1 - 2/K) / (1 + H*sqrt(2/(K-4)))
Zg2 - (1 - 2/(9*K) - (L^(1/3))) / (sqrt(2/(9*K)))
K2 - Zg1*Zg1 + Zg2*Zg2
pk2 - pchisq(K2, 2, lower.tail=FALSE)
RVAL - list(statistic = c(K2 = K2), p.value = pk2, method =
D'Agostino-Pearson normality test\n\nK2 is distributed as Chi-squared
with df=2, alternative = distribution is not normal, data.name =
DNAME)
class(RVAL) - htest
return(RVAL)
}

__
[EMAIL PROTECTED] 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] (no subject)

2004-08-31 Thread Thomas Lumley
On Mon, 30 Aug 2004, Austin, Matt wrote:

 A correction.  You either need to open the plotting device prior to the
 simulation that includes your plotting commands and close it after the
 simulation or have the name change dynamically in your simulation so that
 the runs go in separate files.

 An example of the first method would be

 postscript(file=/where/to/put/file/filename.ps)

It's also worth pointing out that many people will find pdf() more
convenient than postscript()

-thomas



 ## your simulation commands

 dev.off()

 for the second method more info would be needed to know how you are running
 your simulation to help with dynamic naming.

 --Matt

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] Behalf Of Austin, Matt
 Sent: Monday, August 30, 2004 18:56 PM
 To: 'Loke Chok Kang'; [EMAIL PROTECTED]
 Subject: RE: [R] (no subject)



 You need to use a device to print to such as

 postscript(file=/where/to/put/file/filename.ps)
   ##your plotting code here
 dev.off()

 Writing a plot at each iteration of your simulation can impact the runtime
 greatly.

 Please read the posting guide at the bottom of the e-mail, it can help you
 get more helpful . . . help

 --Matt

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] Behalf Of Loke Chok Kang
 Sent: Monday, August 30, 2004 18:42 PM
 To: [EMAIL PROTECTED]
 Subject: [R] (no subject)


 Hi,
 Sorry, I have a problem that require some help. As I am doing a project with
 R and this project requires me to do a lot of plotting as I run my
 simulation, I need R to help me store my plots automatically as the
 simulation is run. Could anyone advise me on how this can be done? If
 possible I need all the plots to be written to a file.

 PS:In all I have over 500 over plots, thus it will not be possible to
 manually plot all the plots out.

 From yours faithfully,
 Chok Kang
 [EMAIL PROTECTED]

 __
 [EMAIL PROTECTED] mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide!
 http://www.R-project.org/posting-guide.html

 __
 [EMAIL PROTECTED] mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide!
 http://www.R-project.org/posting-guide.html

 __
 [EMAIL PROTECTED] mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Thomas Lumley   Assoc. Professor, Biostatistics
[EMAIL PROTECTED]   University of Washington, Seattle

__
[EMAIL PROTECTED] 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] blockwise sums

2004-08-31 Thread Thomas Lumley
On Tue, 31 Aug 2004, Liaw, Andy wrote:

 If you insist, here's one way:

 my.blockwisesum - function(x, n, ...) {
 tapply(x, seq(1, length(x), by=n), sum, ...)
 }

If x is large, rowsum() should be faster than tapply().

-thomas



 Andy

  From: Lutz Prechelt
 
  I am looking for a function like
my.blockwisesum(vector, n)
  that computes sums of disjoint subsequences of length n from vector
  and can work with vector lengths that are not a multiple of n.
 
  It should give me for instance
my.blockwisesum(1:10, 3) == c(6, 15, 24, 10)
 
  Is there a builtin function that can do this?
  One could do it by coercing the vector into a matrix of width n,
  and then use apply,
  but that is cumbersome if the length is not divisible by n,
  is it not?
  Any other ideas?
 
Lutz
 
  Prof. Dr. Lutz Prechelt;  [EMAIL PROTECTED]
  Institut fuer Informatik; Freie Universitaet Berlin
  Takustr. 9; 14195 Berlin; Germany
  +49 30 838 75115; http://www.inf.fu-berlin.de/inst/ag-se/
 
  __
  [EMAIL PROTECTED] mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide!
  http://www.R-project.org/posting-guide.html
 
 

 __
 [EMAIL PROTECTED] mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Thomas Lumley   Assoc. Professor, Biostatistics
[EMAIL PROTECTED]   University of Washington, Seattle

__
[EMAIL PROTECTED] 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] I've forgotten, why is box() the default?

2004-08-31 Thread Duncan Murdoch
On Tue, 31 Aug 2004 14:13:49 +0100, Simon Fear
[EMAIL PROTECTED] wrote :

I've searched on CRAN for axes, axis, and other terms 
I've already forgotten, without (re)discovering the 
reason for S using non-joining axes by default, instead
of box(l).

MASS points me towards Cleveland (1993) but I don't 
have ready access to this any more. Could someone 
give me a one-liner to justify this choice to a sceptic?

It's something to do with not mis-interpreting the axes
intersection as (0,0), isn't it?

I'm not sure I understand your question:  the default in S is a full
box unless you ask for no box (bty=n), isn't it?  The justification
for this is The four scale lines also provide a clearly defined
region where our eyes can search for data.  With just two, data can be
camouflaged by virtue of where they lie (p. 35).  There's also advice
to keep the data away from the axes and to put the ticks outside the
box to avoid hiding extreme points.

I can't spot a discussion in Cleveland of the reason the axes don't
join when bty=n is specified.  

Duncan Murdoch

__
[EMAIL PROTECTED] 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] I've forgotten, why is box() the default?

2004-08-31 Thread Simon Fear
Not helped by my typo and being in a rush!

It's true that plot.default and surely many others do a box, since 

 par(bty)
[1] o

But this isn't what happens if you do things via axis() ...
(see first example in help(axis)).

Anyway, point taken, I couldn't find it because it is NOT what
is recommended!

 -Original Message-
 From: Duncan Murdoch [mailto:[EMAIL PROTECTED]
 Sent: 31 August 2004 14:45
 To: Simon Fear
 Cc: R-help
 Subject: Re: [R] I've forgotten, why is box() the default?
 
 
 Security Warning: 
 If you are not sure an attachment is safe to open contact 
 Andy on x234. 
 There are 0 attachments with this message. 
  
  
 On Tue, 31 Aug 2004 14:13:49 +0100, Simon Fear
 [EMAIL PROTECTED] wrote :
 
 I've searched on CRAN for axes, axis, and other terms 
 I've already forgotten, without (re)discovering the 
 reason for S using non-joining axes by default, instead
 of box(l).
 
 MASS points me towards Cleveland (1993) but I don't 
 have ready access to this any more. Could someone 
 give me a one-liner to justify this choice to a sceptic?
 
 It's something to do with not mis-interpreting the axes
 intersection as (0,0), isn't it?
 
 I'm not sure I understand your question:  the default in S is a full
 box unless you ask for no box (bty=n), isn't it?  The justification
 for this is The four scale lines also provide a clearly defined
 region where our eyes can search for data.  With just two, data can be
 camouflaged by virtue of where they lie (p. 35).  There's also advice
 to keep the data away from the axes and to put the ticks outside the
 box to avoid hiding extreme points.
 
 I can't spot a discussion in Cleveland of the reason the axes don't
 join when bty=n is specified.  
 
 Duncan Murdoch
  
 
Simon Fear 
Senior Statistician 
Syne qua non Ltd 
Tel: +44 (0) 1379 69 
Fax: +44 (0) 1379 65 
email: [EMAIL PROTECTED] 
web: http://www.synequanon.com 
  
Number of attachments included with this message: 0 
 
  
This message (and any associated files) is confidential and\...{{dropped}}

__
[EMAIL PROTECTED] 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] Restore function in R

2004-08-31 Thread Luis Rideau Cruz
R-help,

Any function in R that restore an object to its original state so
that if not satisfied with the modifications made to it there is no need
to redefine again ( 'undo' action)

I believe there is something like that in S-plus.

Thank you

__
[EMAIL PROTECTED] 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] N-dimensional delaunay tesselation voronoi diagrams

2004-08-31 Thread Rajarshi Guha
Hi,
 I've been looking for functions that can do delaunay tesselation and
generate voronoi cells. I came across deldir and tripack but both seem
to be restricted to 2D points. Are there any packages that can do a
tesselation in N dimensions? I know that Matlab and Mathematica use the
qhull package to provide functions for this. Does anybody know of any R
packages that do this (maybe by calling on qhull)?

Thanks,

---
Rajarshi Guha [EMAIL PROTECTED] http://jijo.cjb.net
GPG Fingerprint: 0CCA 8EE2 2EEB 25E2 AB04 06F7 1BB9 E634 9B87 56EE
---
Q: What do you get when you cross a mosquito with a mountain climber?
A: Nothing. You can't cross a vector with a scaler.

__
[EMAIL PROTECTED] 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] More efficient matrix computation

2004-08-31 Thread JTW
I have a 20x3 matrix as follows:

 m - replicate(3, matrix(rnorm(20),20,1))

I need to compute, say, 95th and 99th percentiles of
each column such that the resulting matrix becomes 2x3
with each row representing the respective percentile. 
My best effort is to compute one column at a time as
follows:

 quantile(m[,1], c(0.95, 0.99))

To do the same for columns 2 and 3, I would simply
change the column number accordingly.  Clearly, this
is not very efficient as I may have a large matrix
(e.g., 100,000x500) to work with.  Any help with the
code is appreciated.

Jack Wang

__
[EMAIL PROTECTED] 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] More efficient matrix computation

2004-08-31 Thread Uwe Ligges
JTW wrote:
I have a 20x3 matrix as follows:

m - replicate(3, matrix(rnorm(20),20,1))
Why not
  m - matrix(rnorm(60), 20, 3)

I need to compute, say, 95th and 99th percentiles of
each column such that the resulting matrix becomes 2x3
with each row representing the respective percentile. 
My best effort is to compute one column at a time as
follows:


quantile(m[,1], c(0.95, 0.99))
That's what apply() is made for:
  apply(m, 2, quantile, c(0.95, 0.99))
Uwe Ligges

To do the same for columns 2 and 3, I would simply
change the column number accordingly.  Clearly, this
is not very efficient as I may have a large matrix
(e.g., 100,000x500) to work with.  Any help with the
code is appreciated.
Jack Wang
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
__
[EMAIL PROTECTED] 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] More efficient matrix computation

2004-08-31 Thread Wolski
Hi!
apply(m,2,quantile,c(0.95,0.99))
/Eryk

*** REPLY SEPARATOR  ***

On 8/31/2004 at 9:16 AM JTW wrote:

I have a 20x3 matrix as follows:

 m - replicate(3, matrix(rnorm(20),20,1))

I need to compute, say, 95th and 99th percentiles of
each column such that the resulting matrix becomes 2x3
with each row representing the respective percentile. 
My best effort is to compute one column at a time as
follows:

 quantile(m[,1], c(0.95, 0.99))

To do the same for columns 2 and 3, I would simply
change the column number accordingly.  Clearly, this
is not very efficient as I may have a large matrix
(e.g., 100,000x500) to work with.  Any help with the
code is appreciated.

Jack Wang

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html



Dipl. bio-chem. Witold Eryk Wolski @ MPI-Moleculare Genetic   
Ihnestrasse 63-73 14195 Berlin'v'
tel: 0049-30-83875219/   \   
mail: [EMAIL PROTECTED]---W-Whttp://www.molgen.mpg.de/~wolski 
  [EMAIL PROTECTED]

__
[EMAIL PROTECTED] 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] blockwise sums

2004-08-31 Thread Berton Gunter
This is a cute problem, so how about a cute algorithm? Since all that is
wanted is the sum, matrix multiplication can be used. If n=vector length and
b = blocksize, then the issue comes down to constructing a block diagonal
matrix with nblk=n%/%b columns with b 1's in each block to multiply the
first b*nblk elements of the vector by (the sum of any remaining elements
can be appended to the result). This muliplier matrix is easily constructed
using diag():

matrix(rep(diag(nblk),each=b),ncol=nblk)

There may even be slicker ways to do it. Anyway, as no implicit looping
(tapply) is used, I suspect this would run considerably faster,too, although
this may be unimportant, and I haven't tested it.

Of course, this approach doesn't generalize. But it is a nice example of
some of R's little tricks.

Cheers,

-- Bert Gunter
Genentech Non-Clinical Statistics
South San Francisco, CA
 
The business of the statistician is to catalyze the scientific learning
process.  - George E. P. Box
 
 

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Liaw, Andy
 Sent: Tuesday, August 31, 2004 5:42 AM
 To: 'Barry Rowlingson'
 Cc: [EMAIL PROTECTED]
 Subject: RE: [R] blockwise sums
 
  From: Barry Rowlingson 
  
  Liaw, Andy wrote:
   If you insist, here's one way:
   
   my.blockwisesum - function(x, n, ...) {
   tapply(x, seq(1, length(x), by=n), sum, ...)
   }
   
  
Did you test that? I get:
 
 Of course not (slap on wrist)!!  My apologies...
 
 Andy
  
my.blockwisesum(1:10, 3)
  Error in tapply(x, seq(1, length(x), by = n), sum, ...) :
   arguments must have same length
  
  
Here's my solution with tapply and rep() to generate a 
 vector like 
  c(1,1,1,2,2,2,3,3,3,4):
  
  baz.blockwisesum=

  function(v,n){tapply(v,rep(1:(1+length(v)/n),each=n)[1:length(
  v)],sum)}
  
baz.blockwisesum(1:10,3)
1  2  3  4
6 15 24 10
  
- just ignore the 1 to 4 names, they cant hurt you.
  
  Baz
  
 
 
 __
 [EMAIL PROTECTED] mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! 
 http://www.R-project.org/posting-guide.html


__
[EMAIL PROTECTED] 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] More efficient matrix computation

2004-08-31 Thread JTW
A million thanks to all for the prompt reply: apply()
works!

Jack Wang

__
[EMAIL PROTECTED] 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] Rcmdr X11 protocol error message

2004-08-31 Thread Michael Bibo
John Fox jfox at mcmaster.ca writes:

 
 Dear Michael,
 
 A question: Do you observe these problems with tcltk in general or just with
 the Rcmdr package? Is it possible for you to test a Tcl/Tk program outside
 of R?
 
And Peter asked which version of Tcl/Tk.

Apparently my system has version 8.4 installed, specifically:
Tcl-8.4.5-3-mdk (tclsh8.4) and Tk-8.4.5-3-mdk (libtk8.4.so).  As I understand
it, these are installed from RPMs on the installation DVD, and I note that they
are mandrake specific.

John - I wasn't sure if I had any other Tcl/Tk applications installed (it's not
always obvious when installing from RPM's).  I have certainly not encountered
these error messages with any other application.  I quickly downloaded WISH
Supernotepad 1.2.3.  This application requires Tcl/Tk 8.4 or greater.  There
are no graphics window in this application, but plenty of dialogue boxes.  It
gave no errors.  Is this an appropriate test?

If this is a mandrake-configuration-specific problem, it may not be worth
spending too much time investigating, as R Commandr still works.  I can always
try re-installing Tcl/Tk from source when/if I have time.

Regards,

Michael

__
[EMAIL PROTECTED] 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] after lm-fit: equality of two regression coefficients

2004-08-31 Thread Alexandre Galvão Patriota
Dear  Christoph, You can use the package gregmisc
require(gregmisc)
C-c(0,1,-1)
glh.test(my.lm,C)

I hope that helps

Alexandre Galvão

 Hi
 
 Let's assume, we have a multiple linear regression,
such as the one 
 using the Scottish hills data (MASS, data(hills)):
 
 one dependent variable: time
 two independent var (metric): dist, climb
 
 if I am interested, after (!) fitting a lm:
 
   my. lm - lm(time ~ dist + climb, data = hills)
 
 in the equivalence (or non-equivalence) of the two
predictors dist 
and 
 climb:
 
   H0: dist = climb

I think you intend to ask if the *coefficients* in the
fit should be 
equal, which is nonsense in this example of course.

 Is there any function in R, which lets me calculate
this, in just 
giving 
 the lm-object my.lm and e.g. a vector such as c(1,
-1), 
 operationalizing the hypothesis H0: t(c(1, -1)) %*%
c(dist, climb) = 
0 ?

library(car)
?linear.hypothesis


 Christoph,
If you are interested in testing for b1=b2 in a
regression model, say

y=b0+b1*x1+b2*x2+e

you can compare the two models o1 and o2

o1-lm(y~x1+x2)
o2-lm(y~I(x1+x2))

best,
vito

__
[EMAIL PROTECTED] 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] enter browser on error

2004-08-31 Thread Bickel, David
Is there a way I can get R to automatically enter the browser inside a user-defined 
function on the generation of an error? Specifically, I'm trying to debug this:

Error in as.double.default(sapply(lis, FUN)) : 
(list) object cannot be coerced to double
In addition: There were 38 warnings (use warnings() to see them)
 traceback()
8: as.double.default(sapply(lis, FUN))
7: as.numeric(sapply(lis, FUN))
6: numeric.sapply(function(x) {
   [EMAIL PROTECTED]
   })

On detection of the error, I would like browser() to be called at the level of 
numeric.sapply(), so that I can examine x. I'm wondering if this can be done by 
modifying the default error handling. Using try() with browser() didn't work.

Thanks,
David
_
David Bickel  http://davidbickel.com
Research Scientist
Pioneer Hi-Bred International
Bioinformatics  Exploratory Research
7250 NW 62nd Ave., PO Box 552
Johnston, Iowa 50131-0552
515-334-4739 Tel
515-334-6634 Fax
[EMAIL PROTECTED], [EMAIL PROTECTED]



This communication is for use by the intended recipient and ...{{dropped}}

__
[EMAIL PROTECTED] 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] enter browser on error

2004-08-31 Thread Prof Brian Ripley
Have you tried options(error=recover)?

On Tue, 31 Aug 2004, Bickel, David wrote:

 Is there a way I can get R to automatically enter the browser inside a user-defined 
 function on the generation of an error? Specifically, I'm trying to debug this:
 
 Error in as.double.default(sapply(lis, FUN)) : 
 (list) object cannot be coerced to double
 In addition: There were 38 warnings (use warnings() to see them)
  traceback()
 8: as.double.default(sapply(lis, FUN))
 7: as.numeric(sapply(lis, FUN))
 6: numeric.sapply(function(x) {
[EMAIL PROTECTED]
})
 
 On detection of the error, I would like browser() to be called at the
 level of numeric.sapply(), so that I can examine x. I'm wondering if
 this can be done by modifying the default error handling. Using try()
 with browser() didn't work.

-- 
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://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] enter browser on error

2004-08-31 Thread Tony Plate
use options(error=recover), e.g.:
 remove(x)
NULL
Warning message:
remove: variable x was not found
 (function() {x})()
Error in (function() { : Object x not found
 options(error=recover)
 (function(y=1) {x})(2)
Error in (function(y = 1) { : Object x not found
Enter a frame number, or 0 to exit
1:(function(y = 1) {
Selection: 1
Called from: eval(expr, envir, enclos)
Browse[1] y
[1] 2
Browse[1]
Enter a frame number, or 0 to exit
1:(function(y = 1) {
Selection: 0

At Tuesday 11:26 AM 8/31/2004, Bickel, David wrote:
Is there a way I can get R to automatically enter the browser inside a 
user-defined function on the generation of an error? Specifically, I'm 
trying to debug this:

Error in as.double.default(sapply(lis, FUN)) :
(list) object cannot be coerced to double
In addition: There were 38 warnings (use warnings() to see them)
 traceback()
8: as.double.default(sapply(lis, FUN))
7: as.numeric(sapply(lis, FUN))
6: numeric.sapply(function(x) {
   [EMAIL PROTECTED]
   })
On detection of the error, I would like browser() to be called at the 
level of numeric.sapply(), so that I can examine x. I'm wondering if this 
can be done by modifying the default error handling. Using try() with 
browser() didn't work.

Thanks,
David
_
David Bickel  http://davidbickel.com
Research Scientist
Pioneer Hi-Bred International
Bioinformatics  Exploratory Research
7250 NW 62nd Ave., PO Box 552
Johnston, Iowa 50131-0552
515-334-4739 Tel
515-334-6634 Fax
[EMAIL PROTECTED], [EMAIL PROTECTED]

This communication is for use by the intended recipient and ...{{dropped}}
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
__
[EMAIL PROTECTED] 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] sample size for t-tests

2004-08-31 Thread Caimiao Wei
Dear all,

Could any one please tell me the exact formula R uses to calculate the sample size for 
one-sample and two-sample t-tests? Thanks,

Caimiao
[[alternative HTML version deleted]]

__
[EMAIL PROTECTED] 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] More efficient matrix computation

2004-08-31 Thread Sundar Dorai-Raj

JTW wrote:
I have a 20x3 matrix as follows:

m - replicate(3, matrix(rnorm(20),20,1))

I need to compute, say, 95th and 99th percentiles of
each column such that the resulting matrix becomes 2x3
with each row representing the respective percentile. 
My best effort is to compute one column at a time as
follows:


quantile(m[,1], c(0.95, 0.99))

To do the same for columns 2 and 3, I would simply
change the column number accordingly.  Clearly, this
is not very efficient as I may have a large matrix
(e.g., 100,000x500) to work with.  Any help with the
code is appreciated.
Jack Wang
How about:
apply(m, 2, quantile, c(0.95, 0.99))
--sundar
__
[EMAIL PROTECTED] 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] sample size for t-tests

2004-08-31 Thread Thomas Lumley
On Tue, 31 Aug 2004, Caimiao Wei wrote:

 Dear all,

 Could any one please tell me the exact formula R uses to calculate the
 sample size for one-sample and two-sample t-tests? Thanks,

There isn't a formula in closed form.  The exact procedure is in the code.

In words: the critical value for the t-test comes from a t-distribution.
The distribution of the t-statistic under the alternative is a non-central
t-distribution, and the sample size is adjusted to get the requested
power.

-thomas

__
[EMAIL PROTECTED] 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] Obtaining Least Square Means with lme (mixed models)

2004-08-31 Thread Alex Bach
Hello,
I was wondering how one could obtain LSM for fixed factors in a 
mixed-effect model using lme. In other words, if I have model such as:

model-lme(yield~period+treatment+period*treatment, 
data=data,random=~1|cow)

how can I get LSM for period, treatment and their interaction?
Thanks a lot!
Alex
__
[EMAIL PROTECTED] 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] spatial autcorrelation in glmmPQL

2004-08-31 Thread Dan Bebber
I am unable to specify error spatial autocorrelation structure in glmmPQL:

DATA
x and y coordinates for sample points at which presence/absence of seedlings
and canopy openness were recorded in different forest stands.

QUESTION
Does seedling density increase with canopy openness?

ANALYSIS
Initial analysis using glmmPQL with binomial errors and stand as random
effect
 result - glmmPQL(seedlings ~ canopy, random = ~1|stand, family=binomial,
data=regen)

Semivariogram of residuals from this fit using geoR showed spatial
autocorrelation with range 34.9 m and relative nugget of 75%. Therefore I
tried to create a corStruct object:
 corel - corSpher(value = c(34.9,0.75), form = ~x+y, nugget=TRUE)
 corel - Initialize(corel, data = regen)

And specify the structure in a new glmmPQL
 result2 - glmmPQL(seedlings ~ canopy, random = ~|stand, family =
binomial, correlation = corel, data=regen)

PROBLEM
I get the error message:
iteration 1
Error in eval(expr, envir, enclos) : Object x not found

(Running R 1.9.1 on Windows ME)

I appear to be implementing corSpher and Initialize incorrectly- any help
greatly appreciated.



Dr. Daniel P. Bebber
Department of Plant Sciences
University of Oxford
South Parks Road
Oxford
OX1 3RB
Tel. 01865 275060
---

__
[EMAIL PROTECTED] 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] add single contour line to levelplot

2004-08-31 Thread Ian Jonsen
Hello,

I want to add a single contour line to a levelplot but can't figure out
how to do it 'on-the-fly'. When I include the last line in the code below,
I get the following error:

Error in NextMethod([) : Argument subscripts is missing, with no default

Any tips on how to fix this are greatly appreciated!

Ian Jonsen


levelplot(dens~nu*sigma,data=tsurflikB,at=c(-20,-10,-5,-4,-3,-2,-1),
 col.regions=gray(seq(0.5,0.9,length=14)),region=T,colorkey=F,aspect=1,
 panel=function(x,y,z,...){
  panel.levelplot(x=x,y=y,z=z,...)
  lpoints(x[z==0],y[z==0],pch=16,cex=0.5)
  panel.levelplot(z~x*y,at=-3,contour=T,aspect=1)
 }
)

___
Ian Jonsen, Postdoctoral Fellow
Dept Biology, Dalhousie University, Halifax, NS, CAN
Phone: 902 494 3910; Fax: 902 494 3736
[EMAIL PROTECTED]

__
[EMAIL PROTECTED] 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] Rcmdr X11 protocol error message

2004-08-31 Thread Peter Dalgaard
Michael Bibo [EMAIL PROTECTED] writes:

 John Fox jfox at mcmaster.ca writes:
 
  
  Dear Michael,
  
  A question: Do you observe these problems with tcltk in general or just with
  the Rcmdr package? Is it possible for you to test a Tcl/Tk program outside
  of R?
  
 And Peter asked which version of Tcl/Tk.
 
 Apparently my system has version 8.4 installed, specifically:
 Tcl-8.4.5-3-mdk (tclsh8.4) and Tk-8.4.5-3-mdk (libtk8.4.so).  As I understand
 it, these are installed from RPMs on the installation DVD, and I note that they
 are mandrake specific.
 
 John - I wasn't sure if I had any other Tcl/Tk applications installed (it's not
 always obvious when installing from RPM's).  I have certainly not encountered
 these error messages with any other application.  I quickly downloaded WISH
 Supernotepad 1.2.3.  This application requires Tcl/Tk 8.4 or greater.  There
 are no graphics window in this application, but plenty of dialogue boxes.  It
 gave no errors.  Is this an appropriate test?
 
 If this is a mandrake-configuration-specific problem, it may not be worth
 spending too much time investigating, as R Commandr still works.  I can always
 try re-installing Tcl/Tk from source when/if I have time.

I don't think we have evidence that it's the Tcl installation,
although it could be (Google suggests that there have been problems
with at least some versions, although most references seem rather
old). I can't seem to reproduce the effect with SUSE's tk-8.4.6-28
either. If it is a bug in Rcmdr, then we'd want to find it and you
have the only handle on it

BTW, sometimes Tk errors allow you to see a trace of the execution.
Would this happen to be one of those situations?

-- 
   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://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] I've forgotten, why is box() the default?

2004-08-31 Thread Duncan Murdoch
On Tue, 31 Aug 2004 15:02:13 +0100, Simon Fear
[EMAIL PROTECTED] wrote :

Not helped by my typo and being in a rush!

It's true that plot.default and surely many others do a box, since 

 par(bty)
[1] o

But this isn't what happens if you do things via axis() ...
(see first example in help(axis)).

I suspect it's just done that way for programming convenience.  Since
it's hard or impossible to delete a line once drawn, axis draws the
minimal sensible one; if you want more, you use box() to draw it.

Duncan Murdoch

__
[EMAIL PROTECTED] 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] Problem (bug?) with vector indices

2004-08-31 Thread Rodrigo Drummond
Hi all,

I found a problem on R that looks like a bug to me. I am working with R
for windows verson 1.9.0, but the problem also happens on the linux
version 1.9.0. I hope that the problem is on my reasoning, and I would be
grateful if someone could explain me why this happens.
There goes the example:

 x-seq(-2,2,0.001)
 y-rep(0,length(x))
 for (i in x){y[1000*i+2001]-i^2}
 plot(x,y)# Here I found something wrong
 which(y==0)
 [1]  244  353  357  361  365  369  482  486  490  494  579  583  587  591
 595
[16]  599  603  607  611  615  619  708  712  716  720  724  728  732  736
 740
[31]  744  837  841  845  849  853  857  861  865  869  962  966  970  974
 978
[46]  982  986  990  994  998 2001
 x[244]
[1] -1.757
 i-x[244]
 1000*i+2001
[1] 244
 y[1000*i+2001]
[1] 3.087049
 y[244]
[1] 0
 y[243]
[1] 3.087049


What means that the expression 1000*i+2001, which is equal to 244, inside
the brackets is evaluated as 243! The same occurs with every value of x
that results in a zero value of y, the right value is stored in y one
position before it should be, overwriting the previous value at this
position.
The bug is on R or on my mind?

Thanks a lot.
Rodrigo Drummond


Rodrigo D. Drummond
Laboratorio Genoma Funcional
Centro de Biologia Molecular e Eng. Genetica
Universidade Estadual de Campinas
Caixa Postal 6010
13083-875 - Campinas - SP - Brasil
Tel: xx-19-3788-1119 Fax: xx-19-3788-1089

__
[EMAIL PROTECTED] 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] Problem (bug?) with vector indices

2004-08-31 Thread Peter Dalgaard
Rodrigo Drummond [EMAIL PROTECTED] writes:

 Hi all,
 
 I found a problem on R that looks like a bug to me. I am working with R
 for windows verson 1.9.0, but the problem also happens on the linux
 version 1.9.0. I hope that the problem is on my reasoning, and I would be
 grateful if someone could explain me why this happens.
 There goes the example:
 
  x-seq(-2,2,0.001)
  y-rep(0,length(x))
  for (i in x){y[1000*i+2001]-i^2}
...
  x[244]
 [1] -1.757
  i-x[244]
  1000*i+2001
 [1] 244
  y[1000*i+2001]
 [1] 3.087049
  y[244]
 [1] 0
  y[243]
 [1] 3.087049
 
 
 What means that the expression 1000*i+2001, which is equal to 244, inside
 the brackets is evaluated as 243! The same occurs with every value of x
 that results in a zero value of y, the right value is stored in y one
 position before it should be, overwriting the previous value at this
 position.
 The bug is on R or on my mind?

The latter: 

Have a look at (1000*x[244]+2001)-244

Beware floating point arithmetic!

-- 
   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://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] add single contour line to levelplot

2004-08-31 Thread Sundar Dorai-Raj

Ian Jonsen wrote:
Hello,
I want to add a single contour line to a levelplot but can't figure out
how to do it 'on-the-fly'. When I include the last line in the code below,
I get the following error:
Error in NextMethod([) : Argument subscripts is missing, with no default
Any tips on how to fix this are greatly appreciated!
Ian Jonsen
levelplot(dens~nu*sigma,data=tsurflikB,at=c(-20,-10,-5,-4,-3,-2,-1),
 col.regions=gray(seq(0.5,0.9,length=14)),region=T,colorkey=F,aspect=1,
 panel=function(x,y,z,...){
  panel.levelplot(x=x,y=y,z=z,...)
  lpoints(x[z==0],y[z==0],pch=16,cex=0.5)
  panel.levelplot(z~x*y,at=-3,contour=T,aspect=1)
 }
)
You have misued panel.levelplot and also forgot (neglected?) to include 
... in the second call. I think you want something like:

# from ?levelplot
library(lattice)
x - seq(pi/4, 5 * pi, length = 100)
y - seq(pi/4, 5 * pi, length = 100)
r - as.vector(sqrt(outer(x^2, y^2, +)))
grid - expand.grid(x = x, y = y)
grid$z - cos(r^2) * exp(-r/(pi^3))
levelplot(z ~ x * y, grid, cuts = 50, scales=list(log=e),
  xlab = , ylab = , main = Weird Function,
  sub = with log scales,
  panel = function(x, y, z, at, contour, ...) {
panel.levelplot(x, y, z, at = 0, contour = TRUE, ...)
lpoints(x[z = -0.5],y[z = -0.5], pch = 16, cex = 0.5)
  },
  colorkey = FALSE, region = TRUE)
Note the usage of  I also think you do not need two calls to 
panel.levelplot, though I may be misunderstanding your intention. One 
will suffice, as it does here.

--sundar
__
[EMAIL PROTECTED] 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] Sparse Matrices in R

2004-08-31 Thread Danny Heuman

I have data in i,j,r format, 



where r is the value in location A[i,j] for some imaginary matrix A.

I need to build this matrix A, but given the sizes of i and j, I believe that using a 
sparse format would be most adequate.

Hopefully this will allow me to perform some basic matrix manipulation such as 
multiplication, addition, rowsums,  transpositions, subsetting etc etc.



Is there any way to achieve this goal in R?
Thanks,
 
Danny

[[alternative HTML version deleted]]

__
[EMAIL PROTECTED] 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] Sparse Matrices in R

2004-08-31 Thread roger koenker
Take a look at the package SparseM
url:www.econ.uiuc.edu/~rogerRoger Koenker
email   [EMAIL PROTECTED]   Department of Economics
vox:217-333-4558University of Illinois
fax:217-244-6678Champaign, IL 61820
On Aug 31, 2004, at 4:52 PM, Danny Heuman wrote:
I have data in i,j,r format,

where r is the value in location A[i,j] for some imaginary matrix A.
I need to build this matrix A, but given the sizes of i and j, I 
believe that using a sparse format would be most adequate.

Hopefully this will allow me to perform some basic matrix manipulation 
such as multiplication, addition, rowsums,  transpositions, subsetting 
etc etc.


Is there any way to achieve this goal in R?
Thanks,
Danny
[[alternative HTML version deleted]]
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! 
http://www.R-project.org/posting-guide.html
__
[EMAIL PROTECTED] 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] Sparse Matrices in R

2004-08-31 Thread Wolski
Hi!
help.search(sparse matrix)


graph2SparseM(graph)Coercion methods between graphs and sparse
matrices
tripletMatrix-class(Matrix)
Class tripletMatrix sparse matrices in
triplet form
SparseM.hb(SparseM) Harwell-Boeing Format Sparse Matrices
image,matrix.csr-method(SparseM)
Image Plot for Sparse Matrices
etc .

/E

*** REPLY SEPARATOR  ***

On 8/31/2004 at 5:52 PM Danny Heuman wrote:

I have data in i,j,r format, 



where r is the value in location A[i,j] for some imaginary matrix A.

I need to build this matrix A, but given the sizes of i and j, I believe
that using a sparse format would be most adequate.

Hopefully this will allow me to perform some basic matrix manipulation
such as multiplication, addition, rowsums,  transpositions, subsetting
etc etc.



Is there any way to achieve this goal in R?
Thanks,
 
Danny

 [[alternative HTML version deleted]]

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html



Dipl. bio-chem. Witold Eryk Wolski @ MPI-Moleculare Genetic   
Ihnestrasse 63-73 14195 Berlin'v'
tel: 0049-30-83875219/   \   
mail: [EMAIL PROTECTED]---W-Whttp://www.molgen.mpg.de/~wolski 
  [EMAIL PROTECTED]

__
[EMAIL PROTECTED] 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] Problem with seq.dates in chron

2004-08-31 Thread Waichler, Scott R

I get faulty output from seq.dates() if I specify a length that is too
long.
For example, I ask for 129 months in the following call to the function,
but it returns
131:

 R.version.string
[1] R version 1.9.1, 2004-06-21
 startdatetime - chron(dates=01/01/1995, times=00:00:00)
 beg.month.datetimes - seq.dates(from=startdatetime, by=months,
length=129)
 beg.month.datetimes
  [1] 01/01/95 02/01/95 03/01/95 04/01/95 05/01/95 06/01/95 07/01/95
08/01/95
  [9] 09/01/95 10/01/95 11/01/95 12/01/95 01/01/96 02/01/96 03/01/96
04/01/96
 [17] 05/01/96 06/01/96 07/01/96 08/01/96 09/01/96 10/01/96 11/01/96
12/01/96
 [25] 01/01/97 02/01/97 03/01/97 04/01/97 05/01/97 06/01/97 07/01/97
08/01/97
 [33] 09/01/97 10/01/97 11/01/97 12/01/97 01/01/98 02/01/98 03/01/98
04/01/98
 [41] 05/01/98 06/01/98 07/01/98 08/01/98 09/01/98 10/01/98 11/01/98
12/01/98
 [49] 01/01/99 02/01/99 03/01/99 04/01/99 05/01/99 06/01/99 07/01/99
08/01/99
 [57] 09/01/99 10/01/99 11/01/99 12/01/99 01/01/00 02/01/00 03/01/00
04/01/00
 [65] 05/01/00 06/01/00 07/01/00 08/01/00 09/01/00 10/01/00 11/01/00
12/01/00
 [73] 01/01/01 02/01/01 03/01/01 04/01/01 05/01/01 06/01/01 07/01/01
08/01/01
 [81] 09/01/01 10/01/01 11/01/01 12/01/01 01/01/02 02/01/02 03/01/02
04/01/02
 [89] 05/01/02 06/01/02 07/01/02 08/01/02 09/01/02 10/01/02 11/01/02
12/01/02
 [97] 01/01/03 02/01/03 03/01/03 04/01/03 05/01/03 06/01/03 07/01/03
08/01/03
[105] 09/01/03 10/01/03 11/01/03 12/01/03 01/01/04 02/01/04 03/01/04
04/01/04
[113] 05/01/04 06/01/04 07/01/04 08/01/04 09/01/04 10/01/04 11/01/04
12/01/04
[121] 01/01/05 02/01/05 03/01/05 04/01/05 05/01/05 06/01/05 07/01/05
08/01/05
[129] 09/01/05 10/01/05 11/01/05


Is this a bug, and can it be fixed?

Scott Waichler
Pacific Northwest National Laboratory
scott.waichleratpnl.gov

__
[EMAIL PROTECTED] 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] subselect install problem

2004-08-31 Thread Xiao-Jun Ma
Trying to install subselect v0.8 on Redhat 7.3 and R 1.8.1 fails (below). Any help is 
greatly appreciated.

Xiao-Jun


* Installing *source* package 'subselect' ...
** libs
f2c   anneal.f  anneal.c
   anneal:
Error on line 263: Declaration error for fica: adjustable dimension on non-argument
Error on line 263: Declaration error for valp: adjustable dimension on non-argument
Error on line 263: Declaration error for auxw: adjustable dimension on non-argument
Error on line 263: wr_ardecls:  nonconstant array size
Error on line 263: wr_ardecls:  nonconstant array size
Error on line 263: wr_ardecls:  nonconstant array size
make: *** [anneal.o] Error 1
ERROR: compilation failed for package 'subselect'

__
[EMAIL PROTECTED] 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] Problem with seq.dates in chron

2004-08-31 Thread Gabor Grothendieck
Waichler, Scott R Scott.Waichler at pnl.gov writes:

 I get faulty output from seq.dates() if I specify a length that is too
 long.
 For example, I ask for 129 months in the following call to the function,
 but it returns
 131:
 
  R.version.string
 [1] R version 1.9.1, 2004-06-21
  startdatetime - chron(dates=01/01/1995, times=00:00:00)
  beg.month.datetimes - seq.dates(from=startdatetime, by=months,
 length=129)

If you look at the seq.dates R source, it sets `to' like this:

   to - from + (length. - 1) * c(1, 7, 31, 366)[i]

where in your case where i is 3 for months.   It then
picks out those days between from and to having the same day 
of the month as the from date (or uses a more complex algorithm if the day 
of the month exceeds 28).  The multiplication by 31 gives an overestimate 
which is OK for a small lengths but overflows to give too many months if
length is too large.  Since we know the error will always be on the
high side, until it is fixed as a workaround you could just subset it:

   seq.dates(from=startdatetime, by=months, length=129)[1:129]

(Perhaps you could forward this to the maintainer of chron.)

__
[EMAIL PROTECTED] 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] simpleboot, pairs.boot

2004-08-31 Thread Rebecca Young
Hi.

I am a new R user trying to obtain bootstrap confidence intervals around vector
correlations of Principal components.

My data is a data frame of eigenvector loadings from PC1 in the columns the rows
are different species.  I want to calculated the vector correlation and
bootstrap confidence intervals for all species pairs.

I have tried using simpleboot as pairs.boot seems to be an easy way of sampling
from two vectors of data.  The function I wrote veccor below works outside of
the pairs.boot function.  However in this function it seems to calculate all
1000 vector correlations as -1.


veccor
function(x,y) ((sum((x)*(y)))/((sqrt(sum(y^2)))*(sqrt(sum(x^2)
x-as.vector(faVC[1,])
y-as.vector(faVC[2,])
boot-pairs.boot(x,y,veccor,1000)
#

I have also tried using the boot function but only end up sampling from on of my
vectors of data.

Any suggestions would be greatly appriciated!  Thanks!

Best, Becca

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html