[R] Impute Values for Forest Inventory

2007-03-29 Thread Ricky Jacob
Dear All,
I am Ricky Jacob, a project Student from India who is working on
Forest Inventories.
Input data:
Plot(area = .1 ha) data having the following information:
1) Basal Area
2)Tree Density
3)Volume
So I am applying this information to the corresponding pixels in the
satellite imagery of the study area.  I also have given the same
values to a 3x3 window around that pixel.
Inventory is taken compartmentwise and so this information of all the
plots in a compartment is taken and generalised over all the pixels
falling in that compartment.  To make the estimation more realistic, i
decided to use the impute opton in r.
The yai requires me to enter the x and y variable.  I stll haven't
figured out how i should put my datasets to impute the values of
variables like Basal area, volume for only those pixels for which no
data is available.
is msn or randomforest a better option.
I tried to work on the example MoscowMtStJoe dataset.  But I wasn't
able to figure out how I should put in my data.
I have records which have both satellite and attribute data and also
have records with only satellite data.  I need to impute attribute
data into those records alone for which no attribute data is available
without altering values in the records having the attribute
information.

Hope for a response
Regards
Ricky Jacob

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] C interface

2007-03-29 Thread gyadav

Hi All
I have read this document - An Introduction to the .C Interface to R, 
which primarily tells how to interface C language with R.
Is there and more elaborative and online documentation regarding this 
interface.

Any pointers appreciated
-thanks
-gaurav


DISCLAIMER AND CONFIDENTIALITY CAUTION:\ \ This message and ...{{dropped}}

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Tail area of sum of Chi-square variables

2007-03-29 Thread Klaus Nordhausen
Dear R experts, 

I was wondering if there are any R functions that give the tail area
of a sum of chisquare distributions of the type:
 a_1 X_1 + a_2 X_2
where a_1 and a_2 are constants and X_1 and X_2 are independent chi-square 
variables with different degrees of freedom.

Thanks,

Klaus
-- 
Feel free - 5 GB Mailbox, 50 FreeSMS/Monat ...

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Plot degree symbol by itself

2007-03-29 Thread Andre Jung
Dear all,

I'm trying to plot the degree symbol by itself between two square
brackets. I just want to have K [°]. So far I got to:

expression(K ~ group([,1*degree,]))
or
expression(K ~ group([,1^o,]))

But it won't work without a number or letter.

Any suggestions?

Thanks,
andre

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Tail area of sum of Chi-square variables

2007-03-29 Thread Achim Zeileis
Hi Klausch:

 I was wondering if there are any R functions that give the tail area
 of a sum of chisquare distributions of the type:
 a_1 X_1 + a_2 X_2
 where a_1 and a_2 are constants and X_1 and X_2 are independent 
 chi-square variables with different degrees of freedom.

Christian Kleiber (Cc on this reply) has code for computing the 
distribution function of general linear combinations of chi-squared 
variables. It's not yet on CRAN, but just ask him for a devel-snapshot.

Best wishes,
Z

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] C interface

2007-03-29 Thread Prof Brian Ripley
We don't know what document that is, and you haven't given us a useful 
pointer, have you?  And the authors (presumably Roger Peng and Jan de 
Leeuw) deserve credit.

The definitive documentation is the 'Writing R Extensions' manual which 
ships with R.  There is also a lot in 'S Programming' (see the books in 
the FAQ), and many examples in the R sources and contributed packages.

On Thu, 29 Mar 2007, [EMAIL PROTECTED] wrote:


 Hi All
 I have read this document - An Introduction to the .C Interface to R,
 which primarily tells how to interface C language with R.
 Is there and more elaborative and online documentation regarding this
 interface.

 Any pointers appreciated
 -thanks
 -gaurav

 
 DISCLAIMER AND CONFIDENTIALITY CAUTION:\ \ This message and ...{{dropped}}

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


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

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Plot degree symbol by itself

2007-03-29 Thread Henrik Andersson
Andre Jung wrote:
 Dear all,

 I'm trying to plot the degree symbol by itself between two square
 brackets. I just want to have K [°]. So far I got to:

 expression(K ~ group([,1*degree,]))
 or
 expression(K ~ group([,1^o,]))

 But it won't work without a number or letter.

   
This worked for me:
expression(K ~ group([,degree,]))
 Any suggestions?

 Thanks,
 andre

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
   


-- 
Henrik Andersson

Danish Meteorological Institute
Lyngbyvej 100
2100 Copenhagen Ø
Denmark
Tel: +45 39157215 
Email: [EMAIL PROTECTED]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Plot degree symbol by itself

2007-03-29 Thread Peter Dalgaard
Andre Jung wrote:
 Dear all,

 I'm trying to plot the degree symbol by itself between two square
 brackets. I just want to have K [°]. So far I got to:

 expression(K ~ group([,1*degree,]))
 or
 expression(K ~ group([,1^o,]))

 But it won't work without a number or letter.

 Any suggestions?

   
An empty pair of braces usually works:

plot(0)
text(1,1,expression(K ~ group([,{}*degree,])))

(or {}^degree, but that looks odd -- degree is already a raised symbol)

But whatever was wrong with just
 
text(1.2,1,expression(K ~ group([,degree,])))

??
 Thanks,
 andre

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Large matrix into a vector

2007-03-29 Thread A Ezhil
Hi All,

Thank you very much for all your suggestions. It's a
great learning for me. All the three suggested
solutions seem working. I don't know what 'side
effects' that you were talking about. To summarize the
responses:

 s - read.table(sample.txt, sep=\t)
 s1 - as.matrix(s)
 s1
V1   V2   V3
1 0.59 0.47 0.44
2 0.85 0.42 0.57
3 0.48 0.57 0.57
4 0.61 0.24 0.24
5 0.38 0.21 0.36
6 0.65 0.42 1.50
7 0.49 0.23 0.42
8 0.60 0.51 0.53
9 0.00 0.00 0.00

 s2 - as.vector(s1)
 s2
 [1] 0.59 0.85 0.48 0.61 0.38 0.65 0.49 0.60 0.00 0.47
0.42 0.57 0.24 0.21 0.42 0.23 0.51 0.00 0.44 0.57 0.57
0.24 0.36
[24] 1.50 0.42 0.53 0.00
 s3 - c(s1)
 s3
 [1] 0.59 0.85 0.48 0.61 0.38 0.65 0.49 0.60 0.00 0.47
0.42 0.57 0.24 0.21 0.42 0.23 0.51 0.00 0.44 0.57 0.57
0.24 0.36
[24] 1.50 0.42 0.53 0.00
 s3 - s1
 dim(s3) - NULL
 s3
 [1] 0.59 0.85 0.48 0.61 0.38 0.65 0.49 0.60 0.00 0.47
0.42 0.57 0.24 0.21 0.42 0.23 0.51 0.00 0.44 0.57 0.57
0.24 0.36
[24] 1.50 0.42 0.53 0.00

Interestingly, if I apply the same three solutions to
the data.frame 's', the results are different: (1)
as.vector() keeps the data frame as it is. (2) c()
changes into lists, and (3) making dim() - NULL keeps
as structure. 

Thanks again.
Kind regards,
Ezhil


--- Peter Dalgaard [EMAIL PROTECTED] wrote:

 Marc Schwartz [EMAIL PROTECTED] writes:
 
  On Wed, 2007-03-28 at 19:55 -0200, Alberto
 Monteiro wrote:
  Prof Brian Ripley wrote:
  
   We have already seen three solutions.
   
   I don't like to see the use of c() for its side
 effects.  In this 
   case Marc's as.vector seems to me to be
 self-explanatory, and that 
   is a virtue in programming that is too often
 undervalued.
   
  I agree; but for our enlightnment, what are the
 side effects of
  c()?
  
  Alberto Monteiro
 
  I believe that Prof. Ripley is referring to the
 following, from the
  Details section in ?c:
 
 
  c is sometimes used for its side effect of
 removing attributes except
  names, for example to turn an array into a vector.
 as.vector is a more
  intuitive way to do this, but also drops names.
 
 
  There are also examples in ?c of this behavior.
 
 The terminology is a bit unfortunate, though. Side
 effect usually
 means an effect that is not reflected in the return
 value of a
 function, like printing, plotting, or assignment.
 
 -- 
O__   Peter Dalgaard Øster
 Farimagsgade 5, Entr.B
   c/ /'_ --- Dept. of Biostatistics PO Box 2099,
 1014 Cph. K
  (*) \(*) -- University of Copenhagen   Denmark 
 Ph:  (+45) 35327918
 ~~ - ([EMAIL PROTECTED]) 
 FAX: (+45) 35327907
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained,
 reproducible code.
 



 

Food fight? Enjoy some healthy debate

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] gls bug?

2007-03-29 Thread Prof Brian Ripley
On Fri, 16 Mar 2007, simon bond wrote:

 I found that the following code crashes R (version 2.4.0 in windows).

 x=rnorm(10,0.1,1)
 library(nlme)
 gls(x~0)

 I quickly found a work-around for what I was trying to do, but I thought 
 I should report this.

This will be fixed (to give a sensible non-fatal error message) in nlme 
3.1-80.

If you are still using 2.4.0 you probably have not updated your 
recommended packages either: please use sessionInfo() in bug reports as
requested in the R posting guide.

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

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] C interface

2007-03-29 Thread ronggui
On 3/29/07, Prof Brian Ripley [EMAIL PROTECTED] wrote:
 We don't know what document that is, and you haven't given us a useful
 pointer, have you?  And the authors (presumably Roger Peng and Jan de
 Leeuw) deserve credit.
It is a great point. I have googled and confirm that the authors are
Roger Peng and Jan de
Leeuw. Here is the link
http://www.biostat.jhsph.edu/~rpeng/docs/interface.pdf

 The definitive documentation is the 'Writing R Extensions' manual which
 ships with R.  There is also a lot in 'S Programming' (see the books in
 the FAQ), and many examples in the R sources and contributed packages.

 On Thu, 29 Mar 2007, [EMAIL PROTECTED] wrote:

 
  Hi All
  I have read this document - An Introduction to the .C Interface to R,
  which primarily tells how to interface C language with R.
  Is there and more elaborative and online documentation regarding this
  interface.
 
  Any pointers appreciated
  -thanks
  -gaurav
 
  
  DISCLAIMER AND CONFIDENTIALITY CAUTION:\ \ This message and ...{{dropped}}
 
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.
 

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

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.



-- 
Ronggui Huang
Department of Sociology
Fudan University, Shanghai, China

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Fanny Clustering

2007-03-29 Thread Sergio Della Franca
Dear R-Helpers,


I'd like to develop a fanny clustering on my data set(70.000 rows), but when
i run the procedure i obtain this error:

error in vector(double, lenght): too big dimension for
the selected vector.


How can i solve this problem?


Thank you in advance.


Sergio Della Franca.

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Fanny Clustering

2007-03-29 Thread Philippe Grosjean
1) Reduce the size of your sample (random or stratified subsampling),

2) Increase the memory of your computer available to R.

Best,

Philippe Grosjean

..°}))
  ) ) ) ) )
( ( ( ( (Prof. Philippe Grosjean
  ) ) ) ) )
( ( ( ( (Numerical Ecology of Aquatic Systems
  ) ) ) ) )   Mons-Hainaut University, Belgium
( ( ( ( (
..

Sergio Della Franca wrote:
 Dear R-Helpers,
 
 
 I'd like to develop a fanny clustering on my data set(70.000 rows), but when
 i run the procedure i obtain this error:
 
 error in vector(double, lenght): too big dimension for
 the selected vector.
 
 
 How can i solve this problem?
 
 
 Thank you in advance.
 
 
 Sergio Della Franca.
 
   [[alternative HTML version deleted]]
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] creating conditional list of elements

2007-03-29 Thread murali . menon
Sorry to plague the list, but I think I got the answer. The following 
would do:

 signalList - list(tradingRules$Signal[tradingRules$Enabled]) [[1]]
 length(signalList)
[1] 2

Now my problem is shifted: I have the Signal column in the original data 
frame referring to actual 
matrices previously created in R. That is, bar_signal and cif_signal are 
extant matrices. What I 
need is the minimum number of rows in these matrices, so what I plan to do 
is:

 n - min(sapply(signalList, NROW))

but this doesn't work (it returns 1, but I have 2800 rows in each of 
bar_signal and cif_signal, so I should
get 2800)

Is there a smart way to do this? And is there a way to tell R that the 
entries in the Signal column 
of tradingSignal are the names of objects?

Thanks,
Murali



Murali Menon/GB/ABNAMRO/NL 
29/03/2007 11:13

To
r-help@stat.math.ethz.ch
cc

Subject
creating conditional list of elements





Folks,

I have a matrix as follows (first column is the rownames, first row is the 
columnnames)

RuleEnabled Signal
Foo False   foo_signal
Bar Truebar_signal
Gum False   gum_signal
Cif Truecif_signal

I would like to create a list of only those signals whose 'enabled' flag 
is True. So in the above 
case I should end up with

signalList = bar_signal, cif_signal

Likewise, if the enabled flags were all set to False, then signalList 
should be an empty list.

What's a good way to achieve this, please?

Thanks,

Murali



---
This message (including any attachments) is confidential and...{{dropped}}

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Fanny Clustering

2007-03-29 Thread Sergio Della Franca
Ok,

How can i increase the memory of your computer available to R?


2007/3/29, Philippe Grosjean [EMAIL PROTECTED]:

 1) Reduce the size of your sample (random or stratified subsampling),

 2) Increase the memory of your computer available to R.

 Best,

 Philippe Grosjean

 ..°}))
 ) ) ) ) )
 ( ( ( ( (Prof. Philippe Grosjean
 ) ) ) ) )
 ( ( ( ( (Numerical Ecology of Aquatic Systems
 ) ) ) ) )   Mons-Hainaut University, Belgium
 ( ( ( ( (
 ..

 Sergio Della Franca wrote:
  Dear R-Helpers,
 
 
  I'd like to develop a fanny clustering on my data set(70.000 rows), but
 when
  i run the procedure i obtain this error:
 
  error in vector(double, lenght): too big dimension for
  the selected vector.
 
 
  How can i solve this problem?
 
 
  Thank you in advance.
 
 
  Sergio Della Franca.
 
[[alternative HTML version deleted]]
 
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.
 


[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Fanny Clustering

2007-03-29 Thread Philippe Grosjean


Sergio Della Franca wrote:
 Ok,
 
 How can i increase the memory of your computer available to R?

Well, if you would like to increase memory of MY computer... you are 
welcome to do so... but I doubt it would be of any use for you ;-)

You don't tell us how much RAM you have currently, which platform you 
use, etc... The general approach is to use a computer with more RAM, up 
to the limit permitted by a 32-bit system for R, and then, to switch to 
a 64-bit version under Linux, if you need even more RAM.

The other proposed solution is not stupid. With 70.000 cases, you have a 
fairly large dataset. You don't tell use how many groups you expect from 
your clustering, but it is often better to use a couple of tens, or 
hundreds of representative cases for each group, no more. In supervised 
classification, it is easier to build such a training set with 
relatively balanced number of items in each group, because targeted 
classification is known a priori from the manual classification provided.

With unsupervised classification, you could either try a pure random 
subsampling, or select your subsample based on similarity according to a 
given distance measurement. I did something like that using a 
Malahanobis distance, MDS, and then, stratified subsampling inside a 
regular grid placed on top of the MDS plot.

Otherwise, I am not a specialist of unsupervised classification, and 
other people here could have better suggestion.

Best,

Philippe Grosjean

 
 2007/3/29, Philippe Grosjean [EMAIL PROTECTED]:
 1) Reduce the size of your sample (random or stratified subsampling),

 2) Increase the memory of your computer available to R.

 Best,

 Philippe Grosjean

 ..°}))
 ) ) ) ) )
 ( ( ( ( (Prof. Philippe Grosjean
 ) ) ) ) )
 ( ( ( ( (Numerical Ecology of Aquatic Systems
 ) ) ) ) )   Mons-Hainaut University, Belgium
 ( ( ( ( (
 ..

 Sergio Della Franca wrote:
 Dear R-Helpers,


 I'd like to develop a fanny clustering on my data set(70.000 rows), but
 when
 i run the procedure i obtain this error:

 error in vector(double, lenght): too big dimension for
 the selected vector.


 How can i solve this problem?


 Thank you in advance.


 Sergio Della Franca.

   [[alternative HTML version deleted]]

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

 
   [[alternative HTML version deleted]]
 
 
 
 
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] composed matrices

2007-03-29 Thread Eva Ubl
I have just started programming in R and so my question might be basic but
I cant find it in the manual
I have four matrices A,B,C and D and want them to compose in a big matrix X
with A in the upper left corner, B in the right upper corner, c below A
and D below B.
Thanks for your help
eva

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] composed matrices

2007-03-29 Thread Dimitris Rizopoulos
try this:

A1 - matrix(1:20, 5, 4)
B1 - matrix(1:15, 5, 3)
A2 - matrix(1:8, 2, 4)
B2 - matrix(1:6, 2, 3)
#
rbind(cbind(A1, B1), cbind(A2, B2))


I hope it helps.

Best,
Dimitris


Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven

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


- Original Message - 
From: Eva Ubl [EMAIL PROTECTED]
To: r-help@stat.math.ethz.ch
Sent: Thursday, March 29, 2007 1:10 PM
Subject: [R] composed matrices


I have just started programming in R and so my question might be 
basic but
 I cant find it in the manual
 I have four matrices A,B,C and D and want them to compose in a big 
 matrix X
 with A in the upper left corner, B in the right upper corner, c 
 below A
 and D below B.
 Thanks for your help
 eva

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide 
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 


Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] composed matrices

2007-03-29 Thread Chuck Cleland
Eva Ubl wrote:
 I have just started programming in R and so my question might be basic but
 I cant find it in the manual
 I have four matrices A,B,C and D and want them to compose in a big matrix X
 with A in the upper left corner, B in the right upper corner, c below A
 and D below B.

A - matrix(1:4, ncol=2)
B - matrix(5:8, ncol=2)
C - matrix(9:12, ncol=2)
D - matrix(13:16, ncol=2)

rbind(cbind(A,B), cbind(C,D))
 [,1] [,2] [,3] [,4]
[1,]1357
[2,]2468
[3,]9   11   13   15
[4,]   10   12   14   16

?rbind
?cbind

 Thanks for your help
 eva
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

-- 
Chuck Cleland, Ph.D.
NDRI, Inc.
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 512-0171 (M, W, F)
fax: (917) 438-0894

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] equivalent datatypes

2007-03-29 Thread Schmitt, Corinna
Hallo,

can anyone help me with datatypes? Which datatypes from R are equivalent
to the following ones from C?

C datatypes:

- double array
- struct array
- cell array
- char array
- logical array

Thanks, Corinna

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Tail area of sum of Chi-square variables

2007-03-29 Thread S Ellison
 I was wondering if there are any R functions that give the tail area
 of a sum of chisquare distributions of the type:
 a_1 X_1 + a_2 X_2
 where a_1 and a_2 are constants and X_1 and X_2 are independent 
 chi-square variables with different degrees of freedom.

You might also check out Welch and Satterthwaite's (separate) papers on 
effective degrees of freedom for compound estimates of variance, which led to a 
thing called the welch-satterthwaite equation by one (more or less notorious, 
but widely used) document called the ISO Guide to Expression of Uncertainty in 
Measurement (ISO, 1995). The original papers are
B. L. Welch, J. Royal Stat. Soc. Suppl.(1936)  3 29-48
B. L. Welch, Biometrika, (1938) 29 350-362
B. L. Welch, Biometrika, (1947) 34 28-35

F. E. Satterthwaite, Psychometrika (1941) 6 309-316
F. E. Satterthwaite, Biometrics Bulletin, (1946) 2 part 6 110-114

The W-S equation - which I believe is a special case of Welch's somewhat more 
general treatment - says that if you have multiple independent estimated 
variances v[i] (could be more or less equivalent to your a_i X_i?) with degrees 
of freedom nu[i], the distribution of their sum is approximately a scaled 
chi-squared distribution with effective degrees of freedom nu.effective given by

nu.effective =  sum(v[i])^2 / sum((v[i]^2)/nu[i] )

If I recall correctly, with an observed variance s^2 (corresponding to the 
sum(v[i] above if those are observed varianes), nu*(s^2 /sigma^2) is 
distributed as chi-squared with degrees of freedom nu, so the scaling factor 
for quantiles would come out of there (depending whether you're after the tail 
areas for s^2 given sigma^2 or for a confidence interval for sigma^2 given s^2)

However, I will be most interested to see what a more exact calculation 
provides!

Steve Ellison


***
This email and any attachments are confidential. Any use, co...{{dropped}}

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] equivalent datatypes

2007-03-29 Thread Duncan Murdoch
On 3/29/2007 6:45 AM, Schmitt, Corinna wrote:
 Hallo,
 
 can anyone help me with datatypes? Which datatypes from R are equivalent
 to the following ones from C?

I assume you mean functionally equivalent; if you mean equivalent in 
storage so you can pass them to C functions, see the Writing R 
Extensions manual.
 
 C datatypes:
 
 - double array

A numeric vector.

 - struct array

R has no exact equivalent.  A struct is similar to a list, but there is 
no enforcement of types in a list.  You could also implement a struct as 
an S4 object to get some type safety.  An array of structs would usually 
be done in R as a list of arrays, but could be done as a list of lists.

 - cell array

I don't know what a cell is in C.

 - char array

A single element character vector.

 - logical array

A logical vector.

Duncan Murdoch

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] what is the difference between survival analysis and (...)

2007-03-29 Thread Frank E Harrell Jr
Thomas Lumley wrote:
 On Wed, 28 Mar 2007, Frank E Harrell Jr wrote:
 
 Eric Elguero wrote:
 Hi everybody,

 recently I had to teach a course on Cox model, of which I am
 not a specialist, to an audience of medical epidemiologists.
 Not a good idea you might say.. anyway, someone in the
 audience was very hostile. At some point, he sayed that
 Cox model was useless, since all you have to do is count
 who dies and who survives, divide by the sample sizes
 and compute a relative risk, and if there was significant
 censoring, use cumulated follow-up instead of sample
 sizes and that's it!
 I began arguing that in Cox model you could introduce
 several variables, interactions, etc, then I remembered
 of logistic models ;-)
 The only (and poor) argument I could think of was that
 if mr Cox took pains to devise his model, there should
 be some reason...

 That is a very ignorant person, concerning statistical
 efficiency/power/precision and how to handle incomplete follow-up
 (variable follow-up duration).  There are papers in the literature (I
 wish I had them at my fingertips) that go into the efficiency loss of
 just counting events.  If the events are very rare, knowing the time
 doesn't help as much, but the Cox model still can handle censoring
 correctly and that person's approach doesn't.

 
 Certainly just counting the events is inefficient -- the simplest 
 example would be studies of some advanced cancers where nearly everyone 
 dies during followup, so that there is little or no censoring but simple 
 counts are completely uninformative.
 
 It's relatively hard to come up with an example where using the 
 total-time-on-test (rather than sample size) as a denominator is much 
 worse than the Cox mode, though. You need the baseline hazard to vary a 
 lot over time and the censoring patterns to be quite different in the 
 groups, but proportional hazards to still hold.
 
 I think the advantages of the Cox model over a reasonably sensible 
 person-time analysis are real, but not dramatic -- it would be hard to 
 find a data set that would convince the sort of person who would make 
 that sort of claim.
 
 I would argue that computational convenience on the one hand, and the 
 ability to exercise lots of nice mathematical tools on the other hand 
 have also contributed to the continuing popularity of the Cox model.
 
 
 -thomas
 
 Thomas LumleyAssoc. Professor, Biostatistics
 [EMAIL PROTECTED]University of Washington, Seattle
 
 
 

Nicely put Thomas.  I have seen examples from surgical research where 
the hazard function is bathtub shaped and the epidemiologist's use of 
the exponential distribution is very problematic.  I have also seen 
examples in acute illness and medical treatment where time until death 
is important even with only 30-day follow-up.

Frank

-- 
Frank E Harrell Jr   Professor and Chair   School of Medicine
  Department of Biostatistics   Vanderbilt University

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] creating conditional list of elements

2007-03-29 Thread murali . menon
John,

Thanks, that works nicely. Didn't know about 'get'. 

Onwards and upwards! :-)
Cheers,
Murali




John James [EMAIL PROTECTED] 
29/03/2007 12:40

To
[EMAIL PROTECTED]
cc

Subject
RE: [R] creating conditional list of elements






Murali

If sm is your orginal matrix
# such that 
 sm[sm$Enabled,]$Signal
[1] bar_signal cif_signal 

# and
bar_signal - matrix(rnorm(100), nrow=5, ncol=20)
cif_signal - matrix(rnorm(60), nrow=12, ncol=5)

# then...
sapply(sm[sm$Enabled,]$Signal, function(x){NROW(get(x))})
bar_signal cif_signal 
 5 12

Hope this helps

John James
Mango Solutions

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: 29 March 2007 11:40
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] creating conditional list of elements

Sorry to plague the list, but I think I got the answer. The following 
would do:

 signalList - list(tradingRules$Signal[tradingRules$Enabled]) [[1]]
 length(signalList)
[1] 2

Now my problem is shifted: I have the Signal column in the original data 
frame referring to actual 
matrices previously created in R. That is, bar_signal and cif_signal are 
extant matrices. What I 
need is the minimum number of rows in these matrices, so what I plan to do 

is:

 n - min(sapply(signalList, NROW))

but this doesn't work (it returns 1, but I have 2800 rows in each of 
bar_signal and cif_signal, so I should
get 2800)

Is there a smart way to do this? And is there a way to tell R that the 
entries in the Signal column 
of tradingSignal are the names of objects?

Thanks,
Murali



Murali Menon/GB/ABNAMRO/NL 
29/03/2007 11:13

To
r-help@stat.math.ethz.ch
cc

Subject
creating conditional list of elements





Folks,

I have a matrix as follows (first column is the rownames, first row is the 

columnnames)

RuleEnabled Signal
Foo False   foo_signal
Bar Truebar_signal
Gum False   gum_signal
Cif Truecif_signal

I would like to create a list of only those signals whose 'enabled' flag 
is True. So in the above 
case I should end up with

signalList = bar_signal, cif_signal

Likewise, if the enabled flags were all set to False, then signalList 
should be an empty list.

What's a good way to achieve this, please?

Thanks,

Murali



---
This message (including any attachments) is confidential and...{{dropped}}

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.





---
This message (including any attachments) is confidential and...{{dropped}}

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Kmeans centers

2007-03-29 Thread Sergio Della Franca
Dear R-Helpers,

I read in the R documentation, about kmeans:

  centers

Either the number of clusters or a set of initial (distinct) cluster
centres. *If a number*, a random set of (distinct) rows in x is chosen as
the initial centres.
My question is: could it be possible that the centers are character and not
number?


Thank you in advance.


Sergio Della Franca

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Large matrix into a vector

2007-03-29 Thread Marc Schwartz
On Thu, 2007-03-29 at 02:12 -0700, A Ezhil wrote:
 Hi All,
 
 Thank you very much for all your suggestions. It's a
 great learning for me. All the three suggested
 solutions seem working. I don't know what 'side
 effects' that you were talking about. 

As Peter noted, the phrase 'side effect' may be sub-optimal. 

However, I would use the interpretation that in this case, the removal
of dim attributes on a single object as a consequence of the use of c(),
though documented, is not the primary intended purpose of the function.

Stated differently, perhaps in a manner consistent with Prof. Ripley's
reply, the coercion of a matrix to a vector by the use of c(), is
applying a function to an object to gain the benefit of behavior that is
secondary to the intended functionality of combining objects.

 To summarize the
 responses:
 
  s - read.table(sample.txt, sep=\t)
  s1 - as.matrix(s)
  s1
 V1   V2   V3
 1 0.59 0.47 0.44
 2 0.85 0.42 0.57
 3 0.48 0.57 0.57
 4 0.61 0.24 0.24
 5 0.38 0.21 0.36
 6 0.65 0.42 1.50
 7 0.49 0.23 0.42
 8 0.60 0.51 0.53
 9 0.00 0.00 0.00
 
  s2 - as.vector(s1)
  s2
  [1] 0.59 0.85 0.48 0.61 0.38 0.65 0.49 0.60 0.00 0.47
 0.42 0.57 0.24 0.21 0.42 0.23 0.51 0.00 0.44 0.57 0.57
 0.24 0.36
 [24] 1.50 0.42 0.53 0.00
  s3 - c(s1)
  s3
  [1] 0.59 0.85 0.48 0.61 0.38 0.65 0.49 0.60 0.00 0.47
 0.42 0.57 0.24 0.21 0.42 0.23 0.51 0.00 0.44 0.57 0.57
 0.24 0.36
 [24] 1.50 0.42 0.53 0.00
  s3 - s1
  dim(s3) - NULL
  s3
  [1] 0.59 0.85 0.48 0.61 0.38 0.65 0.49 0.60 0.00 0.47
 0.42 0.57 0.24 0.21 0.42 0.23 0.51 0.00 0.44 0.57 0.57
 0.24 0.36
 [24] 1.50 0.42 0.53 0.00
 
 Interestingly, if I apply the same three solutions to
 the data.frame 's', the results are different: (1)
 as.vector() keeps the data frame as it is. (2) c()
 changes into lists, and (3) making dim() - NULL keeps
 as structure. 

That's because the underlying structure of a data frame is a list,
whereas a matrix is a vector.

HTH,

Marc

snip

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] using alpha transparency for lines in levelplot - SUMMARY

2007-03-29 Thread Kevin Wright
I reported a similar issue with Adobe Reader in a thread starting here:
http://tolstoy.newcastle.edu.au/R/e2/devel/06/10/0706.html

K Wright



On 3/27/07, Michael Sumner [EMAIL PROTECTED] wrote:
 Hello, thanks to Deepayan Sarkar for sorting me out on this one.

 The problem with transparent lines affecting region colour in lattice
 plot appears
 when using Adobe Reader (v 8 in my case). I've only viewed the file on
 Windows XP.

 I've tried using Foxit Reader to view the file and there's no problem.

 Cheers, Mike.

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Tail area of sum of Chi-square variables

2007-03-29 Thread Thomas Lumley
On Thu, 29 Mar 2007, Klaus Nordhausen wrote:

 I was wondering if there are any R functions that give the tail area
 of a sum of chisquare distributions of the type:
 a_1 X_1 + a_2 X_2
 where a_1 and a_2 are constants and X_1 and X_2 are independent chi-square 
 variables with different degrees of freedom.


pchisqsum() in the survey package does this.

-thomas

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

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] two questions about ccf

2007-03-29 Thread tom soyer
Hi,

I have two questions about ccf. 1) does it return correlation value for each
lag? The documentation states the following: The lag is returned and
plotted in units of time, and not numbers of observations. There are
printand subsetting methods for objects of class
acf . Does this mean only lag values are returned, and if plot is turned
off, then we won't know the calculated correlation value for each lag? Is
there a way to display both the lag and its corresponding correlation value
in text? 2) Is the lag used for ccf always in units of time? The
documentation states: The lag is returned and plotted in units of time, and
not numbers of observations.. This makes sense for acf, but does ccf lag
also use units of time instead of observations?

Thanks,

Tom

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Kmeans centers

2007-03-29 Thread Gavin Simpson
On Thu, 2007-03-29 at 15:02 +0200, Sergio Della Franca wrote:
 Dear R-Helpers,
 
 I read in the R documentation, about kmeans:
 
   centers
 
 Either the number of clusters or a set of initial (distinct) cluster
 centres. *If a number*, a random set of (distinct) rows in x is chosen as
 the initial centres.
 My question is: could it be possible that the centers are character and not
 number?

I think you misunderstand - centers is the number of clusters you want
to partition your data into. How else would you specify the number of
clusters other than by a number? So no, it has to be a numeric number.

The alternative use of centers is to provide known starting points for
the algorithm, such as from the results of a hierarchical cluster
analysis, that are the locations of the cluster centroids, for each
cluster, on each of the feature variables.

Also, argument x to kmeans() is specific about requiring a numeric
matrix (or something coercible to one), so characters here are not
allowed either.

But then again, I may not have understood what it is that you are
asking, but that is not surprising given that you have not provided an
example of what you are trying to do, and how you tried to do it but
failed.

 and provide commented, minimal, self-contained, reproducible code.
  ^^^
G
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Gavin Simpson [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,  [f] +44 (0)20 7679 0565
 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London  [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT. [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Bonferroni p-value greater than 1

2007-03-29 Thread Horace Tso
Thank you John and Peter.

Peter, yes I'm guilty of tacking onto a random mail. I thought you couldn't 
tell since I got ride of the text from the last mail. Apologize.

H.

 John Fox [EMAIL PROTECTED] 3/28/2007 5:37 PM 
Dear Horace,

The Bonferonni p-value is obtained from the unadjusted p-value by
multiplying the latter by the number of observations, and provides a
conservative (although usually quite accurate) outlier test. When the
adjusted p-value exceeds 1 you can take that as an indication that there are
no unusually large studentized residuals (and indeed that the largest
studentized residual is smaller than one would expect under the standard
linear-model assumptions). 

I hope this helps,
 John


John Fox
Department of Sociology
McMaster University
Hamilton, Ontario
Canada L8S 4M4
905-525-9140x23604
http://socserv.mcmaster.ca/jfox 
 

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Horace Tso
 Sent: Wednesday, March 28, 2007 6:36 PM
 To: 'R R-help'
 Subject: [R] Bonferroni p-value greater than 1
 
 Hi folks,
 
 I use the outlier.test in package car to test a lm model and 
 the bonferroni p value returned is shown as NA. When the 
 object is typed it indicates the p value is greater than 1. 
 I'm not sure how to interpret it. 
 
 Thanks in advance.
 
 Horace W. Tso
 
 
  outlier.test(mod)$test
 max|rstudent|df  unadjusted p  Bonferroni p
2.04106376   18.0.05618628NA 
 
  outlier.test(mod)
 
 max|rstudent| = 2.041064, degrees of freedom = 18,
 unadjusted p = 0.05618628, Bonferroni p  1
 
 Observation: 1 
 
 The lm model looks fine to me,
 
  summary(mod)
 
 Call:
 lm(formula = x ~ ind, na.action = na.fail)
 
 Residuals:
 Min  1Q  Median  3Q Max 
 -1.2082 -0.5200  0.1309  0.5725  0.9593 
 
 Coefficients:
 Estimate Std. Error t value Pr(|t|)
 (Intercept) 59.845860.31900   187.6   2e-16 ***
 ind -0.167680.02541-6.6 2.57e-06 ***
 ---
 Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 
 
 Residual standard error: 0.705 on 19 degrees of freedom
 Multiple R-Squared: 0.6963, Adjusted R-squared: 0.6803 
 F-statistic: 43.56 on 1 and 19 DF,  p-value: 2.57
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help 
 PLEASE do read the posting guide 
 http://www.R-project.org/posting-guide.html 
 and provide commented, minimal, self-contained, reproducible code.


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] tcltk, tclRequire and Tktable help

2007-03-29 Thread Alberto Monteiro
I know almost nothing about the tcltk library, and the
documentation seems very poor. What's the meaning of this
error, and is there any way to fix it? I'm running R 2.4.1
in a Windows XP machine where I have almost no privileges
(but at home I am the Evil Overlord of a Linux machine...)

library(tcltk)
tclRequire(Tktable)
# [1] FALSE
# Warning message:
# Tcl package 'Tktable' not found in: tclRequire(Tktable) 

Alberto Monteiro

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] E-Mail/Post Threading (was: Bonferroni p-value greater than 1)

2007-03-29 Thread Marc Schwartz
On Thu, 2007-03-29 at 09:51 -0700, Horace Tso wrote:
 Thank you John and Peter.
 
 Peter, yes I'm guilty of tacking onto a random mail. I thought you
 couldn't tell since I got ride of the text from the last mail.
 Apologize.
 
 H.

Just a quick heads up here, that deleting the body text of a message or
changing the subject line, does not alter the 'linkage' between posts.

There are standards for how messages are 'threaded' and largely have to
do with the e-mail headers, not the e-mail content.

A couple of quick references that might be helpful:

http://people.dsv.su.se/~jpalme/ietf/message-threading.html

http://www.jwz.org/doc/threading.html


HTH,

Marc Schwartz

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] pipe Apple

2007-03-29 Thread A. Beaujean
Hi,

I have a student trying to run R on an Apple (OS 10.3.9). She tried to
cut-and-paste the data via the code:
data-read.table(pipe(pbpaste))

But she keeps getting the error message:
'error in pipe(pbpaste):  pipe connections are not available on this
system'

I do not know much about using an Apple. Has anyone run into this before?
Does anyone have any ideas for how to fix the problem?

Thanks!

Alex

-- 
***
A. Alexander Beaujean, Ph.D., LSSP
Licensed Psychologist (Provisional, TX)
http://myprofile.cos.com/abeaujean
http://www.baylor.edu/soe/faculty/index.php?id=38476


General impressions are never to be trusted. Unfortunately when they are of
long standing they become fixed rules of life, and assume a prescriptive
right not to be questioned. Consequently those who are not accustomed to
original inquiry entertain a hatred and a horror of statistics. They cannot
endure the idea of submitting their sacred  impressions to cold-blooded
verification. But it is the triumph of scientific men to rise superior to
such superstitions, to devise tests by which the value of beliefs may be
ascertained, and to feel sufficiently masters of themselves to discard
contemptuously whatever may be found untrue. --Sir Francis Galton, FRS

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] tcltk crashing R after the (ab)use of tkwait

2007-03-29 Thread Alberto Monteiro
Running this:

library(tcltk)
tt - tktoplevel()
done - tclVar(0)
but - tkbutton(tt, text=OK, command=function() tclvalue(done) - 1)
tkpack(but)
tkwait.variable(done)

works as fine as long as I click the OK. However, if I close
the window (by clicking in the X), R enters into an infinite loop
and there's no way of returning except by closing the R window.

Why? What am I doing wrong?

Alberto Monteiro

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] E-Mail/Post Threading (was: Bonferroni p-value greater t

2007-03-29 Thread Ted Harding
On 29-Mar-07 17:15:27, Marc Schwartz wrote:
 [...]
 Just a quick heads up here, that deleting the body text of
 a message or changing the subject line, does not alter the
 'linkage' between posts.
 
 There are standards for how messages are 'threaded' and largely
 have to do with the e-mail headers, not the e-mail content.
 
 A couple of quick references that might be helpful:
 
 http://people.dsv.su.se/~jpalme/ietf/message-threading.html
 
 http://www.jwz.org/doc/threading.html

This above, of course, is a good reason for not replying to an
existing message when you want to start a completely new thread.

However, I'm wondering what is the best way to start a new thread
which legitimately branches out from an existing one.

For example, someone posts a message which discusses at length a
method of isotonic binary regression, and in the middle of this
describes a curious approach to obtaining confidence bands for
the regression. I'm intrigued by the confidence band issue, get
some ideas about it, and want to start a new thread to develop
just this aspect.

However, to do so I want in the first place to include several
quotations from the original message. This, of course, is most
easily done by replying to that message -- so that it gets included
in the reply -- and editing this included message, and changing
the subject.

But that stays in the old thread, which I don't want. Now of course
one can copy over the old text into a brand new blank message,
and edit it up into a simulacrum of a reply -- all the usual
On NN March 2007, XXX wrote: ... as well as the   inclusion
markers, etc.. But that could be tedious. Nevertheless, perhaps
it is the right thing to do -- unless there's a work-round using
the reply mechanism?

Best wishes to all,
Ted.


E-Mail: (Ted Harding) [EMAIL PROTECTED]
Fax-to-email: +44 (0)870 094 0861
Date: 29-Mar-07   Time: 19:37:54
-- XFMail --

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Tail area of sum of Chi-square variables

2007-03-29 Thread Thomas Lumley

The Satterthwaite approximation is surprisingly good, especially in the 
most interesting range in the right tail (say 0.9 to 0.999). There is also 
another, better, approximation with a power of a chi-squared distribution 
that has been used in the survey literature.

However, since it is easy to write down the characteristic function and 
perfectly feasible to invert it by numerical integration, we might as well 
use the right answer.

-thomas

On Thu, 29 Mar 2007, S Ellison wrote:
 I was wondering if there are any R functions that give the tail area
 of a sum of chisquare distributions of the type:
 a_1 X_1 + a_2 X_2
 where a_1 and a_2 are constants and X_1 and X_2 are independent
 chi-square variables with different degrees of freedom.

 You might also check out Welch and Satterthwaite's (separate) papers on 
 effective degrees of freedom for compound estimates of variance, which led to 
 a thing called the welch-satterthwaite equation by one (more or less 
 notorious, but widely used) document called the ISO Guide to Expression of 
 Uncertainty in Measurement (ISO, 1995). The original papers are
 B. L. Welch, J. Royal Stat. Soc. Suppl.(1936)  3 29-48
 B. L. Welch, Biometrika, (1938) 29 350-362
 B. L. Welch, Biometrika, (1947) 34 28-35

 F. E. Satterthwaite, Psychometrika (1941) 6 309-316
 F. E. Satterthwaite, Biometrics Bulletin, (1946) 2 part 6 110-114

 The W-S equation - which I believe is a special case of Welch's somewhat more 
 general treatment - says that if you have multiple independent estimated 
 variances v[i] (could be more or less equivalent to your a_i X_i?) with 
 degrees of freedom nu[i], the distribution of their sum is approximately a 
 scaled chi-squared distribution with effective degrees of freedom 
 nu.effective given by

 nu.effective =  sum(v[i])^2 / sum((v[i]^2)/nu[i] )

 If I recall correctly, with an observed variance s^2 (corresponding to the 
 sum(v[i] above if those are observed varianes), nu*(s^2 /sigma^2) is 
 distributed as chi-squared with degrees of freedom nu, so the scaling factor 
 for quantiles would come out of there (depending whether you're after the 
 tail areas for s^2 given sigma^2 or for a confidence interval for sigma^2 
 given s^2)

 However, I will be most interested to see what a more exact calculation 
 provides!

 Steve Ellison


 ***
 This email and any attachments are confidential. Any use, co...{{dropped}}

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


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

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Tail area of sum of Chi-square variables

2007-03-29 Thread Peter Dalgaard
S Ellison wrote:
 I was wondering if there are any R functions that give the tail area
 of a sum of chisquare distributions of the type:
 a_1 X_1 + a_2 X_2
 where a_1 and a_2 are constants and X_1 and X_2 are independent 
 chi-square variables with different degrees of freedom.
 

 You might also check out Welch and Satterthwaite's (separate) papers on 
 effective degrees of freedom for compound estimates of variance, which led to 
 a thing called the welch-satterthwaite equation by one (more or less 
 notorious, but widely used) document called the ISO Guide to Expression of 
 Uncertainty in Measurement (ISO, 1995). The original papers are
 B. L. Welch, J. Royal Stat. Soc. Suppl.(1936)  3 29-48
 B. L. Welch, Biometrika, (1938) 29 350-362
 B. L. Welch, Biometrika, (1947) 34 28-35

 F. E. Satterthwaite, Psychometrika (1941) 6 309-316
 F. E. Satterthwaite, Biometrics Bulletin, (1946) 2 part 6 110-114

 The W-S equation - which I believe is a special case of Welch's somewhat more 
 general treatment - says that if you have multiple independent estimated 
 variances v[i] (could be more or less equivalent to your a_i X_i?) with 
 degrees of freedom nu[i], the distribution of their sum is approximately a 
 scaled chi-squared distribution with effective degrees of freedom 
 nu.effective given by

 nu.effective =  sum(v[i])^2 / sum((v[i]^2)/nu[i] )

 If I recall correctly, with an observed variance s^2 (corresponding to the 
 sum(v[i] above if those are observed varianes), nu*(s^2 /sigma^2) is 
 distributed as chi-squared with degrees of freedom nu, so the scaling factor 
 for quantiles would come out of there (depending whether you're after the 
 tail areas for s^2 given sigma^2 or for a confidence interval for sigma^2 
 given s^2)

 However, I will be most interested to see what a more exact calculation 
 provides!
   

I believe this is also in Box, 1954, in the guise of sums of squares
under heteroscedsticity and correlation.

@Article{box54ptI,
  author =   {G. E. P. Box},
  title ={Some Theorems on Quadratic Forms Applied in the
  Study of Analysis of Variance Problems, I. Effect of
  Inequality of Variance in the One-Way
  Classification},
  journal =  {Annals of Mathematical Statistics},
  year = 1954,
  volume =   25,
  number =   2,
  pages ={290-302}
}

IIRC (I seem to have temporarily misplaced the actual paper...), there
is a trick by which the characteristic function of a linear combination
of chi-squared variables can be expanded in a  (weighted) _sum_ of
chisquare characteristic functions, which gives you an exact expression
for the density and CDF.   

 Steve Ellison


 ***
 This email and any attachments are confidential. Any use, co...{{dropped}}

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
   


-- 
   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - ([EMAIL PROTECTED])  FAX: (+45) 35327907

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] tcltk crashing R after the (ab)use of tkwait

2007-03-29 Thread Dieter Menne
Alberto Monteiro albmont at centroin.com.br writes:

 library(tcltk)
 tt - tktoplevel()
 done - tclVar(0)
 but - tkbutton(tt, text=OK, command=function() tclvalue(done) - 1)
 tkpack(but)
 tkwait.variable(done)
 
 works as fine as long as I click the OK. However, if I close
 the window (by clicking in the X), R enters into an infinite loop
 and there's no way of returning except by closing the R window.
 
Works for me with R-2.4.1 on Windows 2000. So better tell us about the details
of your operating system.

Dieter

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] equivalent datatypes

2007-03-29 Thread Dieter Menne
Duncan Murdoch murdoch at stats.uwo.ca writes:

 
 On 3/29/2007 6:45 AM, Schmitt, Corinna wrote:
  - cell array
 
 I don't know what a cell is in C.
 

This is MathLabish.

Dieter

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Xemacs, ESS, R config issue

2007-03-29 Thread c n
I've searched for 45 minutes, apparently in all the wrong places for a
solution to a configuration issue I'm having.

When I use Xemacs with ESS running in R-mode, and I type a - character, it
autocompletes it to - .  How do I disable this annoying feature?

Thanks much.

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] tcltk crashing R after the (ab)use of tkwait

2007-03-29 Thread Alberto Monteiro
Dieter Menne wrote:
 
 library(tcltk)
 tt - tktoplevel()
 done - tclVar(0)
 but - tkbutton(tt, text=OK, command=function() tclvalue(done) - 1)
 tkpack(but)
 tkwait.variable(done)
 
 works as fine as long as I click the OK. However, if I close
 the window (by clicking in the X), R enters into an infinite loop
 and there's no way of returning except by closing the R window.
 
 Works for me with R-2.4.1 on Windows 2000. So better tell us about 
 the details of your operating system.

R 2.4.1 on Windows XP. Should they work differently?

Alberto Monteiro

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Regarding Vista

2007-03-29 Thread Dieter Menne
 christian.ritter at shell.com writes:

 The Vista issue is not innocent as it threatens the life of R within large
corporations. So any posts on how R
 runs under Vista and what has to be done to make it work and what cannot be
done etc will be very useful. 

Main problem seems to be the installation of chm-files when upgrading. I had to
switch off all security mechanisms to get it done. Which is probably not what
you would like to have in a corporate environment.

As a temporary workaround, it would probably be best to optionally disable chm
installation. Or do a poll if is is required, after all it's considered a legacy
format nowadays.

Dieter

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] E-Mail/Post Threading (was: Bonferroni p-value greater t

2007-03-29 Thread Marc Schwartz
On Thu, 2007-03-29 at 19:38 +0100, [EMAIL PROTECTED] wrote:
 On 29-Mar-07 17:15:27, Marc Schwartz wrote:
  [...]
  Just a quick heads up here, that deleting the body text of
  a message or changing the subject line, does not alter the
  'linkage' between posts.
  
  There are standards for how messages are 'threaded' and largely
  have to do with the e-mail headers, not the e-mail content.
  
  A couple of quick references that might be helpful:
  
  http://people.dsv.su.se/~jpalme/ietf/message-threading.html
  
  http://www.jwz.org/doc/threading.html
 
 This above, of course, is a good reason for not replying to an
 existing message when you want to start a completely new thread.
 
 However, I'm wondering what is the best way to start a new thread
 which legitimately branches out from an existing one.
 
 For example, someone posts a message which discusses at length a
 method of isotonic binary regression, and in the middle of this
 describes a curious approach to obtaining confidence bands for
 the regression. I'm intrigued by the confidence band issue, get
 some ideas about it, and want to start a new thread to develop
 just this aspect.
 
 However, to do so I want in the first place to include several
 quotations from the original message. This, of course, is most
 easily done by replying to that message -- so that it gets included
 in the reply -- and editing this included message, and changing
 the subject.
 
 But that stays in the old thread, which I don't want. Now of course
 one can copy over the old text into a brand new blank message,
 and edit it up into a simulacrum of a reply -- all the usual
 On NN March 2007, XXX wrote: ... as well as the   inclusion
 markers, etc.. But that could be tedious. Nevertheless, perhaps
 it is the right thing to do -- unless there's a work-round using
 the reply mechanism?
 
 Best wishes to all,
 Ted.

Hi Ted,

The general approach, if relatedly digressing (also described in
various 'netiquette' guides) is to do what I did here, which is reply to
the post in question, but change the subject header by using New
Subject (was: Old Subject).

This enables you to easily engage in the sort of editing that you
describe, and still links your reply back to the original thread, under
the presumption that your reply is in some way related to the subject
matter of the original thread.

Since most e-mail systems (list managers, MUA's, etc.) thread based upon
the headers and not the subject, as described in the above references,
unless you generate a completely new e-mail, your reply will be linked
to the e-mail and thread to which you are replying.

It's pretty much a dichotomous situation.  Use 'reply' and you get
linked to the old thread. Use a 'new' e-mail and you start a new thread.

If you are truly moving in a new direction, I would be tempted to start
a new thread and perhaps to make it easier for readers, include a
reference/link to the post in question. That way, you keep your new
e-mail in a separate thread, while 'virtually' linking it back to the
original that raised your interest.

HTH,

Marc

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Wikibooks

2007-03-29 Thread Alberto Monteiro
As a big fan of Wikipedia, it's frustrating to see how little there is about 
R in the correlated project, the Wikibooks:

http://en.wikibooks.org/wiki/R_Programming

Alberto Monteiro

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Xemacs, ESS, R config issue

2007-03-29 Thread Gavin Simpson
On Thu, 2007-03-29 at 13:57 -0500, c n wrote:
 I've searched for 45 minutes, apparently in all the wrong places for a
 solution to a configuration issue I'm having.
 
 When I use Xemacs with ESS running in R-mode, and I type a - character, it
 autocompletes it to - .  How do I disable this annoying feature?
 
 Thanks much.

Don't know about disabling it, but to get a _, just press it twice.
_ doesn't auto-complete in text strings (quoted).

_ isn't allowed for assignment anymore, so the only place I can think
of at the mo is that you want to type a _ in a variable name?

Also, this is best addressed on the ESS mailing list:
ess-helpATstatDOTmathDOTethzDOTch (just remove the AT and DOTs)

G
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Gavin Simpson [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,  [f] +44 (0)20 7679 0565
 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London  [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT. [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Xemacs, ESS, R config issue

2007-03-29 Thread Marc Schwartz
On Thu, 2007-03-29 at 13:57 -0500, c n wrote:
 I've searched for 45 minutes, apparently in all the wrong places for a
 solution to a configuration issue I'm having.
 
 When I use Xemacs with ESS running in R-mode, and I type a - character, it
 autocompletes it to - .  How do I disable this annoying feature?
 
 Thanks much.

I think you mean an underscore _ rather than a hyphen -?

If you type __ (a double underscore) you will get an underscore. 

If you want to disable that feature, put the following:

  (ess-toggle-underscore nil)

in your init.el file after the point where ESS is loaded.


BTW, there is a dedicated ESS list:

https://stat.ethz.ch/mailman/listinfo/ess-help


HTH,

Marc Schwartz

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Xemacs, ESS, R config issue

2007-03-29 Thread Patrick Drechsler
c n [EMAIL PROTECTED] writes:

 When I use Xemacs with ESS running in R-mode, and I type a - character, it
 autocompletes it to - .  How do I disable this annoying feature?

From the ESS manual:

,
|* ESS[S]: Pressing underscore (_) once inserts  -  (as before);
|  pressing underscore twice inserts a literal underscore.  To stop
|  this smart behaviour, add (ess-toggle-underscore nil) to your
|  .emacs after ess-site has been loaded;
`

HTH

Patrick
-- 
Patrick Drechsler tel: +44 1223 334441
Department of Zoology fax: +44 1223 336687
University of Cambridge
Downing Street
Cambridge CB2 3EJ, UK

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] E-Mail/Post Threading (was: Bonferroni p-value greater t

2007-03-29 Thread Ted Harding
On 29-Mar-07 19:21:12, Marc Schwartz wrote:
 On Thu, 2007-03-29 at 19:38 +0100, [EMAIL PROTECTED] wrote:
 On 29-Mar-07 17:15:27, Marc Schwartz wrote:
  [...]
  Just a quick heads up here, that deleting the body text of
  a message or changing the subject line, does not alter the
  'linkage' between posts.
  
  There are standards for how messages are 'threaded' and largely
  have to do with the e-mail headers, not the e-mail content.
  
  A couple of quick references that might be helpful:
  
  http://people.dsv.su.se/~jpalme/ietf/message-threading.html
  
  http://www.jwz.org/doc/threading.html
 
 This above, of course, is a good reason for not replying to an
 existing message when you want to start a completely new thread.
 
 However, I'm wondering what is the best way to start a new thread
 which legitimately branches out from an existing one.
 
 For example, someone posts a message which discusses at length a
 method of isotonic binary regression, and in the middle of this
 describes a curious approach to obtaining confidence bands for
 the regression. I'm intrigued by the confidence band issue, get
 some ideas about it, and want to start a new thread to develop
 just this aspect.
 
 However, to do so I want in the first place to include several
 quotations from the original message. This, of course, is most
 easily done by replying to that message -- so that it gets included
 in the reply -- and editing this included message, and changing
 the subject.
 
 But that stays in the old thread, which I don't want. Now of course
 one can copy over the old text into a brand new blank message,
 and edit it up into a simulacrum of a reply -- all the usual
 On NN March 2007, XXX wrote: ... as well as the   inclusion
 markers, etc.. But that could be tedious. Nevertheless, perhaps
 it is the right thing to do -- unless there's a work-round using
 the reply mechanism?
 
 Best wishes to all,
 Ted.
 
 Hi Ted,
 
 The general approach, if relatedly digressing (also described
 in various 'netiquette' guides) is to do what I did here, which
 is reply to the post in question, but change the subject header
 by using New Subject (was: Old Subject).
 
 This enables you to easily engage in the sort of editing that you
 describe, and still links your reply back to the original thread,
 under the presumption that your reply is in some way related to
 the subject matter of the original thread.
 
 Since most e-mail systems (list managers, MUA's, etc.) thread
 based upon the headers and not the subject, as described in the
 above references, unless you generate a completely new e-mail,
 your reply will be linked to the e-mail and thread to which you
 are replying.
 
 It's pretty much a dichotomous situation.  Use 'reply' and you get
 linked to the old thread. Use a 'new' e-mail and you start a new
 thread.
 
 If you are truly moving in a new direction, I would be tempted to
 start a new thread and perhaps to make it easier for readers,
 include a reference/link to the post in question. That way, you
 keep your new e-mail in a separate thread, while 'virtually'
 linking it back to the original that raised your interest.
 
 HTH,
 
 Marc

Thanks for the clarification, Marc. Nicely put.

Now that I visit the R-help archives website, I can see that these
subthreads get hung off the originals in that display (just as
out present subthread is, as seen there), which is a good way for
it to happen (and ideally suited to the sort of situation which
I described). And the way the subject was changed keeps it nice
and clear as to what happened.

Best wishes,
Ted.


E-Mail: (Ted Harding) [EMAIL PROTECTED]
Fax-to-email: +44 (0)870 094 0861
Date: 29-Mar-07   Time: 21:39:17
-- XFMail --

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] pipe Apple

2007-03-29 Thread Don MacQueen
This expression,
read.table(pipe(pbpaste))
does work for me on an OS X 10.4.9 system.
And it was working 2 years ago on a 10.3.8 system (an older R, obviously).

I would look to how R was installed, what version of R, that kind of thing.
Use the sessionInfo() command to provide that information.
(the posting guide asks for information about the R version, without 
which it is more difficult to help)

What does the R expression
capabilities()
return?

Also, if what she's copying and pasting from is Excel, the gdata 
package has a function read.xls() function which can read data 
directly from Excel.

-Don

At 12:39 PM -0500 3/29/07, A. Beaujean wrote:
Hi,

I have a student trying to run R on an Apple (OS 10.3.9). She tried to
cut-and-paste the data via the code:
data-read.table(pipe(pbpaste))

But she keeps getting the error message:
'error in pipe(pbpaste):  pipe connections are not available on this
system'

I do not know much about using an Apple. Has anyone run into this before?
Does anyone have any ideas for how to fix the problem?

Thanks!

Alex

--
***
A. Alexander Beaujean, Ph.D., LSSP
Licensed Psychologist (Provisional, TX)
http://myprofile.cos.com/abeaujean
http://www.baylor.edu/soe/faculty/index.php?id=38476


General impressions are never to be trusted. Unfortunately when they are of
long standing they become fixed rules of life, and assume a prescriptive
right not to be questioned. Consequently those who are not accustomed to
original inquiry entertain a hatred and a horror of statistics. They cannot
endure the idea of submitting their sacred  impressions to cold-blooded
verification. But it is the triumph of scientific men to rise superior to
such superstitions, to devise tests by which the value of beliefs may be
ascertained, and to feel sufficiently masters of themselves to discard
contemptuously whatever may be found untrue. --Sir Francis Galton, FRS

   [[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


-- 
--
Don MacQueen
Environmental Protection Department
Lawrence Livermore National Laboratory
Livermore, CA, USA

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] E-Mail/Post Threading (was: Bonferroni p-value greater t

2007-03-29 Thread Charilaos Skiadas
On Mar 29, 2007, at 3:21 PM, Marc Schwartz wrote:

 Since most e-mail systems (list managers, MUA's, etc.) thread based  
 upon
 the headers and not the subject, as described in the above references,
 unless you generate a completely new e-mail, your reply will be linked
 to the e-mail and thread to which you are replying.

 It's pretty much a dichotomous situation.  Use 'reply' and you get
 linked to the old thread. Use a 'new' e-mail and you start a new  
 thread.

 If you are truly moving in a new direction, I would be tempted to  
 start
 a new thread and perhaps to make it easier for readers, include a
 reference/link to the post in question. That way, you keep your new
 e-mail in a separate thread, while 'virtually' linking it back to the
 original that raised your interest.

Perhaps moving a bit off topic here, but to elaborate a bit more on  
this: Each thread is really a tree, where your message is a child  
of the message you responded to. Since typically each person responds  
to the last message in the thread, this often ends up being linear.  
But if for instance three people respond to the same original  
message, this creates  three children of the root node.

You can see this in action here for instance: http://news.gmane.org/ 
gmane.emacs.ess.general

It then depends on your software, how to show this tree. Most mail  
clients would just flatten it out into a single list, which is what  
we usually refer to as a thread I guess. But the richer structure  
is there.

So based on this I would suggest simply responding to the message you  
want to, changing the subject appropriately.

 HTH,

 Marc

Haris Skiadas
Department of Mathematics and Computer Science
Hanover College

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Using functions in LAPACK in a C program

2007-03-29 Thread Paul August
Hi,

I wonder where I can find an example of using a function in LAPACK library in a 
user's own C code. I wrote a C program which will be compiled and linked to 
produce a DLL file and then loaded into R. I hope to use a function from LAPACK 
library, for example, dgesdd, in the program. Following R manual, I call the 
function by F77_CALL(dgesdd) in the program. The program can be compiled 
without problems. However, when it is linked to produce a DLL file, I get an 
error message 

  Test.obj : error LNK2001: unresolved external symbol _dgesdd_
  Test.dll : fatal error LNK1120: 1 unresolved externals

I use VC++6.0 and the command of linking is something like this

  link.exe Rdll.lib /nologo /dll /out:Test.dll 
/libpath:C:\R\R-2.2.1\src\gnuwin32 Test.obj

Apparently, the linker cannot resolve dgesdd from Rdll.lib. If anyone knows 
what I missed here or any example that shows how this can be done properly, 
please let me know. Thanks a lot.

Paul.



 

Never miss an email again!

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Wikibooks

2007-03-29 Thread Ben Bolker
Alberto Monteiro albmont at centroin.com.br writes:

 
 As a big fan of Wikipedia, it's frustrating to see how little there is about 
 R in the correlated project, the Wikibooks:
 
 http://en.wikibooks.org/wiki/R_Programming
 
 Alberto Monteiro
 

  Well, we do have an R wiki -- http://wiki.r-project.org/rwiki/doku.php --
although it is not as active as I'd like.  (We got stuck halfway through
porting Paul Johnson's R Tips to it ...)   Please contribute!
  Most of the (considerable) effort people expend in answering
questions about R goes to the mailing lists -- I personally would like it if 
some
tiny fraction of that energy could be redirected toward the wiki, where
information can be presented in a nicer format and (ideally) polished
over time -- rather than having to dig back through multiple threads on the
mailing lists to get answers.  (After that we have to get people
to look for the answers on the wiki.)

  Just my two cents -- and I've been delinquent in my 
wiki'ing recently too ...

  Ben Bolker

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] [HH] extending ancova function for 2 factors

2007-03-29 Thread Patrick Drechsler
Hi,

what would be a good way of enhancing the ancova function from the HH
package when using a 2 factor ANCOVA?

The current behaviour for the ancova function from package HH is:

--
|  P1  || P1   || P3   || P4   |   | PS  | - the lattice strip
--
| x||x ||x ||x |   | |
|  x   ||x || x||  x   |   |superimp.| - the lattice plot
|x ||  x   ||   x  ||x |   | |
--

P1:P4 :   Show an xy-plot for each factor level of the covariate P.
PS:   Displays the previous plots superimposed
superimp: P1:P4 superimposed

I would like to use this function for a two factor design.

-
|  Q1  || Q1   || Q1   || Q1   |   | PS.Pi  | - strip1
- 
|  P1  || P1   || P3   || P4   |   | PS.Pi  | - strip2
-
|x ||  x   ||   x  ||x |   ||
|x ||  x   ||   x  ||x |   || - plot
|x ||  x   ||   x  ||x |   ||
-

-
|  Q2  || Q2   || Q2   || Q2   |   | PS.Pi  | - strip1
- 
|  P1  || P1   || P3   || P4   |   | PS.Pi  | - strip2
-
|x ||  x   ||   x  ||x |   ||
|x ||  x   ||   x  ||x |   || - plot
|x ||  x   ||   x  ||x |   ||
-

[...]

-
|  Q5  || Q5   || Q5   || Q5   |   | PS.Pi  | - strip1
- 
|  P1  || P1   || P3   || P4   |   | PS.Pi  | - strip2
-
|x ||  x   ||   x  ||x |   ||
|x ||  x   ||   x  ||x |   || - plot
|x ||  x   ||   x  ||x |   ||
-


Here is an example:

--8---cut here---start-8---
rm(list = ls(all = TRUE))
rm(list = c(ls()))

library(lattice)
library(HH)

## 1. generate data
random - rnorm(200)
y - abs(random)
x1.cont - abs(random)
x2.fac - as.factor(rep(1:5, 4)) # 4 groups
x3.fac - as.factor(rep(1:4, each=5))# 5 groups
A - data.frame(y, x1.cont, x2.fac, x2.fac)

## 2. plot trellis plot:
foo - xyplot(log(y) ~ log(x1.cont) | x2.fac * x3.fac,
  data = A,
  type = c(p,r),
  strip = strip.custom(strip.names=TRUE),
  as.table=TRUE)

plot(foo)

## 3. plot ancova plot using HH:
## normal usage:
ancova(y ~ x1.cont * x2.fac)

## 4. Trying to combine ancova with trellis:
## does not work:
ancova(y ~ x1.cont * x2.fac * x3.fac)
--8---cut here---end---8---

-- 
Patrick Drechsler
Department of Zoology
University of Cambridge
Downing Street
Cambridge CB2 3EJ, UK

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] ccf time units

2007-03-29 Thread tom soyer
Hi,

I am using ccf but I could not figure out how to calculate the actual lag in
number of periods from the returned results. The documentation for ccf
says:The lag is returned and plotted in units of time. What does units of
time mean? For example:

 x=ldeaths
 x1=lag(ldeaths,1)
 results=ccf(x,x1)
 results

Autocorrelations of series 'X', by lag

-1.2500 -1.1667 -1.0833 -1. -0.9167 -0.8333 -0.7500 -0.6667 -0.5833 -
0.5000
 -0.297   0.011   0.380   0.651   0.738   0.664   0.392  -0.011  -0.383  -
0.618
-0.4167 -0. -0.2500 -0.1667 -0.0833  0.  0.0833  0.1667  0.2500
0.
 -0.693  -0.619  -0.362   0.020   0.405   0.770   0.981   0.749   0.376  -
0.004
 0.4167  0.5000  0.5833  0.6667  0.7500  0.8333  0.9167  1.  1.0833
1.1667
 -0.366  -0.610  -0.686  -0.602  -0.368  -0.012   0.388   0.650   0.705
0.614
 1.2500
  0.341
I see that at time unit 0.0833, the correlation is close to 1. But how do I
know time unit 0.0833 is actually lag 1? Is there a function to do the
conversion?

Thanks,

Tom

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] ccf time units

2007-03-29 Thread Gabor Grothendieck
The unit of time for a ts class object is deltat(ldeaths).
See the
   ?deltat
help page.

On 3/29/07, tom soyer [EMAIL PROTECTED] wrote:
 Hi,

 I am using ccf but I could not figure out how to calculate the actual lag in
 number of periods from the returned results. The documentation for ccf
 says:The lag is returned and plotted in units of time. What does units of
 time mean? For example:

  x=ldeaths
  x1=lag(ldeaths,1)
  results=ccf(x,x1)
  results

 Autocorrelations of series 'X', by lag

 -1.2500 -1.1667 -1.0833 -1. -0.9167 -0.8333 -0.7500 -0.6667 -0.5833 -
 0.5000
  -0.297   0.011   0.380   0.651   0.738   0.664   0.392  -0.011  -0.383  -
 0.618
 -0.4167 -0. -0.2500 -0.1667 -0.0833  0.  0.0833  0.1667  0.2500
 0.
  -0.693  -0.619  -0.362   0.020   0.405   0.770   0.981   0.749   0.376  -
 0.004
  0.4167  0.5000  0.5833  0.6667  0.7500  0.8333  0.9167  1.  1.0833
 1.1667
  -0.366  -0.610  -0.686  -0.602  -0.368  -0.012   0.388   0.650   0.705
 0.614
  1.2500
  0.341
 I see that at time unit 0.0833, the correlation is close to 1. But how do I
 know time unit 0.0833 is actually lag 1? Is there a function to do the
 conversion?

 Thanks,

 Tom

[[alternative HTML version deleted]]

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Vector indexing question

2007-03-29 Thread Paul Lynch
Suppose you have 4 related vectors:

a.id-c(1:25, 1:25, 1:25)
a.vals - c(101:175)# same length as a.id (the values for those IDs)
a.id.levels - c(1:25)
a.id.ratings - rep(letters[1:5], times=5)# same length as a.id.levels

What I would like to do is specify a rating from a.ratings (e.g. e),
get the vector of corresponding IDs from a.id.levels (via
a.id.levels[a.id.ratings=='e']) and then somehow use those IDs in a.id
to get the corresponding values from a.vals.

I think I can probably write a loop to construct of a vector of
ratings of the same length as a.id so that the ratings match the ID,
and then go from there.  Is there a better way?  Perhaps using factors
or levels or something?

Thanks,
  --Paul

-- 
Paul Lynch
Aquilent, Inc.
National Library of Medicine (Contractor)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Wikibooks

2007-03-29 Thread Adaikalavan Ramasamy
I think sometime ago someone suggested that we append a 
comments/discussion/wiki section to the end of every R functions' help 
page that is editable by everyday users.

In other words, every R function help page has a fixed component that 
has met R-core's approval and a clearly marked and more flexible 
components by everyday users.

The comments section on every function could contain suggestions, 
warnings (e.g. the use of c versus as.vector thread that was discussed 
today), examples, do's and don'ts, suggestion for clarification in 
documents.

I think starting from function-level is an interesting idea to 
complement Paul Johnson's R tips.

This comments could perhaps be cleaned up and integrated for future 
releases if the R-core agrees on its usefulness. Think of as a Bayesian 
approach for maintaining information.

Regards, Adai



Frank E Harrell Jr wrote:
 Ben Bolker wrote:
 Alberto Monteiro albmont at centroin.com.br writes:

 As a big fan of Wikipedia, it's frustrating to see how little there is 
 about 
 R in the correlated project, the Wikibooks:

 http://en.wikibooks.org/wiki/R_Programming

 Alberto Monteiro

   Well, we do have an R wiki -- http://wiki.r-project.org/rwiki/doku.php --
 although it is not as active as I'd like.  (We got stuck halfway through
 porting Paul Johnson's R Tips to it ...)   Please contribute!
   Most of the (considerable) effort people expend in answering
 questions about R goes to the mailing lists -- I personally would like it if 
 some
 tiny fraction of that energy could be redirected toward the wiki, where
 information can be presented in a nicer format and (ideally) polished
 over time -- rather than having to dig back through multiple threads on the
 mailing lists to get answers.  (After that we have to get people
 to look for the answers on the wiki.)
 
 I would like to strongly second Ben.  In some ways, R experts are too 
 nice.  Continuing to answer the same questions over and over does not 
 lead to a better way using R wiki.  I would rather see the work go into 
 enhancing the wiki and refactoring information, and responses to many 
 r-help please for help be see wiki topic x.  While doing this let's 
 consider putting a little more burden on new users to look for good 
 answers already provided.
 
 Frank
 
   Just my two cents -- and I've been delinquent in my 
 wiki'ing recently too ...

   Ben Bolker

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

 


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Using Java or Tcl/Tk in R

2007-03-29 Thread Erin Hodgess
Dear R People:

This is more of an opinion question please:
When putting together GUI type functions, is
it better to use JAVA or Tcl/Tk, please?

Any input is appreciated!

Sincerely,
Erin Hodgess
Associate Professor
Department of Computer and Mathematical Sciences
University of Houston - Downtown
mailto: [EMAIL PROTECTED]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Wikibooks

2007-03-29 Thread Bert Gunter
Question:

Many (perhaps most?) questions on the list are easily answerable simply by
checking existing R Docs (Help file/man pages, Intro to R, etc.). Why would
a Wiki be more effective in deflecting such questions from the mailing list
than them? Why would too helpful R experts be more inclined to refer people
to the Wiki than the existing docs? Bottom line: it's psychology at issue
here, I think, not the form of the docs. 

Disclaimer 1: None of this is meant to reflect one way or ther other on the
usefulness of Wikis as a documentation format -- only their ability to
change the Help list culture.

Disclaimer 2: Others have repeatedly made similar comments (asking us to
refer people to the docs rather than providing explicit answers, I mean).

Cheers,
Bert Gunter
Genentech Nonclinical Statistics
South San Francisco, CA 94404
650-467-7374


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Frank E Harrell Jr
Sent: Thursday, March 29, 2007 3:32 PM
To: Ben Bolker
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] Wikibooks

Ben Bolker wrote:
 Alberto Monteiro albmont at centroin.com.br writes:
 
 As a big fan of Wikipedia, it's frustrating to see how little there is
about 
 R in the correlated project, the Wikibooks:

 http://en.wikibooks.org/wiki/R_Programming

 Alberto Monteiro

 
   Well, we do have an R wiki -- http://wiki.r-project.org/rwiki/doku.php
--
 although it is not as active as I'd like.  (We got stuck halfway through
 porting Paul Johnson's R Tips to it ...)   Please contribute!
   Most of the (considerable) effort people expend in answering
 questions about R goes to the mailing lists -- I personally would like it
if some
 tiny fraction of that energy could be redirected toward the wiki, where
 information can be presented in a nicer format and (ideally) polished
 over time -- rather than having to dig back through multiple threads on
the
 mailing lists to get answers.  (After that we have to get people
 to look for the answers on the wiki.)

I would like to strongly second Ben.  In some ways, R experts are too 
nice.  Continuing to answer the same questions over and over does not 
lead to a better way using R wiki.  I would rather see the work go into 
enhancing the wiki and refactoring information, and responses to many 
r-help please for help be see wiki topic x.  While doing this let's 
consider putting a little more burden on new users to look for good 
answers already provided.

Frank

 
   Just my two cents -- and I've been delinquent in my 
 wiki'ing recently too ...
 
   Ben Bolker
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 


-- 
Frank E Harrell Jr   Professor and Chair   School of Medicine
  Department of Biostatistics   Vanderbilt University

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Vector indexing question

2007-03-29 Thread Adaikalavan Ramasamy
Sounds like you have two different tables and are trying to mine one 
based on the other. Try

ref - data.frame( levels  = 1:25,
ratings = rep(letters[1:5], times=5) )

db - data.frame( vals=101:175, levels=c(1:25, 1:25, 1:25) )

levels.of.interest - ref$levels[ ref$rating==a ]
db$vals[ which(db$levels %in% levels.of.interest) ]

  [1] 101 106 111 116 121 126 131 136 141 146 151 156 161 166 171


OR a much more intuitive way is to merge both tables and proceeding as

out - merge( db, ref, by=levels, all.x=TRUE )
out - out[ order(out$val), ] # little cleanup
subset( out, ratings==a )   # ignore the rownames

levels vals ratings
1   1  101   a
16  6  106   a
31 11  111   a
46 16  116   a
61 21  121   a
3   1  126   a
17  6  131   a
32 11  136   a
47 16  141   a
62 21  146   a
2   1  151   a
18  6  156   a
33 11  161   a
48 16  166   a
63 21  171   a

Then you can do cool things using the apply() family like
   tapply( out$vals, out$ratings, mean )
 a   b   c   d   e
   136 137 138 139 140

Check out %in%, merge and apply.

Regards, Adai



Paul Lynch wrote:
 Suppose you have 4 related vectors:
 
 a.id-c(1:25, 1:25, 1:25)
 a.vals - c(101:175)# same length as a.id (the values for those IDs)
 a.id.levels - c(1:25)
 a.id.ratings - rep(letters[1:5], times=5)# same length as a.id.levels
 
 What I would like to do is specify a rating from a.ratings (e.g. e),
 get the vector of corresponding IDs from a.id.levels (via
 a.id.levels[a.id.ratings=='e']) and then somehow use those IDs in a.id
 to get the corresponding values from a.vals.
 
 I think I can probably write a loop to construct of a vector of
 ratings of the same length as a.id so that the ratings match the ID,
 and then go from there.  Is there a better way?  Perhaps using factors
 or levels or something?
 
 Thanks,
   --Paul


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Wikibooks

2007-03-29 Thread hadley wickham
 Many (perhaps most?) questions on the list are easily answerable simply by
 checking existing R Docs (Help file/man pages, Intro to R, etc.). Why would
 a Wiki be more effective in deflecting such questions from the mailing list
 than them? Why would too helpful R experts be more inclined to refer people
 to the Wiki than the existing docs? Bottom line: it's psychology at issue
 here, I think, not the form of the docs.

I agree - and there's also a problem that until the wiki becomes
useful there's no point referring people to it, and because no one
visits it, it doesn't get better.

http://www.wikipatterns.com provides some good advice for getting a wiki going.

Hadley

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Vector indexing question

2007-03-29 Thread Marc Schwartz
On Thu, 2007-03-29 at 19:55 -0400, Paul Lynch wrote:
 Suppose you have 4 related vectors:
 
 a.id-c(1:25, 1:25, 1:25)
 a.vals - c(101:175)# same length as a.id (the values for those IDs)
 a.id.levels - c(1:25)
 a.id.ratings - rep(letters[1:5], times=5)# same length as a.id.levels
 
 What I would like to do is specify a rating from a.ratings (e.g. e),
 get the vector of corresponding IDs from a.id.levels (via
 a.id.levels[a.id.ratings=='e']) and then somehow use those IDs in a.id
 to get the corresponding values from a.vals.
 
 I think I can probably write a loop to construct of a vector of
 ratings of the same length as a.id so that the ratings match the ID,
 and then go from there.  Is there a better way?  Perhaps using factors
 or levels or something?
 
 Thanks,
   --Paul

Is this what you want?

DF - data.frame(a.id, a.vals, a.id.levels, a.id.ratings)

 DF[DF$a.id.ratings == e, a.vals]
 [1] 105 110 115 120 125 130 135 140 145 150 155 160 165 170 175

or

 subset(DF, a.id.ratings == e, select = a.vals)
   a.vals
5 105
10110
15115
20120
25125
30130
35135
40140
45145
50150
55155
60160
65165
70170
75175

See ?subset

HTH,

Marc Schwartz

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Wikibooks

2007-03-29 Thread John Sorkin
I think we occasionally think that it is very easy to get information because 
we know how to find the information. This does not mean that other people know 
how to find the answer. It is for this reason that questions appear on the 
listserver that we might think could be easily found from other sources.
John 

John Sorkin M.D., Ph.D.
Chief, Biostatistics and Informatics
Baltimore VA Medical Center GRECC,
University of Maryland School of Medicine Claude D. Pepper OAIC,
University of Maryland Clinical Nutrition Research Unit, and
Baltimore VA Center Stroke of Excellence

University of Maryland School of Medicine
Division of Gerontology
Baltimore VA Medical Center
10 North Greene Street
GRECC (BT/18/GR)
Baltimore, MD 21201-1524

(Phone) 410-605-7119
(Fax) 410-605-7913 (Please call phone number above prior to faxing)
[EMAIL PROTECTED]

 hadley wickham [EMAIL PROTECTED] 3/29/2007 7:47 PM 
 Many (perhaps most?) questions on the list are easily answerable simply by
 checking existing R Docs (Help file/man pages, Intro to R, etc.). Why would
 a Wiki be more effective in deflecting such questions from the mailing list
 than them? Why would too helpful R experts be more inclined to refer people
 to the Wiki than the existing docs? Bottom line: it's psychology at issue
 here, I think, not the form of the docs.

I agree - and there's also a problem that until the wiki becomes
useful there's no point referring people to it, and because no one
visits it, it doesn't get better.

http://www.wikipatterns.com provides some good advice for getting a wiki going.

Hadley

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help 
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html 
and provide commented, minimal, self-contained, reproducible code.

Confidentiality Statement:
This email message, including any attachments, is for the so...{{dropped}}

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Using Java or Tcl/Tk in R

2007-03-29 Thread Michael Lawrence
It really depends on what you're trying to do. tcl/tk is convenient in that
support for it is included with R. There won't be any distribution
complications. Obviously, Java is fairly widespread, but then there's the
complication of installing rJava or some other R-Java binding.

If you're doing anything beyond the most trivial GUI, I would recommend the
excellent gWidgets package from John Verzani. It's available from CRAN and
provides a simple API for creating widgets from R. gWidgets supports
multiple widget library back-ends. Currently, I think there are only
backends for GTK+ (via RGtk2) and Java (swing). The RGtk2 backend is the
most mature right now. GTK+ is a cross-platform and full-featured widget
library. In my opinion it's API is more convenient for most uses than that
of Swing, and GTK+ has more features than tcl/tk.

gWidgets allows you to prototype your GUI using a simple API without
depending on a specific toolkit. Once your application matures to the point
that it requires features that are not within the scope of the simple
gWidgets API, you can make the decision about moving to a specific toolkit.

I hope this helps,
Michael

On 3/29/07, Erin Hodgess [EMAIL PROTECTED] wrote:

 Dear R People:

 This is more of an opinion question please:
 When putting together GUI type functions, is
 it better to use JAVA or Tcl/Tk, please?

 Any input is appreciated!

 Sincerely,
 Erin Hodgess
 Associate Professor
 Department of Computer and Mathematical Sciences
 University of Houston - Downtown
 mailto: [EMAIL PROTECTED]

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] problem using mcmcsamp() with glmer models containing interaction terms in fixed effects

2007-03-29 Thread Andrew Dolman
Dear All,

I've been using mcmcsamp() successfully with a few different mixed models
but I can't get it to work with the following. Is there an obvious reason
why it shouldn't work with a model of this structure ?


*brief summary of objective:

I want to test the effect of no-fishing marine reserves on the abundance of
a target species.

I have samples at coral reef sites inside and outside of reserves, from
visits before and after the establishment of the reserves. Samples are
counts of the target species.

I plan to test this by looking at the interaction between reserve zone
(green/blue, green means no-fishing allowed) and the change in abundance
between the before sample (visit 0), and after sample (visit 1). -- please
say if you think there is a better way.

Samples come from several different regions, thus it would be nice to be
able to model differences between regions in the response to no-fishing and
to expand possible inference beyond this sample of regions.

My problem is getting a test for the fixed effects, see
http://wiki.r-project.org/rwiki/doku.php?id=guides:lmer-tests for background
on why I want to use mcmcsamp.



Thank you for your attention,

Andrew Dolman - Australian Institute of Marine Science.
-- 
[EMAIL PROTECTED]
[EMAIL PROTECTED]


# required packages
library('lme4')


# some dummy data

counts - c(rpois(75, 2), rpois(25,4)) # number of fish in a sample
[dependent variable - poisson distributed]
visit - c(rep(0, 50), rep(1,50)) # sample visit number, 0 or 1 to indicate
pre and post no-fishing reserve establishment

zone - as.factor(rep(c(rep(blue, 25), rep(green,25)),2)) #
inside/outside no-fishing reserve
region - as.factor(rep(c(island1, island2),50)) # spatial grouping
factor

data1 - data.frame(counts, visit, zone, region)
rm (counts, visit, zone, region)

# a quick look
bwplot(I(sqrt(counts))~as.factor(visit)|region, data=data1)

# two lmer models
lmer1 - lmer (counts~visit+visit:zone + (1|region), data=data1,
family=poisson(link=log))
lmer2 - lmer (counts~visit+visit:zone + (visit+visit:zone|region),
data=data1, family=poisson(link=log))

mcmc1 - mcmcsamp(lmer1, n=1)  # works
mcmc2 - mcmcsamp(lmer2, n=1)  # doesn't work

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] on hazardous

2007-03-29 Thread YMarguerite FFarr


Ground floor to the future
Critical Care New
SYm-C.C.T.I
16 Cents is a STEAL
This could hit  in short and over  in the long run

This one is Guaranteed to double in next 2 days
Get in this gem tomorrow, Catch an easy doubler!!

 their fourth straight win, a 131-107 blowout of the Phoenix Suns on Saturday  
have the regroup a little bit.''   Denver has struggled all season to get any  
But we didn't make the NCAA tournament and that was the goal. To that extent,  
defense.  ''That team can blow you out and they can score in bunches,'' he said

- Original Message - 
From: YMarguerite FFarr [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, March 22, 2007 8:27 PM
Subject: on hazardous


 Ground floor to the future
 Critical Care New
 SYm-C.C.T.I
 16 Cents is a STEAL
 This could hit  in short and over  in the long run

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Vector indexing question

2007-03-29 Thread Charles C. Berry
On Thu, 29 Mar 2007, Paul Lynch wrote:

 Suppose you have 4 related vectors:

 a.id-c(1:25, 1:25, 1:25)
 a.vals - c(101:175)# same length as a.id (the values for those IDs)
 a.id.levels - c(1:25)
 a.id.ratings - rep(letters[1:5], times=5)# same length as a.id.levels

 What I would like to do is specify a rating from a.ratings (e.g. e),
 get the vector of corresponding IDs from a.id.levels (via
 a.id.levels[a.id.ratings=='e']) and then somehow use those IDs in a.id
 to get the corresponding values from a.vals.

see

?factor
?match ( in case a.id.levels does not actually index a.id.ratings)
?split

 a.ratings.factor - factor( a.id.ratings[ match(a.id, a.id.levels) ])
 a.vals[ a.ratings.factor == 'e' ]
  [1] 105 110 115 120 125 130 135 140 145 150 155 160 165 170 175

 split( a.vals, a.ratings.factor ) # more generally
$a
  [1] 101 106 111 116 121 126 131 136 141 146 151 156 161 166 171

$b
  [1] 102 107 112 117 122 127 132 137 142 147 152 157 162 167 172
[output truncated]


 lm( a.vals ~ a.ratings.factor - 1 ) # means of a.vals

Call:
lm(formula = a.vals ~ a.ratings.factor - 1)

Coefficients:
a.ratings.factora  a.ratings.factorb  a.ratings.factorc  a.ratings.factord  
a.ratings.factore
   136137138139 
   140


 I think I can probably write a loop to construct of a vector of
 ratings of the same length as a.id so that the ratings match the ID,
 and then go from there.  Is there a better way?  Perhaps using factors
 or levels or something?

A warning: using factor() in this way

 a.ratings.factor - factor( a.id, levels=a.id.levels, 
labels=a.id.ratings )

will work in this case:

a.vals[ a.ratings.factor == 'e' ]

but generally will get you into trouble as its creates a factor with 25 
non-unique levels. So,

split( a.vals, a.ratings.factor )

ends up giving a list of 25 (non-uniquely labelled) components

HTH,

Chuck


 Thanks,
  --Paul

 -- 
 Paul Lynch
 Aquilent, Inc.
 National Library of Medicine (Contractor)

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


Charles C. Berry(858) 534-2098
  Dept of Family/Preventive Medicine
E mailto:[EMAIL PROTECTED]   UC San Diego
http://biostat.ucsd.edu/~cberry/ La Jolla, San Diego 92093-0901

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Vector indexing question

2007-03-29 Thread Paul Lynch
Adai-- Thanks a lot!  This is just what I was looking for.  I was
almost sure there had to be a neat of doing this.

Bert--  Thanks for the tip.

Marc-- Not quite, although your solution works fine for the case I
gave.  What I had in mind for a.id was an arbitrary sequence of the
numbers in the range [1,25], of length 75, though I was not savvy
enough with R to express that succinctly.  You spotted a shortcut that
I hadn't reallized I was introducing.

Thanks all for your help!
  --Paul

On 3/29/07, Adaikalavan Ramasamy [EMAIL PROTECTED] wrote:
 Sounds like you have two different tables and are trying to mine one
 based on the other. Try

 ref - data.frame( levels  = 1:25,
 ratings = rep(letters[1:5], times=5) )

 db - data.frame( vals=101:175, levels=c(1:25, 1:25, 1:25) )

 levels.of.interest - ref$levels[ ref$rating==a ]
 db$vals[ which(db$levels %in% levels.of.interest) ]

   [1] 101 106 111 116 121 126 131 136 141 146 151 156 161 166 171


 OR a much more intuitive way is to merge both tables and proceeding as

 out - merge( db, ref, by=levels, all.x=TRUE )
 out - out[ order(out$val), ] # little cleanup
 subset( out, ratings==a )   # ignore the rownames

 levels vals ratings
 1   1  101   a
 16  6  106   a
 31 11  111   a
 46 16  116   a
 61 21  121   a
 3   1  126   a
 17  6  131   a
 32 11  136   a
 47 16  141   a
 62 21  146   a
 2   1  151   a
 18  6  156   a
 33 11  161   a
 48 16  166   a
 63 21  171   a

 Then you can do cool things using the apply() family like
tapply( out$vals, out$ratings, mean )
  a   b   c   d   e
136 137 138 139 140

 Check out %in%, merge and apply.

 Regards, Adai



 Paul Lynch wrote:
  Suppose you have 4 related vectors:
 
  a.id-c(1:25, 1:25, 1:25)
  a.vals - c(101:175)# same length as a.id (the values for those IDs)
  a.id.levels - c(1:25)
  a.id.ratings - rep(letters[1:5], times=5)# same length as a.id.levels
 
  What I would like to do is specify a rating from a.ratings (e.g. e),
  get the vector of corresponding IDs from a.id.levels (via
  a.id.levels[a.id.ratings=='e']) and then somehow use those IDs in a.id
  to get the corresponding values from a.vals.
 
  I think I can probably write a loop to construct of a vector of
  ratings of the same length as a.id so that the ratings match the ID,
  and then go from there.  Is there a better way?  Perhaps using factors
  or levels or something?
 
  Thanks,
--Paul
 




-- 
Paul Lynch
Aquilent, Inc.
National Library of Medicine (Contractor)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Regarding Vista

2007-03-29 Thread gyadav

Hi Dieter,

I am facing the same problem in my case. R 2.4.1 have installed 
successfully, but when i try to install the packages from a local zip 
file. It gives the following error message. Please tell me how to install 
the packages in a corporate environment. I mean i could not understand 
your reply, may you be a bit more elaborate so that i can fix up the 
problem in my corporate laptop.]

Thanks in advance
-gaurav



Dieter Menne [EMAIL PROTECTED] 
Sent by: [EMAIL PROTECTED]
30-03-07 12:32 AM

To
r-help@stat.math.ethz.ch
cc

Subject
Re: [R] Regarding Vista






 christian.ritter at shell.com writes:

 The Vista issue is not innocent as it threatens the life of R within 
large
corporations. So any posts on how R
 runs under Vista and what has to be done to make it work and what cannot 
be
done etc will be very useful. 

Main problem seems to be the installation of chm-files when upgrading. I 
had to
switch off all security mechanisms to get it done. Which is probably not 
what
you would like to have in a corporate environment.

As a temporary workaround, it would probably be best to optionally disable 
chm
installation. Or do a poll if is is required, after all it's considered a 
legacy
format nowadays.

Dieter

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.




DISCLAIMER AND CONFIDENTIALITY CAUTION:\ \ This message and ...{{dropped}}

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Using functions in LAPACK in a C program

2007-03-29 Thread Prof Brian Ripley
On Thu, 29 Mar 2007, Paul August wrote:

 Hi,

 I wonder where I can find an example of using a function in LAPACK 
 library in a user's own C code.

In about 20 R packages, e.g. the recommended package mgcv.

 I wrote a C program which will be 
 compiled and linked to produce a DLL file and then loaded into R. I hope 
 to use a function from LAPACK library, for example, dgesdd, in the 
 program. Following R manual, I call the function by F77_CALL(dgesdd) in 
 the program. The program can be compiled without problems. However, when 
 it is linked to produce a DLL file, I get an error message

  Test.obj : error LNK2001: unresolved external symbol _dgesdd_
  Test.dll : fatal error LNK1120: 1 unresolved externals

 I use VC++6.0 and the command of linking is something like this

  link.exe Rdll.lib /nologo /dll /out:Test.dll 
 /libpath:C:\R\R-2.2.1\src\gnuwin32 Test.obj

 Apparently, the linker cannot resolve dgesdd from Rdll.lib. If anyone 
 knows what I missed here or any example that shows how this can be done 
 properly, please let me know. Thanks a lot.

It is in Rlapack.dll not R.dll.

The linking information is in 'Writing R Extensions' for those using the 
recommended compilation system (search for LAPACK_LIBS).

You will need to build an import library for Rlapack.dll and link against 
that.

And BTW you seem to be using R 2.2.1: please update as we can only offer 
accurate advice on recent systems.

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

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Regarding Vista

2007-03-29 Thread gyadav

*Sorry for duplicate post - i forgot to tell the error


Hi Dieter,

I am facing the same problem in my case. R 2.4.1 have installed 
successfully, but when i try to install the packages from a local zip 
file. It gives the following error message. 
+++
 utils:::menuInstallLocal()
Error in zip.unpack(pkg, tmpDir) : cannot open file 'C:/Program 
Files/R/R-2.4.1/library/file5d2b5841/aaMI/chtml/aaMI.chm'
 
+++

Please tell me how to install the packages in a corporate environment. I 
mean i could not understand your reply, may you be a bit more elaborate so 
that i can fix up the problem in my corporate laptop.

Thanks in advance
-gaurav






Dieter Menne [EMAIL PROTECTED] 
Sent by: [EMAIL PROTECTED]
30-03-07 12:32 AM

To
r-help@stat.math.ethz.ch
cc

Subject
Re: [R] Regarding Vista






 christian.ritter at shell.com writes:

 The Vista issue is not innocent as it threatens the life of R within 
large
corporations. So any posts on how R
 runs under Vista and what has to be done to make it work and what cannot 
be
done etc will be very useful. 

Main problem seems to be the installation of chm-files when upgrading. I 
had to
switch off all security mechanisms to get it done. Which is probably not 
what
you would like to have in a corporate environment.

As a temporary workaround, it would probably be best to optionally disable 
chm
installation. Or do a poll if is is required, after all it's considered a 
legacy
format nowadays.

Dieter

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.




DISCLAIMER AND CONFIDENTIALITY CAUTION:\ \ This message and ...{{dropped}}

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.