Re: [R] use factor for categorical covariate in Cox PH model

2006-07-18 Thread Dieter Menne
Linda Lei llei at bccrc.ca writes:

 
 When dealing with the categorical covariates (for example 3 groups), it
 will come out different results if we add the command factor in front
 of the categorical covariate or not 

The catch is here: the covariate is not a categorial, but a number. In that
case a regression is computed, and the ONE ration printed out has the meaning of
a slope.

 if we don't add factor, there is
 only one hazard ratio; if we add factor, there are two hazard ratios.
 
 So does the factor actually create some dummy variables for the
 calculation?

Factor make the covariate a categorial one, and two contrasts are printed out,
relative to the first level of the covariate.

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


[R] Output and Word

2006-07-18 Thread sharon snowdon
Hi

I have just started to have a look at R. I have used most stats software
packages and can use perl, visual basic etc. I am interested in how well
it handles lots of output e.g. tables or charts. How would you get lots
of output most easily and quickly into a Word document?

Sharon Snowdon




-
FIGHT BACK AGAINST SPAM!
Download Spam Inspector, the Award Winning Anti-Spam Filter
http://mail.giantcompany.com



-- 



7/14/2006

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


Re: [R] String manipulation and formatting

2006-07-18 Thread Bashir Saghir (Aztek Global)
Thanks to Richard, Gabor and Marc for some nice solutions to my request.

I have a new problem:

   xify(30.10)
  [1] X.X
   xify(30.11)
  [1] XXX.XXX

The problem originates from:

   as.numeric(unlist(strsplit(as.character(15.10), \\.)))
  [1] 15  1
   as.numeric(unlist(strsplit(as.character(15.11), \\.)))
  [1] 15 11

It seems to boils down to:

   as.character(15.10)
  [1] 15.1

A simple solution is:

   xify(15.10)
  [1] X.XX

I was wondering if there is a simple way for xify to see the zero of the 10
without having to force the user to add quotes around the format?

Thanks,
Saghir


-Original Message-
From: Marc Schwartz (via MN) [mailto:[EMAIL PROTECTED] 
Sent: Monday, July 17, 2006 16:55
To: Bashir Saghir (Aztek Global)
Cc: '[EMAIL PROTECTED]'
Subject: Re: [R] String manipulation and formatting

snip

Here are two variations:

xify - function(x)
{
  exxes - as.numeric(unlist(strsplit(as.character(x), \\.)))
  ifelse(length(exxes) == 2,
 paste(paste(rep(X, exxes[1] - exxes[2]), collapse = ), 
   paste(rep(X, exxes[2]), collapse = ), 
   sep = .),
 paste(rep(X, exxes[1]), collapse = ))
}


xify - function(x)
{
  exxes - as.numeric(unlist(strsplit(as.character(x), \\.)))
  tmp - sapply(exxes, function(x) paste(rep(X, x), collapse = ))
  ifelse(length(tmp) == 2, 
 paste(substr(tmp[1], 1, exxes[1] - exxes[2]), tmp[2], 
   sep = .),
 tmp)
}


HTH,

Marc Schwartz


-Original Message-
From: Richard M. Heiberger [mailto:[EMAIL PROTECTED] 
Sent: Monday, July 17, 2006 16:42
To: Bashir Saghir (Aztek Global); '[EMAIL PROTECTED]'
Subject: Re: [R] String manipulation and formatting


xify - function(number) {
  fn - format(number)
  fn3 - unlist(strsplit(fn, \\.))
  if (length(fn3) == 1) paste(rep(X, as.numeric(fn3)), collapse=)
  else
  paste(paste(rep(X, as.numeric(fn3)[1]-as.numeric(fn3)[2]), collapse=),
paste(rep(X, as.numeric(fn3)[2]), collapse=),
sep=.)
}


- 
Legal Notice: This electronic mail and its attachments are i...{{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] String manipulation and formatting

2006-07-18 Thread Hans-Joerg Bibiko

Hi,

an other way without any libraries and written as a one-line-command  
would be something like this:


xify - function(x)
{
gsub([0-9],X,
sprintf(
paste(
%,
ifelse(
format(x,digit=1)==as.character(x),
paste(as.character(x),.0,sep=),
as.character(x)
),
f,sep=
)
,10^(trunc(x)-10*x+10*trunc(x)-1)
)
)
}


The only disadvantage is that something like xify(4.8) produces [1]  
X..

Hans-Joerg


 On 7/17/06, Bashir Saghir (Aztek Global) [EMAIL PROTECTED] 
 group.com wrote:
 I'm trying to write a simple function that does the following:

  [command] xify(5.2)
  [output] XXX.XX

  [command] xify(3)
  [output] XXX

 Any simple solutions (without using python/perl/unix script/...)?

 Thanks,
 Saghir


 -
 Legal Notice: This electronic mail and its attachments are i... 
 {{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



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



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


Re: [R] String manipulation and formatting

2006-07-18 Thread Prof Brian Ripley
On Tue, 18 Jul 2006, Bashir Saghir (Aztek Global) wrote:

 Thanks to Richard, Gabor and Marc for some nice solutions to my request.
 
 I have a new problem:
 
xify(30.10)
   [1] X.X
xify(30.11)
   [1] XXX.XXX
 
 The problem originates from:
 
as.numeric(unlist(strsplit(as.character(15.10), \\.)))
   [1] 15  1
as.numeric(unlist(strsplit(as.character(15.11), \\.)))
   [1] 15 11
 
 It seems to boils down to:
 
as.character(15.10)
   [1] 15.1
 
 A simple solution is:
 
xify(15.10)
   [1] X.XX
 
 I was wondering if there is a simple way for xify to see the zero of the 10
 without having to force the user to add quotes around the format?

No, as the parser has converted '15.10' to a numeric constant.

What is the problem with asking users to enter strings as strings?

-- 
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] Nested functions

2006-07-18 Thread John Wiedenhoeft
Am Montag, den 17.07.2006, 19:42 -0400 schrieb jim holtman:
 You were down at least 5300 levels in subroutine calls.  Here is the
 first couple of lines from 'traceback()':
  
 5363: vavb(a, b, n, v, x)
...
 5316: vavb(a, b, n, v, x) 


 The other thing is that there is no 'x' defined in the function;
  
 antiphonar - function(v)
 {
a - 1;
b - 2;
n - length(v);
alessn(a, b, n, v, x);
 }
  
 and this is the initial call to the rest of the functions.

Ooops... normally I don't program THAT bad ... ;-)

 What is the problem you are trying to solve? 

I'm analyzing a 16th century music manuscript. There is no rhythm
notated there, but I can to a certain degree restore it by finding
self-similarities in the melodic structure. The vector v is an ordered
list of intervals. I could find them by hand, but this takes time and
things are easily missed. Besides, for a 200 pages manuscript coding the
vectors takes long, but finding similarities by hand takes
endless... :-(

The problem remains. I'm not sure I did completely understand the way R
works. My plan was to jump out of one function to another. I think what
R does is assigning a function's return value to an internal variable
and tries to evaluate another function WITHIN a calling function, which
of course leads to deep nesting and a bunch of internal variables. Too
bad there is no goto statement in R... Isn't there a way to make R
forget that it just evaluated e.g. alessn the moment it calles vavb?
That algorithm itself isn't that hard. In the end it's just a decision
diagram of the form if THIS, goto THIS knot, otherwise goto THAT knot.
Each knot has only one arrow pointing away from it, but sometimes more
than one pointing toward it. I could send the diagram as an attachement, if you 
like.

Cheers,
John

P.S.: Please keep messages on the list. Thank you!

__
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] String manipulation and formatting

2006-07-18 Thread Sean O'Riordain
Does it have to be a stop char ., or could it be a separate
parameter, i.e. put in a comma, then the 10 becomes an integer...

s/


On 18/07/06, Prof Brian Ripley [EMAIL PROTECTED] wrote:
 On Tue, 18 Jul 2006, Bashir Saghir (Aztek Global) wrote:

  Thanks to Richard, Gabor and Marc for some nice solutions to my request.
 
  I have a new problem:
 
 xify(30.10)
[1] X.X
 xify(30.11)
[1] XXX.XXX
 
  The problem originates from:
 
 as.numeric(unlist(strsplit(as.character(15.10), \\.)))
[1] 15  1
 as.numeric(unlist(strsplit(as.character(15.11), \\.)))
[1] 15 11
 
  It seems to boils down to:
 
 as.character(15.10)
[1] 15.1
 
  A simple solution is:
 
 xify(15.10)
[1] X.XX
 
  I was wondering if there is a simple way for xify to see the zero of the 10
  without having to force the user to add quotes around the format?

 No, as the parser has converted '15.10' to a numeric constant.

 What is the problem with asking users to enter strings as strings?

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


__
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] Object name and Strings?

2006-07-18 Thread Stéphane Cruveiller
Hi all,

Is there a simple way to convert an object name to a characters string?


Stéphane.

__
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] Object name and Strings?

2006-07-18 Thread Jacques VESLOT
  deparse(substitute(a))
[1] a

---
Jacques VESLOT

CNRS UMR 8090
I.B.L (2ème étage)
1 rue du Professeur Calmette
B.P. 245
59019 Lille Cedex

Tel : 33 (0)3.20.87.10.44
Fax : 33 (0)3.20.87.10.31

http://www-good.ibl.fr
---


Stéphane Cruveiller a écrit :
 Hi all,
 
 Is there a simple way to convert an object name to a characters string?
 
 
 Stéphane.
 
 __
 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] String manipulation and formatting

2006-07-18 Thread Bashir Saghir (Aztek Global)
In my opinion there is nothing wrong with asking the user to enter strings
as strings. I am working on some functions for SAS users (with limited R/S
experience) who are used to working with the SAS macro language. I was
trying to keep things simple for them by not forcing the use of quotes (a
style they use with their SAS macros). Given your explanation I'll just
document this feature in the help pages and use my time more productively
else where.

Thanks,
Saghir



-Original Message-
From: Prof Brian Ripley [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, July 18, 2006 10:24
To: Bashir Saghir (Aztek Global)
Cc: '[EMAIL PROTECTED]'
Subject: Re: [R] String manipulation and formatting


On Tue, 18 Jul 2006, Bashir Saghir (Aztek Global) wrote:

 Thanks to Richard, Gabor and Marc for some nice solutions to my request.
 
 I have a new problem:
 
xify(30.10)
   [1] X.X
xify(30.11)
   [1] XXX.XXX
 
 The problem originates from:
 
as.numeric(unlist(strsplit(as.character(15.10), \\.)))
   [1] 15  1
as.numeric(unlist(strsplit(as.character(15.11), \\.)))
   [1] 15 11
 
 It seems to boils down to:
 
as.character(15.10)
   [1] 15.1
 
 A simple solution is:
 
xify(15.10)
   [1] X.XX
 
 I was wondering if there is a simple way for xify to see the zero of the
10
 without having to force the user to add quotes around the format?

No, as the parser has converted '15.10' to a numeric constant.

What is the problem with asking users to enter strings as strings?

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


- 
Legal Notice: This electronic mail and its attachments are i...{{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] String manipulation and formatting

2006-07-18 Thread Bashir Saghir (Aztek Global)
As I am trying to maintain consistency with some SAS macros I prefer not to
change the standard definitions in use at the moment. If I change things
too much I don't think many people with use my new functions.

Thanks,
Saghir

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Sean O'Riordain
Sent: Tuesday, July 18, 2006 10:50
To: Bashir Saghir (Aztek Global)
Cc: [EMAIL PROTECTED]
Subject: Re: [R] String manipulation and formatting


Does it have to be a stop char ., or could it be a separate
parameter, i.e. put in a comma, then the 10 becomes an integer...

s/


On 18/07/06, Prof Brian Ripley [EMAIL PROTECTED] wrote:
 On Tue, 18 Jul 2006, Bashir Saghir (Aztek Global) wrote:

  Thanks to Richard, Gabor and Marc for some nice solutions to my request.
 
  I have a new problem:
 
 xify(30.10)
[1] X.X
 xify(30.11)
[1] XXX.XXX
 
  The problem originates from:
 
 as.numeric(unlist(strsplit(as.character(15.10), \\.)))
[1] 15  1
 as.numeric(unlist(strsplit(as.character(15.11), \\.)))
[1] 15 11
 
  It seems to boils down to:
 
 as.character(15.10)
[1] 15.1
 
  A simple solution is:
 
 xify(15.10)
[1] X.XX
 
  I was wondering if there is a simple way for xify to see the zero of the
10
  without having to force the user to add quotes around the format?

 No, as the parser has converted '15.10' to a numeric constant.

 What is the problem with asking users to enter strings as strings?

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



- 
Legal Notice: This electronic mail and its attachments are i...{{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] Object name and Strings?

2006-07-18 Thread Prof Brian Ripley
On Tue, 18 Jul 2006, Stéphane Cruveiller wrote:

 Hi all,
 
 Is there a simple way to convert an object name to a characters string?

Yes, as.character, as in

 x - as.name(foo)
 x
foo
 as.character(x)
[1] foo

However, I suspect you are not using the words in their technical sense
(a name is a synonym for a symbol in R), so if this is not the answer, 
please give us an example of what you are trying to do (which might be 
deparse).

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


[R] package installation problems

2006-07-18 Thread Demmler J.
Hello,

I just updated from R 2.1.1 to R 2.3.1 (I also updated from Fedora 3 to
Fedora 4 if that is of any importance). However, several packages (e.g.
fields etc.) refuse to be installed. I get the following error message:

[EMAIL PROTECTED] R-files]# R CMD INSTALL fields_2.3.tar.gz
* Installing *source* package 'fields' ...
** libs
g77   -fpic  -O2 -g -pipe -m32 -march=i386 -mtune=pentium4 -c css.f -o css.o
f771: invalid option `tune=pentium4'
make: *** [css.o] Error 1
ERROR: compilation failed for package 'fields'
** Removing '/usr/lib/R/library/fields'

For some reason -mtune is set to Pentium 4, although I'm using an Athlon-XP.
I searched the files in the fields package for this line but couldn't find
it. Other packages, like f.i. maps didn't have any problems.

I hope anyone can help me, as I need those packages urgently for my PhD
project.

Joanne

__
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 datasets in R

2006-07-18 Thread Daniele Medri
Il giorno lun, 17/07/2006 alle 15.00 -0400, Deepankar Basu ha scritto:
 I have been trying to read up the posting on the R-archive on this
 topic; but I could not really understand all the discussion, nor could I
 reach the end. So, I am not aware of the current state of consensus on
 the issue. 

a general hint is to store this dataset in a database and manage your
data with RODBC or other db-related packages.

cheers
-- 
Daniele Medri

__
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] Object name and Strings?

2006-07-18 Thread Stéphane Cruveiller
Thanks for your answer.

Here is what I am trying to do.
I have a list which is called MyList. I would like to get only the name
of this object as a simple characters string. i.e. Is there a function 
in R which is able
to give:

  name-fun(Mylist)
  name
MyList


thanks in advance,

Stéphane.



Prof Brian Ripley a écrit :
 On Tue, 18 Jul 2006, Stéphane Cruveiller wrote:

   
 Hi all,

 Is there a simple way to convert an object name to a characters string?
 

 Yes, as.character, as in

   
 x - as.name(foo)
 x
 
 foo
   
 as.character(x)
 
 [1] foo

 However, I suspect you are not using the words in their technical sense
 (a name is a synonym for a symbol in R), so if this is not the answer, 
 please give us an example of what you are trying to do (which might be 
 deparse).



__
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] Object name and Strings?

2006-07-18 Thread Prof Brian Ripley
On Tue, 18 Jul 2006, Stéphane Cruveiller wrote:

 Thanks for your answer.
 
 Here is what I am trying to do.
 I have a list which is called MyList. I would like to get only the name
 of this object as a simple characters string. i.e. Is there a function in R
 which is able
 to give:
 
  name-fun(Mylist)
  name
 MyList

myfun - function(x) deparse(substitute(x))

That's how to find the name (if it was a name) given as a function 
argument.

 
 
 thanks in advance,
 
 Stéphane.
 
 
 
 Prof Brian Ripley a écrit :
  On Tue, 18 Jul 2006, Stéphane Cruveiller wrote:
 

   Hi all,
  
   Is there a simple way to convert an object name to a characters string?
   
 
  Yes, as.character, as in
 

   x - as.name(foo)
   x
   
  foo

   as.character(x)
   
  [1] foo
 
  However, I suspect you are not using the words in their technical sense
  (a name is a synonym for a symbol in R), so if this is not the answer,
  please give us an example of what you are trying to do (which might be
  deparse).

-- 
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] Object name and Strings?

2006-07-18 Thread Stéphane Cruveiller
That is exactly what I wanted to do...

Thanks for the hint...

Stéphane.

Prof Brian Ripley a écrit :
 On Tue, 18 Jul 2006, Stéphane Cruveiller wrote:

   
 Thanks for your answer.

 Here is what I am trying to do.
 I have a list which is called MyList. I would like to get only the name
 of this object as a simple characters string. i.e. Is there a function in R
 which is able
 to give:

 
 name-fun(Mylist)
 name
   
 MyList
 

 myfun - function(x) deparse(substitute(x))

 That's how to find the name (if it was a name) given as a function 
 argument.

   
 thanks in advance,

 Stéphane.



 Prof Brian Ripley a écrit :
 
 On Tue, 18 Jul 2006, Stéphane Cruveiller wrote:

   
   
 Hi all,

 Is there a simple way to convert an object name to a characters string?
 
 
 Yes, as.character, as in

   
   
 x - as.name(foo)
 x
 
 
 foo
   
   
 as.character(x)
 
 
 [1] foo

 However, I suspect you are not using the words in their technical sense
 (a name is a synonym for a symbol in R), so if this is not the answer,
 please give us an example of what you are trying to do (which might be
 deparse).
   



__
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] Spectral data analysis - parameter selection

2006-07-18 Thread Dirk De Becker
Hello all,

I am doing some spectral data analysis using R, and I already got some 
help on how to do savitsky-golay preprocessing. Now I would like to 
perform parameter selection (i.e. I would like to assess which spectral 
lines are relevant to keep in the model, and which are not).
There exist algorithms like the jacknife algorithm, but I was wondering 
whether anyone has already implemented something like that, and if not, 
if anyone could give me a few hints on how to start implementing it myself.

Thanks in advance,

Dirk

-- 
Dirk De Becker
Work: Kasteelpark Arenberg 30
  3001 Heverlee
  phone: ++32(0)16/32.14.44
  fax: ++32(0)16/32.85.90
Home: Waversebaan 90
  3001 Heverlee
  phone: ++32(0)16/23.36.65
[EMAIL PROTECTED]
mobile phone: ++32(0)498/51.19.86


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] String manipulation and formatting

2006-07-18 Thread Hans-Joerg Bibiko
Hi,

only if you allow to input x as a string then you can use, maybe,  
simply the following one-line-command:

xify - function(x)
{
gsub(
[0-9],
X,
sprintf(
paste(%,ifelse(regexpr(\\.,x)  0, x, x-paste(x,. 
0,sep=)), f,sep=),

10^(trunc(as.numeric(x))-as.integer(gsub((.*?)\\.(.*?),\\2,x))-1)
)
)
}

  xify(30.10)
  [1] .XX

Hans-Joerg


 Thanks to Richard, Gabor and Marc for some nice solutions to my  
 request.

 I have a new problem:

 xify(30.10)
   [1] X.X
 xify(30.11)
   [1] XXX.XXX

 The problem originates from:

 as.numeric(unlist(strsplit(as.character(15.10), \\.)))
   [1] 15  1
 as.numeric(unlist(strsplit(as.character(15.11), \\.)))
   [1] 15 11

 It seems to boils down to:

 as.character(15.10)
   [1] 15.1

 A simple solution is:

 xify(15.10)
   [1] X.XX

 I was wondering if there is a simple way for xify to see the zero  
 of the
 10
 without having to force the user to add quotes around the format?

 No, as the parser has converted '15.10' to a numeric constant.

 What is the problem with asking users to enter strings as strings?


__
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] package installation problems

2006-07-18 Thread Prof Brian Ripley
On Tue, 18 Jul 2006, Demmler J. wrote:

 Hello,
 
 I just updated from R 2.1.1 to R 2.3.1 (I also updated from Fedora 3 to

How?  Did you install an RPM?  Before or after OS update?
I checked the RPM for fc4 on CRAN which has

  C compiler:gcc  -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 
-fexceptions -m32 -march=i386 -mtune=pentium4 -fasynchronous-unwind-tables
  Fortran 77 compiler:   gfortran  -O2 -g -pipe 
-Wp,-D_FORTIFY_SOURCE=2 -fexceptions -m32 -march=i386 -mtune=pentium4 
-fasynchronous-unwind-tables

  C++ compiler:  g++  -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 
-fexceptions -m32 -march=i386 -mtune=pentium4 -fasynchronous-unwind-tables
  Fortran 90/95 compiler:gfortran -g -O2

not as you show.  However, read on.

 Fedora 4 if that is of any importance). However, several packages (e.g.
 fields etc.) refuse to be installed. I get the following error message:
 
 [EMAIL PROTECTED] R-files]# R CMD INSTALL fields_2.3.tar.gz
 * Installing *source* package 'fields' ...
 ** libs
 g77   -fpic  -O2 -g -pipe -m32 -march=i386 -mtune=pentium4 -c css.f -o css.o
 f771: invalid option `tune=pentium4'
 make: *** [css.o] Error 1
 ERROR: compilation failed for package 'fields'
 ** Removing '/usr/lib/R/library/fields'
 
 For some reason -mtune is set to Pentium 4, although I'm using an Athlon-XP.

That may not actually be a problem: the problem is that your compiler is 
not recognizing -mtune.   (I seem to have run R RPMs for fc3 with 
-march=i386 -mtune=pentium4 on a dual Athlon MP.  'tune' should generate 
code that runs on other CPUs, just not optimally.)

 I searched the files in the fields package for this line but couldn't find
 it. Other packages, like f.i. maps didn't have any problems.
 
 I hope anyone can help me, as I need those packages urgently for my PhD
 project.

The options are coming from the version of R you installed.  I would 
expect R compiled for FC4 to be using gfortran not g77 (as in the CRAN 
RPM).  The simplest way out here is compile R from the sources on your 
actual machine, but you could try replacing your RPM with the CRAN fc4 
one.


-- 
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] Output and Word

2006-07-18 Thread mail
Hi, 

you might try to use the R2HTML package and then import the html files into 
word. please see. http://cran.r-project.org/doc/Rnews/Rnews_2003-3.pdf

Another way: use sweave for tex/latex output and transform it to rtf.

Friedrich Schuster

--- 
Your post was: 
sharon snowdon sharonsnowdon at fastmail.fm 
Hi

I have just started to have a look at R. I have used most stats software
packages and can use perl, visual basic etc. I am interested in how well
it handles lots of output e.g. tables or charts. How would you get lots
of output most easily and quickly into a Word document?

Sharon Snowdon

__
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] Nested functions

2006-07-18 Thread John Wiedenhoeft
 I was checking out your function and thinking of trying to make it more 
 efficient when I noticed your comment above. 

:-D

 Yes, bioinformatics is full 
 of this stuff - have a look at Bioconductor.

I'm about it, but it'll take some time. It's a vast repository...

For the meantime, I've attached a graph for clarification ;-)
Dashed lines are followed if the test returns FALSE, solid if TRUE.

Cheers,
John


diagramm.ps
Description: PostScript document
__
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] Running R as root

2006-07-18 Thread roderick . castillo
Hello
Using R v. 2.3.1 which I installed recently, when I start it as root, there
is nothing
I can do. I get Error: function xx not found even when trying to leave R
using
q(). R works fine when started by an ordinary user. I rechecked the root
environment
several times and even have set it similar to that of an ordinary user
(values of
PATH etc.) but nothing helps. Using the command env did not reveal
anything
valuable. Going to root through the identity of an ordinary user and
retaining his
environment by doing su user instead of su - user does not help either.

This does not seem related to the particular version of R.
Using: Linux RedHat AS 2.1

Any hint?

Bye

Rick

__
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] Running R as root

2006-07-18 Thread Peter Dalgaard
[EMAIL PROTECTED] writes:

 Hello
 Using R v. 2.3.1 which I installed recently, when I start it as root, there
 is nothing
 I can do. I get Error: function xx not found even when trying to leave R
 using
 q(). R works fine when started by an ordinary user. I rechecked the root
 environment
 several times and even have set it similar to that of an ordinary user
 (values of
 PATH etc.) but nothing helps. Using the command env did not reveal
 anything
 valuable. Going to root through the identity of an ordinary user and
 retaining his
 environment by doing su user instead of su - user does not help either.
 
 This does not seem related to the particular version of R.
 Using: Linux RedHat AS 2.1
 
 Any hint?

File permissions? (it is possible to set them so that files can be
read by anyone except the user...)

How exactly did you install R, and are there any other clues upon
startup? 

I get, BTW

 aa()
Error: could not find function aa

so I suspect you paraphrased the error message.

One other thing that can cause trouble is networked directories. Files
that are physically on another machine can sometimes not be accessed
by root on the local machine.

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


[R] Package for autocorrelation analysis?

2006-07-18 Thread Ivan Rubio Perez
Hi!
Dear All,

I want to implement an autocorrelation analysis and estimated the Moran's I in 
a set of
ecological traits. I seek for an R package that do this analysis, however, I 
couldn't
found none that implement it. May be I'm lost in the universe of the Contributed
Packages but I couldn't found information into the index of some packages that 
I suppose
do it. Would you give me some recommendations to do an autocorrelation analysis?

Thanks!

Ivan

Ivan V. Rubio Pérez
[EMAIL PROTECTED]
Instituto de Ecología, UNAM
www.ecologia.unam.mx
--
Open WebMail Project (http://openwebmail.org)

__
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] Running R as root

2006-07-18 Thread roderick . castillo
Problem solved: I had a .Renviron file in root's Home directory pointing to
the
wrong R installation...

Thanks anyway
Rick

__
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] Output and Word

2006-07-18 Thread Gabor Grothendieck
If its text that you want included in a larger Word document
you can create a text or HTML file from R and then when inserting it
into Word insert it as a link rather than copying it in.

output a file from R
In Word
   Insert | File
   browse to the file so its name appears in the File name box
   click on the down arrow to the right of the Insert button
 and choose Insert as Link

If you regenerate the file in the future your Word document gets
automatically uipdated.

Another possibility is either the rcom and RDCOMClient packages
which allow one to control Word from R by treating Word as a COM object.
This allows detailed control of Word but is more work.  e.g. Here
we create a Word document from scratch.  Note that you must
be running Windows and have Word on the machine where you do
this:

library(RDCOMClient)
ow - COMCreate(Word.Application)
ow[[Visible]] - TRUE  # optional
od - ow[[Documents]]$Add()

od[[PageSetup]][[LeftMargin]] - 20
od[[PageSetup]][[TopMargin]] - 20

od[[Content]][[Font]][[Size]] - 11
od[[Content]][[Text]] - Hello World

od$SaveAs(\\mydoc.doc)
ow$Quit()


On 7/17/06, sharon snowdon [EMAIL PROTECTED] wrote:
 Hi

 I have just started to have a look at R. I have used most stats software
 packages and can use perl, visual basic etc. I am interested in how well
 it handles lots of output e.g. tables or charts. How would you get lots
 of output most easily and quickly into a Word document?

 Sharon Snowdon



 
 -
 FIGHT BACK AGAINST SPAM!
 Download Spam Inspector, the Award Winning Anti-Spam Filter
 http://mail.giantcompany.com



 --



 7/14/2006

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


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


[R] Surv analysis with multiple internal time-dep covariates measured over different time intervals

2006-07-18 Thread z . dalton
Hi,

I am analysing survival data (diagnosis time until death/cens) with 
time-dependent

 covariates.  I would like to fit a cox model using the (start, stop] variable.

   

  In summary, I have the multiple internal time dependent covariates as follows;



1). LAS score (measured weekly on low risk patients, monthly on high risk)


2). EORTC score (measured monthly on low risk patients and every 3 months on

 high risk)
3). BMI (measured monthly on low risk patients and every 3 months on high risk)



I have referred to the John Fox 'Cox Proportional-Hazards Regression for 
Survival

 Data' 
http://cran.r-project.org/doc/contrib/Fox-Companion/appendix-cox-regression.pdf

 
and the corresponding script file at 
http://cran.r-project.org/doc/contrib/Fox-Companion/cox-regression.txt

and also to Therneau and Grambsch.

My problem is creating the dataset, possibly using the fold function (as 
described

 in Fox, p9) with more than one time-dependent covariate  (which I successfully

 did with LAS).  I have longitudinal measurements for each subject (with each

 date of assessment) as above with some missing data in a period of time before

 death (which I have entered as NA).

Since the measurements in time depend on whether the patient is high or low

 risk and are made at different time intervals for each covariate, I wasn't

 sure how to code this in R.

I would be really grateful if anyone could start me off on this.

Thank you to those who respond.

Zoe

__
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] Output and Word

2006-07-18 Thread Neuro LeSuperHéros
R can handle as many graphs/table as you ask it to.

I don't know what you're trying to do, but I generate lots of graphs using 
loops and generating filenames on the spot.

See FAQ 7.34 to see how it's done.
http://cran.r-project.org/doc/FAQ/R-FAQ.html#How-can-I-save-the-result-of-each-iteration-in-a-loop-into-a-separate-file_003f

For graphs, save the graphs as something windows can recognize (jpeg, png, 
emf, wmf...) and in Word, you can easily import all the graphs in a 
directory by doing Insert/Picture/From File and shift-click all the graphs 
you want.  Word will import them all.

For tables, it really depends on what you want because usually there is 
formatting involved.  Personnaly, if I had to produce several tables to be 
imported in Word, I would use the R2HTML library in a loop (as mentionned 
above) and import the multiple html files using Insert/File (and 
shift-click) in Word.

Neuro

From: sharon snowdon [EMAIL PROTECTED]
Reply-To: [EMAIL PROTECTED]
To: r-help@stat.math.ethz.ch
Subject: [R] Output and Word
Date: Tue, 18 Jul 2006 06:35:38 +1000

Hi

I have just started to have a look at R. I have used most stats software
packages and can use perl, visual basic etc. I am interested in how well
it handles lots of output e.g. tables or charts. How would you get lots
of output most easily and quickly into a Word document?

Sharon Snowdon




-
FIGHT BACK AGAINST SPAM!
Download Spam Inspector, the Award Winning Anti-Spam Filter
http://mail.giantcompany.com



--



7/14/2006

__
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



From: sharon snowdon [EMAIL PROTECTED]
Reply-To: [EMAIL PROTECTED]
To: r-help@stat.math.ethz.ch
Subject: [R] Output and Word
Date: Tue, 18 Jul 2006 06:35:38 +1000

Hi

I have just started to have a look at R. I have used most stats software
packages and can use perl, visual basic etc. I am interested in how well
it handles lots of output e.g. tables or charts. How would you get lots
of output most easily and quickly into a Word document?

Sharon Snowdon




-
FIGHT BACK AGAINST SPAM!
Download Spam Inspector, the Award Winning Anti-Spam Filter
http://mail.giantcompany.com



--



7/14/2006

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

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


Re: [R] Nested functions

2006-07-18 Thread Richard M. Heiberger
Please look at

http://www.turbulence.org/Works/song/

This is a website by Martin Wattenberg that visually displays
the types of patterns you are looking for.  He gave a paper
at the Joint Statistics Meetings in Minneapolis 2005.

__
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] Package for autocorrelation analysis?

2006-07-18 Thread Gavin Simpson
On Tue, 2006-07-18 at 07:10 -0500, Ivan Rubio Perez wrote:
 Hi!
 Dear All,
 
 I want to implement an autocorrelation analysis and estimated the Moran's I 
 in a set of
 ecological traits. I seek for an R package that do this analysis, however, I 
 couldn't
 found none that implement it. May be I'm lost in the universe of the 
 Contributed
 Packages but I couldn't found information into the index of some packages 
 that I suppose
 do it. Would you give me some recommendations to do an autocorrelation 
 analysis?
 
 Thanks!
 
 Ivan

Please, learn to help yourself and use the tools provided. Also, don't
post a new message to the list by replying to an existing thread it
really messes up the archives!

Try, from within R:

RSiteSearch(Moran)

and 

RSiteSearch(spatial autocorrelation, restrict = functions)

Both seem to produce suitable results.

You should also check out the spatial Task View on CRAN to get an
overview of suitable packages out there that might do what you want.
Choose a mirror near to you from here
http://cran.r-project.org/mirrors.html and then select Task Views in
menu on the left. 

HTH

G
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Gavin Simpson [t] +44 (0)20 7679 0522
 ECRC  ENSIS, 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/cv/
 London, UK. WC1E 6BT. [w] http://www.ucl.ac.uk/~ucfagls/
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

__
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] FW: Large datasets in R

2006-07-18 Thread Marshall Feldman
Hi,

I have two further comments/questions about large datasets in R.
 
1. Does R's ability to handle large datasets depend on the operating
system's use of virtual memory? In theory, at least, VM should make the
difference between installed RAM and virtual memory on a hard drive
primarily a determinant of how fast R will calculate rather than whether or
not it can do the calculations. However, if R has some low-level routines
that have to be memory resident and use more memory as the amount of data
increases, this may not hold. Can someone shed light on this?

2. Is What 64-bit versions of R are available at present?

Marsh Feldman
The University of Rhode Island

-Original Message-
From: Thomas Lumley [mailto:[EMAIL PROTECTED] 
Sent: Monday, July 17, 2006 3:21 PM
To: Deepankar Basu
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] Large datasets in R

On Mon, 17 Jul 2006, Deepankar Basu wrote:

 Hi!

 I am a student of economics and currently do most of my statistical work
 using STATA. For various reasons (not least of which is an aversion for
 proprietary software), I am thinking of shifting to R. At the current
 juncture my concern is the following: would I be able to work on
 relatively large data-sets using R? For instance, I am currently working
 on a data-set which is about 350MB in size. Would be possible to work
 data-sets of such sizes using R?


The answer depends on a lot of things, but most importantly
1) What you are going to do with the data
2) Whether you have a 32-bit or 64-bit version of R
3) How much memory your computer has.

In a 32-bit version of R (where R will not be allowed to address more than 
2-3Gb of memory) an object of size 350Mb is large enough to cause problems 
(see eg the R Installation and Adminstration Guide).

If your 350Mb data set has lots of variables and you only use a few at a 
time then you may not have any trouble even on a 32-bit system once you 
have read in the data.

If you have a 64-bit version of R and a few Gb of memory then there should 
be no real difficulty in working with that size of data set for most 
analyses.  You might come across some analyses (eg some cluster analysis 
functions) that use n^2 memory for n observations and so break down.


-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] RSiteSearch() not in posting guide

2006-07-18 Thread Gavin Simpson
Hi,

In a recent reply I sent to the list, my initial response was to
suggest, politely that by reading the posting guide and learning to use
the supplied tools one can often help oneself. I then went on to say
that reading the posting guide would have led you to RSiteSearch(insert
query). Luckily I went to the posting guide to check this was there
before posting and much to my surprise that page does not once mention
this excellent facility!

In the section Do your homework before posting:, help.search()
and ?foo are recommended, but these only work for installed, and
possibly loaded, packages. Wouldn't it be better to suggest a user try
RSiteSearch(foo) as well? This way they are far more likely to find
something relevant if that something resides on CRAN or the mailing list
archives.

Can I suggest adding another bullet with the following text to the Do
your homework before posting: section:

Do RSiteSearch(keyword) with different keywords (type this at the R
prompt) to search R, contributed packages and R-Help postings. To
restrict the search to functions only, use RSiteSearch(keyword,
restrict = functions). See ?RSiteSearch.

or shorter:

Do RSiteSearch(keyword) with different keywords (type this at the R
prompt) to search R functions, contributed packages and R-Help postings.
See ?RSiteSearch for further options and to restrict searches.

G
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Gavin Simpson [t] +44 (0)20 7679 0522
 ECRC  ENSIS, 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/cv/
 London, UK. WC1E 6BT. [w] http://www.ucl.ac.uk/~ucfagls/
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

__
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] RSiteSearch() not in posting guide

2006-07-18 Thread Gabor Grothendieck
I think the posting guide may have been written prior to the
existence of RSiteSearch as a builtin command.

On 7/18/06, Gavin Simpson [EMAIL PROTECTED] wrote:
 Hi,

 In a recent reply I sent to the list, my initial response was to
 suggest, politely that by reading the posting guide and learning to use
 the supplied tools one can often help oneself. I then went on to say
 that reading the posting guide would have led you to RSiteSearch(insert
 query). Luckily I went to the posting guide to check this was there
 before posting and much to my surprise that page does not once mention
 this excellent facility!

 In the section Do your homework before posting:, help.search()
 and ?foo are recommended, but these only work for installed, and
 possibly loaded, packages. Wouldn't it be better to suggest a user try
 RSiteSearch(foo) as well? This way they are far more likely to find
 something relevant if that something resides on CRAN or the mailing list
 archives.

 Can I suggest adding another bullet with the following text to the Do
 your homework before posting: section:

 Do RSiteSearch(keyword) with different keywords (type this at the R
 prompt) to search R, contributed packages and R-Help postings. To
 restrict the search to functions only, use RSiteSearch(keyword,
 restrict = functions). See ?RSiteSearch.

 or shorter:

 Do RSiteSearch(keyword) with different keywords (type this at the R
 prompt) to search R functions, contributed packages and R-Help postings.
 See ?RSiteSearch for further options and to restrict searches.

 G
 --
 %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
  Gavin Simpson [t] +44 (0)20 7679 0522
  ECRC  ENSIS, 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/cv/
  London, UK. WC1E 6BT. [w] http://www.ucl.ac.uk/~ucfagls/
 %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

 __
 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] FW: Large datasets in R

2006-07-18 Thread Roger D. Peng
In my experience, the OS's use of virtual memory is only relevant in the rough 
sense that the OS can store *other* running applications in virtual memory so 
that R can use as much of the physical memory as possible.  Once R itself 
overflows into virtual memory it quickly becomes unusable.

I'm not sure I understand your second question.  As R is available in source 
code form, it can be compiled for many 64-bit operating systems.

-roger

Marshall Feldman wrote:
 Hi,
 
 I have two further comments/questions about large datasets in R.
  
 1. Does R's ability to handle large datasets depend on the operating
 system's use of virtual memory? In theory, at least, VM should make the
 difference between installed RAM and virtual memory on a hard drive
 primarily a determinant of how fast R will calculate rather than whether or
 not it can do the calculations. However, if R has some low-level routines
 that have to be memory resident and use more memory as the amount of data
 increases, this may not hold. Can someone shed light on this?
 
 2. Is What 64-bit versions of R are available at present?
 
   Marsh Feldman
   The University of Rhode Island
 
 -Original Message-
 From: Thomas Lumley [mailto:[EMAIL PROTECTED] 
 Sent: Monday, July 17, 2006 3:21 PM
 To: Deepankar Basu
 Cc: r-help@stat.math.ethz.ch
 Subject: Re: [R] Large datasets in R
 
 On Mon, 17 Jul 2006, Deepankar Basu wrote:
 
 Hi!

 I am a student of economics and currently do most of my statistical work
 using STATA. For various reasons (not least of which is an aversion for
 proprietary software), I am thinking of shifting to R. At the current
 juncture my concern is the following: would I be able to work on
 relatively large data-sets using R? For instance, I am currently working
 on a data-set which is about 350MB in size. Would be possible to work
 data-sets of such sizes using R?
 
 
 The answer depends on a lot of things, but most importantly
 1) What you are going to do with the data
 2) Whether you have a 32-bit or 64-bit version of R
 3) How much memory your computer has.
 
 In a 32-bit version of R (where R will not be allowed to address more than 
 2-3Gb of memory) an object of size 350Mb is large enough to cause problems 
 (see eg the R Installation and Adminstration Guide).
 
 If your 350Mb data set has lots of variables and you only use a few at a 
 time then you may not have any trouble even on a 32-bit system once you 
 have read in the data.
 
 If you have a 64-bit version of R and a few Gb of memory then there should 
 be no real difficulty in working with that size of data set for most 
 analyses.  You might come across some analyses (eg some cluster analysis 
 functions) that use n^2 memory for n observations and so break down.
 
 
   -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.
 

-- 
Roger D. Peng  |  http://www.biostat.jhsph.edu/~rpeng/

__
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] R and DDE (Dynamic Data Exchange)

2006-07-18 Thread Philippe Grosjean
Hello Vincent,

I think there is not much else than tcltk2. It is a complete 
implementation of DDE (client/server), so it should fit your needs. 
There are lots of examples on the man page. Please, if you think it 
could be helpful for other users, do submit examples. I think real-time 
acquisition of data through DDE under Windows would interest a couple of 
users (including myself).
Best,

Philippe Grosjean

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

[EMAIL PROTECTED] wrote:
 R and DDE (Dynamic Data Exchange)
 
 Dear Rusers,
 I run an application (not mine) which acts as a DDE server.
 I would like to use R to get data from this application,
 say once per minute, and do some processing on it.
 I didn't find much info on the R DDE abilities, apart the tcltk2
 package in which I will try to go deeper.
 I would be very thankful for any info, pointer or advice about the
 good ways to make R program get online data from a DDE server.
 Thanks
 Vincent
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 


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


Re: [R] FW: Large datasets in R

2006-07-18 Thread Prof Brian Ripley
On Tue, 18 Jul 2006, Marshall Feldman wrote:

 Hi,
 
 I have two further comments/questions about large datasets in R.
  
 1. Does R's ability to handle large datasets depend on the operating
 system's use of virtual memory? In theory, at least, VM should make the
 difference between installed RAM and virtual memory on a hard drive
 primarily a determinant of how fast R will calculate rather than whether or
 not it can do the calculations. However, if R has some low-level routines
 that have to be memory resident and use more memory as the amount of data
 increases, this may not hold. Can someone shed light on this?

The issue is address space, not RAM.  The limits Thomas mentions are on 
VM, not RAM, and it is common to have at least as much RAM installed as 
the VM address space for a user process.

There is no low-level code in R that has any idea if it is 
memory-resident, nor AFAIK is there any portable way to do so in a user 
process in a modern OS.  (R is as far as possible written to C99 and POSIX 
standards.)

 2. Is What 64-bit versions of R are available at present?

Any OS with a 64-bit CPU that you can find a viable 64-bit compiler suite 
for.  We've had 64-bit versions of R since the last millenium on Solaris, 
IRIX, HP-UX, OSF/1 and more recently on AIX, FreeBSD, Linux, MacOS X (on 
so-called G5) and probably others.

The exception is probably Windows, for which there is no known free 
`viable 64-bit compiler suite', but it is likely that there are commercial 
ones.
 

 
   Marsh Feldman
   The University of Rhode Island
 
 -Original Message-
 From: Thomas Lumley [mailto:[EMAIL PROTECTED] 
 Sent: Monday, July 17, 2006 3:21 PM
 To: Deepankar Basu
 Cc: r-help@stat.math.ethz.ch
 Subject: Re: [R] Large datasets in R
 
 On Mon, 17 Jul 2006, Deepankar Basu wrote:
 
  Hi!
 
  I am a student of economics and currently do most of my statistical work
  using STATA. For various reasons (not least of which is an aversion for
  proprietary software), I am thinking of shifting to R. At the current
  juncture my concern is the following: would I be able to work on
  relatively large data-sets using R? For instance, I am currently working
  on a data-set which is about 350MB in size. Would be possible to work
  data-sets of such sizes using R?
 
 
 The answer depends on a lot of things, but most importantly
 1) What you are going to do with the data
 2) Whether you have a 32-bit or 64-bit version of R
 3) How much memory your computer has.
 
 In a 32-bit version of R (where R will not be allowed to address more than 
 2-3Gb of memory) an object of size 350Mb is large enough to cause problems 
 (see eg the R Installation and Adminstration Guide).
 
 If your 350Mb data set has lots of variables and you only use a few at a 
 time then you may not have any trouble even on a 32-bit system once you 
 have read in the data.
 
 If you have a 64-bit version of R and a few Gb of memory then there should 
 be no real difficulty in working with that size of data set for most 
 analyses.  You might come across some analyses (eg some cluster analysis 
 functions) that use n^2 memory for n observations and so break down.
 
 
   -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.
 

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


[R] using split.screen?

2006-07-18 Thread Bill Shipley
Hello.  I am having trouble understanding the use of split.screen.  I want
to divide the device surface first into 4 equal screens:
split.screen(figs=c(2,2))
 
This works.
 
I next want to subdivide each of these 4 screens into 10 subscreens.  I do,
for the first of these 4 screens:
 
screen(1,new=T)
and then: split.screen(figs=c(10,2))
 
My understanding is that this should split screen 1 (i.e. top right) into 10
screens within its area.  However, this does not work and I get the
following error message: Error in plot.new() : figure margins too large

Does anyone know what I am doing wrong? 
 

Bill Shipley

 

 

[[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] Inflated Array

2006-07-18 Thread Hadassa Brunschwig
Hi R-users!

I am trying to create a what I call inflated array (maybe there is
already some other name for that). It is an array that changes
dinamically its dimensions, e.g. the higher the number of third
dimensions, the more rows in the array. So for example the array could
look like the following:

, ,1

1 2 3 4

, , 2

5   6   7  8
9 10 11 12

, , 3

13 14 15 16
17 18 19 20
21 22 23 24

Has anybody a comment on how to build this in the most efficient
manner (I know i could do looping)?

Thanks!

Hadassa

__
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] R and DDE (Dynamic Data Exchange)

2006-07-18 Thread Gabor Grothendieck
You can access DDE via COM as in this example
which uses DDE to open an Excel file.  Note that
Excel also supports COM directly and normally
one would use COM with Excel, not DDE, so you
might check if your application also supports COM.

# opens an excel spreadsheet c:\test.xls using dde
library(RDCOMClient)
sh - COMCreate(Shell.Application)
sh$Namespace(C:\\)$ParseName(test.xls)$InvokeVerb(Open)

Also if you are going to access DDE via COM or just COM also
check out the rcom package which is similar to RDCOMClient.

On 7/17/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 R and DDE (Dynamic Data Exchange)

 Dear Rusers,
 I run an application (not mine) which acts as a DDE server.
 I would like to use R to get data from this application,
 say once per minute, and do some processing on it.
 I didn't find much info on the R DDE abilities, apart the tcltk2
 package in which I will try to go deeper.
 I would be very thankful for any info, pointer or advice about the
 good ways to make R program get online data from a DDE server.
 Thanks
 Vincent

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


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


Re: [R] using split.screen?

2006-07-18 Thread Prof Brian Ripley
On Tue, 18 Jul 2006, Bill Shipley wrote:

 Hello.  I am having trouble understanding the use of split.screen.  I want
 to divide the device surface first into 4 equal screens:
 split.screen(figs=c(2,2))
  
 This works.
  
 I next want to subdivide each of these 4 screens into 10 subscreens.  I do,
 for the first of these 4 screens:
  
 screen(1,new=T)
 and then: split.screen(figs=c(10,2))
  
 My understanding is that this should split screen 1 (i.e. top right) 

That is screen 2: 1 is top left.

 into 10
 screens within its area.  However, this does not work and I get the
 following error message: Error in plot.new() : figure margins too large

well, only when you try to plot on one of those screens.

 Does anyone know what I am doing wrong? 

I suspect not using a big enough device region to allow such small plot 
regions.  You are asking for 20 rows in your device region.

Oh, and sending HTML mail.

 Bill Shipley
 
   [[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.
 

-- 
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] using split.screen? [Broadcast]

2006-07-18 Thread Wiener, Matthew
This means that the margins for 10 screens would take up more room than you
have - essentially the plot area is being squeezed to nothing.  You can try
reducing your margins using par.

Also, it looks like you're trying to split into 20 screens there.

Hope this helps,

Matt 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Bill Shipley
Sent: Tuesday, July 18, 2006 10:02 AM
To: R help list
Subject: [R] using split.screen? [Broadcast]

Hello.  I am having trouble understanding the use of split.screen.  I want
to divide the device surface first into 4 equal screens:
split.screen(figs=c(2,2))
 
This works.
 
I next want to subdivide each of these 4 screens into 10 subscreens.  I do,
for the first of these 4 screens:
 
screen(1,new=T)
and then: split.screen(figs=c(10,2))
 
My understanding is that this should split screen 1 (i.e. top right) into 10
screens within its area.  However, this does not work and I get the
following error message: Error in plot.new() : figure margins too large

Does anyone know what I am doing wrong? 
 

Bill Shipley

 

 

[[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] FW: Large datasets in R

2006-07-18 Thread Ritwik Sinha
Hi,

I have a related question. How differently do other statistical
softwares handle large data?

The original post claims that 350 MB is fine on Stata. Some one
suggested S-Plus. I have heard people say that SAS can handle large
data sets. Why can others do it and R seem to have a problem? Don't
these softwares load the data onto RAM.

-- 
Ritwik Sinha
Graduate Student
Epidemiology and Biostatistics
Case Western Reserve University

http://darwin.cwru.edu/~rsinha

__
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] Nested functions

2006-07-18 Thread Thomas Lumley
On Mon, 17 Jul 2006, John Wiedenhoeft wrote:

 Hi there,

 I'm having myself a hard time writing an algorithm for finding patterns
 within a given melody. In a vector I'd like to find ALL sequences that
 occur at least twice, without having to check all possible patterns via
 pattern matching.


Another approach, which works for not-too-long vectors like you have is:

   n - length(v)
   matches - outer(v, v, ==)  outer(1:n,1:n,=)

Now matches has TRUE where v[i]==v[j]. For a longer match you would also 
need v[i+1]==v[j+1] and so on, making a diagonal line through the matrix. 
Diagonal lines are hard, so let's turn them into horizontal lines

   matches - matrix(cbind(matches, FALSE), ncol=n)

now row i+1 column j of matches is TRUE for a single entry match starting 
at position j at a separation of i.  If there is a match of length 2, then 
column j+1 will also be TRUE, and so on.

Now rle() applied to a row will return the lengths of consecutive 
sequences of TRUE and FALSE. The lengths of consecutive sequences of TRUE 
are the lengths of the matches. To get rid of trivial matches of length 
less than 2 do
   match2 -  t(apply(matches,1,function(row){
  r-rle(row)
  r$values[r$lengths2]-FALSE
 inverse.rle(r)
   }))



And finally, to extract the matches
   results - apply(match2, 1, function(row){
r-rle(row)
n-length(r$lengths)
ends-cumsum(r$lengths)
starts-cumsum(c(1,r$lengths))[1:n]
list(starts[r$values],ends[r$values])
 })
for starts and ends of matches or
   results - apply(match2, 1, function(row){
  r-rle(row)
  n-length(r$lengths)
  ends-cumsum(r$lengths)[r$values]
  starts-cumsum(c(1,r$lengths))[1:n][r$values]
  mapply(function(stt,end) v[stt:end],starts,ends,
  SIMPLIFY=FALSE)
 })
to get a list of the actual matching sequences.


-thomas

__
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] FW: Large datasets in R

2006-07-18 Thread Gabor Grothendieck
S-Plus stores objects as files whereas R stores them in memory.
SAS was developed many years ago when optimizing computer
resources was more important than it is now.

On 7/18/06, Ritwik Sinha [EMAIL PROTECTED] wrote:
 Hi,

 I have a related question. How differently do other statistical
 softwares handle large data?

 The original post claims that 350 MB is fine on Stata. Some one
 suggested S-Plus. I have heard people say that SAS can handle large
 data sets. Why can others do it and R seem to have a problem? Don't
 these softwares load the data onto RAM.

 --
 Ritwik Sinha
 Graduate Student
 Epidemiology and Biostatistics
 Case Western Reserve University

 http://darwin.cwru.edu/~rsinha

 __
 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] RSiteSearch() not in posting guide

2006-07-18 Thread Martin Maechler
 Gabor == Gabor Grothendieck [EMAIL PROTECTED]
 on Tue, 18 Jul 2006 09:29:07 -0400 writes:

Gabor I think the posting guide may have been written prior
Gabor to the existence of RSiteSearch as a builtin command.

yes, that's correct.

Thank you, Gavin, for the suggestion.
I have added such a bullet.  Visible now at svn.r-project.org,
and from tomorrow at the URL at the tail of every R-help
message.

Martin

Gabor On 7/18/06, Gavin Simpson [EMAIL PROTECTED]
Gabor wrote:
 Hi,
 
 In a recent reply I sent to the list, my initial response
 was to suggest, politely that by reading the posting
 guide and learning to use the supplied tools one can
 often help oneself. I then went on to say that reading
 the posting guide would have led you to
 RSiteSearch(insert query). Luckily I went to the
 posting guide to check this was there before posting and
 much to my surprise that page does not once mention this
 excellent facility!
 
 In the section Do your homework before posting:,
 help.search() and ?foo are recommended, but these only
 work for installed, and possibly loaded,
 packages. Wouldn't it be better to suggest a user try
 RSiteSearch(foo) as well? This way they are far more
 likely to find something relevant if that something
 resides on CRAN or the mailing list archives.
 
 Can I suggest adding another bullet with the following
 text to the Do your homework before posting: section:
 
 Do RSiteSearch(keyword) with different keywords (type
 this at the R prompt) to search R, contributed packages
 and R-Help postings. To restrict the search to functions
 only, use RSiteSearch(keyword, restrict =
 functions). See ?RSiteSearch.
 
 or shorter:
 
 Do RSiteSearch(keyword) with different keywords (type
 this at the R prompt) to search R functions, contributed
 packages and R-Help postings.  See ?RSiteSearch for
 further options and to restrict searches.
 
 G
 --
 %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Gavin Simpson [t] +44 (0)20 7679 0522 ECRC  ENSIS, 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/cv/ London, UK. WC1E 6BT.
 [w] http://www.ucl.ac.uk/~ucfagls/
 %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%


__
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] A contingency table of counts by case

2006-07-18 Thread Serguei Kaniovski
Here is an example of the data.frame that I have,

df-data.frame(case=rep(1:5,each=9),id=rep(1:9,times=5),x=round(runif(length(rep(1:5,each=9)

case represents the cases,
id the persons, and
x is the binary state.

I would like to know in how many cases any two persons

a. both have 1,
b. the first has 0 - the second has 1,
c. the first has 0 - the second has 0,
d. both have 0.

There will be choose(9,2) sums, denoted s_ij for 1=ij=9,
where i and j are running indices for an id-pair.

Please help, this is way beyond my knowledge of R!

Thank you,
Serguei Kaniovski
-- 
___

Austrian Institute of Economic Research (WIFO)

Name: Serguei Kaniovski P.O.Box 91
Tel.: +43-1-7982601-231 Arsenal Objekt 20
Fax:  +43-1-7989386 1103 Vienna, Austria
Mail: [EMAIL PROTECTED]

http://www.wifo.ac.at/Serguei.Kaniovski

__
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] FW: Large datasets in R

2006-07-18 Thread Thomas Lumley
On Tue, 18 Jul 2006, Ritwik Sinha wrote:

 Hi,

 I have a related question. How differently do other statistical
 softwares handle large data?

 The original post claims that 350 MB is fine on Stata. Some one
 suggested S-Plus. I have heard people say that SAS can handle large
 data sets. Why can others do it and R seem to have a problem? Don't
 these softwares load the data onto RAM.


Stata does load the data into RAM and does have limits for the same reason 
that R does. However, Stata has a less flexible representation of its data 
(basically one rectangular dataset) and so it can handle somewhat larger 
data sets for any given memory size. For example, even with 512Gb of 
memory a 350Mb data set might be usable in Stata and with 1Gb it would 
certainly be. Stata is also faster for a given memory load, apparently 
because of its simpler language design [some evidence for this is that the 
recent language additions to support flexible graphics run rather more 
slowly than eg lattice in R].

The other approach is to write the estimation routines so that only part 
of the data need be in memory at a given time.  *Some* procedures in SAS 
and SPSS work this way, and this is the idea of the S-PLUS 7.0 system for 
handling large data sets.   This approach requires the programmer to 
handle the reading of sections of code from memory, something that can 
only be automated to a limited extent.

People have used R in this way, storing data in a database and reading it 
as required. There are also some efforts to provide facilities to support 
this sort of programming (such as the current project funded by Google 
Summer of Code:  http://tolstoy.newcastle.edu.au/R/devel/06/05/5525.html). 
One reason there isn't more of this is that relying on Moore's Law has 
worked very well over the years.


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


Re: [R] Nested functions

2006-07-18 Thread John Wiedenhoeft
Am Dienstag, den 18.07.2006, 22:09 -0400 schrieb Jim Lemon:
 Hi John,
 
 Minor bug - I zeroed the hit counter in the wrong place.
 
 find.replay-function(tunestring,maxlen) {

   return(matchlist)
 }

Dear Jim,

many, many thanks for your effords :-D!!! Your program is great and very
elegant (guess I was thinking to mathematical and iterative...). I have
made some minor adjustments to it. Most important, I have changed
starttest to startpat+1, since patterns can overlap of course (
consists of 2 times 111). Hope this doesn't cause any inconsistency.

Here is what I'm using now:


CODECODECODECODECODECODECODECODECODECODECODECODECODECODECODE

find.replay-function(tunestring,filename,maxlen) 
{
tunelen-length(tunestring)
if(missing(maxlen)) maxlen-floor(tunelen/2)
if(missing(filename)) filename-output
matchlist - list()
startpat-1
endpat-2
finishpos-tunelen-maxlen
pattern-tunestring[startpat:endpat]
patlen-length(pattern)
while(patlen = maxlen) 
{
while(endpat  tunelen-patlen) 
{
starttest-startpat+1   #changed from endpat+1 to detect 
overlapping
patterns
endtest-starttest+(endpat-startpat)
# step through the rest of tunestring with this pattern
while(endtest = tunelen) 
{
testpat-tunestring[starttest:endtest]
if(identical(pattern,testpat))
{
m - 0;
w - 0;
for(k in 1:patlen)
{m - pattern[k]*10^(patlen-k)+m;}
for(l in 1:patlen)
{w - testpat[l]*10^(patlen-l)+w;}
#just in case... ;-)
if (m!=w)
{
warn - paste(Unmatching patterns, m, 
and, w, detected
errorneously!)
print(warn)
write.table(warn, file=filename, 
append=TRUE, sep=\t, eol=\n,
row.names=FALSE, col.names=FALSE);
}
p - c(patlen, m, startpat, starttest);
write.table(t(p), file=filename, append=TRUE, 
sep=\t, eol=\n,
row.names=FALSE, col.names=FALSE);
#   print(p);
}
# step to the next substring
starttest-starttest+1
endtest-endtest+1
}
# now move pattern one step along the string
startpat-startpat+1
endpat-endpat+1
pattern-tunestring[startpat:endpat]
}
# now increase the length of the pattern
startpat- 1
endpat-startpat+patlen
pattern-tunestring[startpat:endpat]
patlen-length(pattern)
}
print(paste(Output written to file ', filename, '. Have fun!,
sep=))
}

ENDENDENDENDENDENDENDENDENDENDENDENDENDENDENDENDENDENDENDEND


Again, many, many thanks. You brightened up my day!

Cheers,
John

__
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] A contingency table of counts by case

2006-07-18 Thread Jacques VESLOT
library(gtools)
apply(combinations(9,2), 1, function(x) with(df[df$id %in% x, ], table(x, id)))
---
Jacques VESLOT

CNRS UMR 8090
I.B.L (2ème étage)
1 rue du Professeur Calmette
B.P. 245
59019 Lille Cedex

Tel : 33 (0)3.20.87.10.44
Fax : 33 (0)3.20.87.10.31

http://www-good.ibl.fr
---


Serguei Kaniovski a écrit :
 Here is an example of the data.frame that I have,
 
 df-data.frame(case=rep(1:5,each=9),id=rep(1:9,times=5),x=round(runif(length(rep(1:5,each=9)
 
 case represents the cases,
 id the persons, and
 x is the binary state.
 
 I would like to know in how many cases any two persons
 
 a. both have 1,
 b. the first has 0 - the second has 1,
 c. the first has 0 - the second has 0,
 d. both have 0.
 
 There will be choose(9,2) sums, denoted s_ij for 1=ij=9,
 where i and j are running indices for an id-pair.
 
 Please help, this is way beyond my knowledge of R!
 
 Thank you,
 Serguei Kaniovski

__
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] Survey-weighted ordered logistic regression

2006-07-18 Thread Debarchana Ghosh
Hi,

I am trying to fit a model with an ordered response variable (3 levels) and
13 predictor variables. The sample has complex survey design and I've used
'svydesign' command from the survey package to specify the sampling design.
After reading the manual of 'svyglm' command, I've found that you can fit a
logistic regression (binary response variable) by specifying the
family=binomial in svyglm function. However I'm unable to fit an ordered
logistic model in 'svyglm function'.

Any help with this will be appreciated.
Thanks,
Debarchana.

-- 
Debarchana Ghosh
Research Assistant,
Department of Geography
University of Minnesota.
PH: 8143607580
www.tc.umn.edu/~ghos0033/

[[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] I think this is a bug

2006-07-18 Thread Xavier Barron
Hello!

I work with:

R : Copyright 2006, The R Foundation for
Statistical Computing
Version 2.3.1 (2006-06-01)

On Windows XP Professional (Version 2002) SP2

I think there is a bug in the conditional
execution if (expr1) {expr2} else {expr3}

If I try: 

if (expr1) expr2 else expr3 

it works well but when I put the expression expr2
and expr3 between {} I receive an error message
like this one:

Erreur dans parse(file, n = -1, NULL, ?) :
erreur de syntaxe à la ligne
4:  }
5:  else

...which translated in english gives:

Error in parse(file, n = -1, NULL, ?) : syntax
error at the line
4:  }
5:  else

Maybe, there is something I don't understand. I
should be very grateful if you would help me to
solve this issue.

Best regards,

Xavier

___
Xavier Barron 
20, rue de la Pierre Levée
75011 Paris 
0143381141 / 0675062109

__
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] How can I extract information from list which class is nls

2006-07-18 Thread Xavier Barron
Hello!

I work with :
R : Copyright 2006, The R Foundation for
Statistical Computing
Version 2.3.1 (2006-06-01)
On Windows XP Professional (Version 2002) SP2.

At this moment I use the function nls combined
with a selfStar model (SSmicmen, related to
Michaelis-Menten equation, and provided by the
stats package). 

When I realise the following operation (cf. p 59
of the An Introduction to R manual,
http://www.r-project.org/, for more details):

 fit-nls(y~SSmicmen(x, Vm, K), df)
 summary(fit)

I obtain the values of Vm and K. The object fit
is a list of the class nls. However I cannot
identify the objects which are inside of fit
and  which contain the values of Vm and K. 

Actually, I would like to extract these values to
introduce them into new objects but I don't know
how?!

Maybe, somebody could help me to solve this
problem. It would be very helpful for me.

Best regards,

Xavier

__
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] Inflated Array

2006-07-18 Thread Ben Bolker
Hadassa Brunschwig dassybr at gmail.com writes:

 
 Hi R-users!
 
 I am trying to create a what I call inflated array (maybe there is
 already some other name for that). It is an array that changes
 dinamically its dimensions, e.g. the higher the number of third
 dimensions, the more rows in the array. 

  base R doesn't have a data structure for this: arrays in R
must not be ragged (i.e., every sub-array must have the
same dimensions).

  So you would need to use a list of matrices in your
example.  I don't quite know the logic that you're using
to decide what goes in each sub-table.

The basic example you give could be built 
by hand as follows:

list(1:4,matrix(5:12,byrow=TRUE,ncol=4),
 matrix(13:24,byrow=TRUE,ncol=4))

  if you had used scan() or something else to
get a long, flat vector (x) and also had
a vector (v) that indicated the number of
rows in each sub-table:

x - 1:24
nrow - c(1,2,3)
ncol - 4

ind - rep(1:length(nrow),ncol*nrow)
lapply(split(x,ind),
matrix,ncol=ncol,byrow=TRUE)

  seems to work.

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


Re: [R] R and DDE (Dynamic Data Exchange)

2006-07-18 Thread vincent

Thanks Gabor and Philippe.
Special thanks to Philippe for his tcltk2 nice job.
I'm testing differents approaches for my problem.
I'll return info if I use DDE + tcltk2.
Vincent

__
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] Endogenous Tobit/Probit model

2006-07-18 Thread Leandro Magnusson
Hi

I would like to know if there is a package that allows me to implement 
endogenous Tobit/Probit  model.
Example:

res1 - rnorm(N);
res2 - res1*0.5 + rnorm(N)
x  -  z[,1]*2 + res1;
ys - x*b + res2;
d  - (ys0); #dummy variable
 y  - d*ys;

y is censored  and x is correlated with res1. z is my instrument. 
(continuously observed) .
Therefore

survreg(Surv(y, y  0, type ='left')~ 0 + x , dist = 'gaussian')

will give biased estimates.

I also need to know the variance-covariance matrix for the parameters of 
the model

Thanks for any information

Leandro

__
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] I think this is a bug

2006-07-18 Thread Thomas Lumley

On Tue, 18 Jul 2006, Xavier Barron wrote:


Hello!

I work with:

R : Copyright 2006, The R Foundation for
Statistical Computing
Version 2.3.1 (2006-06-01)

On Windows XP Professional (Version 2002) SP2

I think there is a bug in the conditional
execution if (expr1) {expr2} else {expr3}

If I try:

if (expr1) expr2 else expr3

it works well but when I put the expression expr2
and expr3 between {} I receive an error message
like this one:



It's not a bug. You need the } on the same line as the else

if (expr1){
  expr2
} else {
  expr3
}

as otherwise R doesn't know there is going to be an 'else'.

-thomas



Erreur dans parse(file, n = -1, NULL, ?) :
erreur de syntaxe à la ligne
4:  }
5:  else

...which translated in english gives:

Error in parse(file, n = -1, NULL, ?) : syntax
error at the line
4:  }
5:  else

Maybe, there is something I don't understand. I
should be very grateful if you would help me to
solve this issue.

Best regards,

Xavier

___
Xavier Barron
20, rue de la Pierre Levée
75011 Paris
0143381141 / 0675062109

__
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] How can I extract information from list which class is nls

2006-07-18 Thread Petr Pikal
Hi

your fit is an object (list) and you could use some functions like 
summary or coef to extract usefull information from it or you can 
call its components on your own.


 DNase1 - subset(DNase, Run == 1)
 
 ## using a selfStart model
 fm1DNase1 - nls(density ~ SSlogis(log(conc), Asym, xmid, scal), 
DNase1)
 summary(fm1DNase1)

Formula: density ~ SSlogis(log(conc), Asym, xmid, scal)

Parameters:
 Estimate Std. Error t value Pr(|t|)
Asym  2.345180.07815   30.01 2.17e-13 ***
xmid  1.483090.08135   18.23 1.22e-10 ***
scal  1.041460.03227   32.27 8.51e-14 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 

Residual standard error: 0.01919 on 13 degrees of freedom

 coef(fm1DNase1)
Asym xmid scal 
2.345180 1.483090 1.041455 
 coef(fm1DNase1)[1]
   Asym 
2.34518 


HTH
Petr



On 18 Jul 2006 at 18:06, Xavier Barron wrote:

Date sent:  Tue, 18 Jul 2006 18:06:00 +0200 (CEST)
From:   Xavier Barron [EMAIL PROTECTED]
To: r-help@stat.math.ethz.ch
Subject:[R] How can I extract information from list which class 
is nls

 Hello!
 
 I work with :
 R : Copyright 2006, The R Foundation for
 Statistical Computing
 Version 2.3.1 (2006-06-01)
 On Windows XP Professional (Version 2002) SP2.
 
 At this moment I use the function nls combined
 with a selfStar model (SSmicmen, related to
 Michaelis-Menten equation, and provided by the
 stats package). 
 
 When I realise the following operation (cf. p 59
 of the An Introduction to R manual,
 http://www.r-project.org/, for more details):
 
  fit-nls(y~SSmicmen(x, Vm, K), df)
  summary(fit)
 
 I obtain the values of Vm and K. The object fit
 is a list of the class nls. However I cannot
 identify the objects which are inside of fit
 and  which contain the values of Vm and K. 
 
 Actually, I would like to extract these values to
 introduce them into new objects but I don't know
 how?!
 
 Maybe, somebody could help me to solve this
 problem. It would be very helpful for me.
 
 Best regards,
 
 Xavier
 
 __
 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.

Petr Pikal
[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] I think this is a bug

2006-07-18 Thread Petr Pikal
Hi
not at all

works for me

 a-1
 b-2
  if (ab) {print(Hallo)} else {print(OK)}
[1] OK
  if (ab) {print(Hallo)} else {print(OK)}
[1] Hallo


you probably started your else on new line e.g.

  if (ab) {print(Hallo)} {
Error: syntax error in  if (ab) {print(Hallo)} {


  if (ab)
+ {print(Hallo)} else
+ {print(OK)}
[1] Hallo


HTH
Petr


On 18 Jul 2006 at 17:43, Xavier Barron wrote:

Date sent:  Tue, 18 Jul 2006 17:43:42 +0200 (CEST)
From:   Xavier Barron [EMAIL PROTECTED]
To: r-help@stat.math.ethz.ch
Subject:[R] I think this is a bug

 Hello!
 
 I work with:
 
 R : Copyright 2006, The R Foundation for
 Statistical Computing
 Version 2.3.1 (2006-06-01)
 
 On Windows XP Professional (Version 2002) SP2
 
 I think there is a bug in the conditional
 execution if (expr1) {expr2} else {expr3}
 
 If I try: 
 
 if (expr1) expr2 else expr3 
 
 it works well but when I put the expression expr2
 and expr3 between {} I receive an error message
 like this one:
 
 Erreur dans parse(file, n = -1, NULL, ?) :
 erreur de syntaxe ŕ la ligne
 4:  }
 5:  else
 
 ...which translated in english gives:
 
 Error in parse(file, n = -1, NULL, ?) : syntax
 error at the line
 4:  }
 5:  else
 
 Maybe, there is something I don't understand. I
 should be very grateful if you would help me to
 solve this issue.
 
 Best regards,
 
 Xavier
 
 ___
 Xavier Barron 
 20, rue de la Pierre Levée
 75011 Paris 
 0143381141 / 0675062109
 
 __
 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.

Petr Pikal
[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] Output and Word

2006-07-18 Thread Greg Snow
Others have suggested using R2HTML (which is a good option).

Another option is to use Sweave and specifically the new odfWeave
package for R.  This works on OpenOffice files rather than word files
(but OpenOffice  http://www.openoffice.org/ can inport and export word
documents).

The basic idea is to write your report in OpenOffice (or LaTeX or HTML),
but anywhere that you want statisticial output (graphs, tables) you
include instead the R code to produce the table, graph, or whatever.
Run this file through R (using Sweave or odfWeave) and the resulting
file has replaced all the code segments with their output.

The documentation with odfWeave has examples.

Hope this helps,

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
[EMAIL PROTECTED]
(801) 408-8111
 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of sharon snowdon
Sent: Monday, July 17, 2006 2:36 PM
To: r-help@stat.math.ethz.ch
Subject: [R] Output and Word

Hi

I have just started to have a look at R. I have used most stats software
packages and can use perl, visual basic etc. I am interested in how well
it handles lots of output e.g. tables or charts. How would you get lots
of output most easily and quickly into a Word document?

Sharon Snowdon




-






-- 





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

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


[R] Sweave and multipage lattice

2006-07-18 Thread Dieter Menne
Dear R-Listeners,

as the Sweave faq says:

http://www.ci.tuwien.ac.at/~leisch/Sweave/FAQ.html

creating several figures from one figure chunk does not work, and for
standard graphics, a workaround is given. Now I have a multipage trellis
plot with an a-priori unknown number of pages, and I don't see an elegant
way of dividing it up into multiple pdf-files.

I noted there is a page event handler in the ... parameters, which would
provide a handle to open/close the file.

Any good idea would be appreciated.

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] Survey-weighted ordered logistic regression

2006-07-18 Thread Thomas Lumley
On Tue, 18 Jul 2006, Debarchana Ghosh wrote:

 Hi,

 I am trying to fit a model with an ordered response variable (3 levels) and
 13 predictor variables. The sample has complex survey design and I've used
 'svydesign' command from the survey package to specify the sampling design.
 After reading the manual of 'svyglm' command, I've found that you can fit a
 logistic regression (binary response variable) by specifying the
 family=binomial in svyglm function. However I'm unable to fit an ordered
 logistic model in 'svyglm function'.


You can do this most easily using withReplicates().  If you have a survey 
object created with svydesign, use as.svrepdesign() to turn it into a 
replicate-weights object and then do eg

library(MASS) 
ologit - withReplicates( repwtdesign,
 quote(coef(polr(y~x1+x2+x3+x4, weights=.weights

You will get a lot of (harmless) warnings about non-integer #successes in 
a binomial glm!.  This will not give you standard errors for the 
intercept terms - if you want them you can do

ologit.int - withReplicates( repwtdesign,
 quote(polr(y~x1+x2+x3+x4, weights=.weights)$zeta))


You could also use svymle() and get Taylor linearisation standard errors, 
but that would require writing out the loglikelihood and its gradient, 
which is tedious (although you could borrow most of it from MASS::polr)


-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] Reconfiguring wide frame to long frame

2006-07-18 Thread Jesse Albert Canchola
Greetings, fellow R'ers. 

How can I get this frame in R:

ID  meas  ID.1   meas.1 
1   1.13  1.2
2   2.14  2.2

to look like this (stacking):

ID meas
1  1.1
2  2.1
3  1.2
4  2.2

It's not really the reshape function (or is it?) because we can consider 
the additional columns, viz., ID.1 and meas.1, as independent of ID and 
meas so it is basically a stacking problem (no longitudinal component).  I 
can't seem to find a good example to do this in the docs.  Thanks for your 
help.

Regards,
Jesse








Jesse A. Canchola
Biostatistician III
Bayer Healthcare
725 Potter St.
Berkeley, CA 94710
P: 510.705.5855
F: 510.705.5718
E: [EMAIL PROTECTED]





___

The information contained in this e-mail is for the exclusive use of the 
intended recipient(s) and may be confidential, proprietary, and/or legally 
privileged.  Inadvertent disclosure of this message does not constitute a 
waiver of any privilege.  If you receive this message in error, please do not 
directly or indirectly use, print, copy, forward, or disclose any part of this 
message.  Please also delete this e-mail and all copies and notify the sender.  
Thank you.

For alternate languages please go to http://bayerdisclaimer.bayerweb.com
___

[[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 datasets in R

2006-07-18 Thread DEEPANKAR BASU
Thanks a lot for all the responses. The general drift of all the messages was 
the suggestion to use some database management package that has a nice 
interface with R; and most of the suggestions pointed in the direction of SQL. 
I will look into the SQL package and start learning to use it along with R. 

Thanks once again for all your suggestions.

Deepankar

__
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] Reconfiguring wide frame to long frame

2006-07-18 Thread Gabor Grothendieck
Try this:

# set up test data
Lines - ID  meas  ID.1   meas.1
1   1.13  1.2
2   2.14  2.2

DF - read.table(textConnection(Lines), header = TRUE)

# reshape
matrix(t(DF), nc = 2, byrow = TRUE, dimnames = list(NULL, colnames(DF)[1:2]))


On 7/18/06, Jesse Albert Canchola [EMAIL PROTECTED] wrote:
 Greetings, fellow R'ers.

 How can I get this frame in R:

 ID  meas  ID.1   meas.1
 1   1.13  1.2
 2   2.14  2.2

 to look like this (stacking):

 ID meas
 1  1.1
 2  2.1
 3  1.2
 4  2.2

 It's not really the reshape function (or is it?) because we can consider
 the additional columns, viz., ID.1 and meas.1, as independent of ID and
 meas so it is basically a stacking problem (no longitudinal component).  I
 can't seem to find a good example to do this in the docs.  Thanks for your
 help.

 Regards,
 Jesse








 Jesse A. Canchola
 Biostatistician III
 Bayer Healthcare
 725 Potter St.
 Berkeley, CA 94710
 P: 510.705.5855
 F: 510.705.5718
 E: [EMAIL PROTECTED]





 ___

 The information contained in this e-mail is for the exclusive use of the 
 intended recipient(s) and may be confidential, proprietary, and/or legally 
 privileged.  Inadvertent disclosure of this message does not constitute a 
 waiver of any privilege.  If you receive this message in error, please do not 
 directly or indirectly use, print, copy, forward, or disclose any part of 
 this message.  Please also delete this e-mail and all copies and notify the 
 sender.  Thank you.

 For alternate languages please go to http://bayerdisclaimer.bayerweb.com
 ___

[[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] How best to deal with returned errors?

2006-07-18 Thread Quin Wills
Hi,

 

What is the best general strategy to prevent returned errors from
interrupting whatever it is I am running? Only by using options()?

 

This is a problem for me in 2 particular cases:

(i)   An error breaking my loops.

(ii) I would like to run some regressions where it
automatically will try a specified number of increasingly robust options
until the regression doesn’t fail.

 

Using try(), especially for the second case, seems a bit clunky for my
needs. As I’ve never really automated the handling of my errors I was
wondering if there is perhaps a bit of simple wisdom or pointers in the
right direction on the matter.

 

Thanks,

Quin

 

 

 


-- 

Checked by AVG Free Edition.

 

[[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] Reconfiguring wide frame to long frame

2006-07-18 Thread Gabor Grothendieck
Sorry, in looking at this again my previous code did not give the
same ordering you indicated.  Instead using the same DF try
this:

rbind(as.matrix(DF[,1:2]), as.matrix(DF[,3:4]))

Both this and the last piece of code produce matrices so
use as.data.frame if you want a data frame.

On 7/18/06, Gabor Grothendieck [EMAIL PROTECTED] wrote:
 Try this:

 # set up test data
 Lines - ID  meas  ID.1   meas.1
 1   1.13  1.2
 2   2.14  2.2
 
 DF - read.table(textConnection(Lines), header = TRUE)

 # reshape
 matrix(t(DF), nc = 2, byrow = TRUE, dimnames = list(NULL, colnames(DF)[1:2]))


 On 7/18/06, Jesse Albert Canchola [EMAIL PROTECTED] wrote:
  Greetings, fellow R'ers.
 
  How can I get this frame in R:
 
  ID  meas  ID.1   meas.1
  1   1.13  1.2
  2   2.14  2.2
 
  to look like this (stacking):
 
  ID meas
  1  1.1
  2  2.1
  3  1.2
  4  2.2
 
  It's not really the reshape function (or is it?) because we can consider
  the additional columns, viz., ID.1 and meas.1, as independent of ID and
  meas so it is basically a stacking problem (no longitudinal component).  I
  can't seem to find a good example to do this in the docs.  Thanks for your
  help.
 
  Regards,
  Jesse
 
 
 
 
 
 
 
 
  Jesse A. Canchola
  Biostatistician III
  Bayer Healthcare
  725 Potter St.
  Berkeley, CA 94710
  P: 510.705.5855
  F: 510.705.5718
  E: [EMAIL PROTECTED]
 
 
 
 
 
  ___
 
  The information contained in this e-mail is for the exclusive use of the 
  intended recipient(s) and may be confidential, proprietary, and/or legally 
  privileged.  Inadvertent disclosure of this message does not constitute a 
  waiver of any privilege.  If you receive this message in error, please do 
  not directly or indirectly use, print, copy, forward, or disclose any part 
  of this message.  Please also delete this e-mail and all copies and notify 
  the sender.  Thank you.
 
  For alternate languages please go to http://bayerdisclaimer.bayerweb.com
  ___
 
 [[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] R and DDE (Dynamic Data Exchange)

2006-07-18 Thread Richard M. Heiberger
I am thrilled to learn tcltk2 has DDE capability.
It is the piece I have been needing to make ESS work directly
with the RGUI on Windows.  GNU emacs on Windows has a ddeclient,
but no access to COM.  So if R, or tcltk2 talking in both directions to R,
has a ddeserver, all should be possible.  I will be reading the documentation
closely in a few weeks to tie it together and then intend to make it happen.

Do you, or any other list member, have a sense of the size, complexity, ease,
magnitude of the task I just defined?  Any advice as I get started on it?

Rich

__
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] bilinear regression

2006-07-18 Thread Crabb, David
I think this is an easy question, but I would be grateful for any advice
on how to implement this in R.

I simply have a response variable (y) that I am trying to predict with
one explanatory variable (x) but the shape of the scatter plot is
distinctly bilinear. It would be best described by two straight lines.
Is there a way of fitting a linear model to give me a bilinear fit and
(more importantly) automatically determine the 'cut off' point? I would
also want some statistic to convince myself that the bilinear fit is
better.

Many thanks for your help.

David


Dr. David Crabb
Department of Optometry and Visual Science,
City University, 
Northampton Square, London EC1V OHB
Tel: 44 207 040 0191   [EMAIL PROTECTED]
http://www.city.ac.uk/optometry/html/david_crabb.html

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


Re: [R] Reconfiguring wide frame to long frame

2006-07-18 Thread Jesse Albert Canchola
Many thanks, Gabor.  That worked great!  I'm ecstatic. 

Best regards,
Jesse




Gabor Grothendieck [EMAIL PROTECTED] 
07/18/2006 10:12 AM

To
Jesse Albert Canchola [EMAIL PROTECTED]
cc
r-help@stat.math.ethz.ch
Subject
Re: [R] Reconfiguring wide frame to long frame






Try this:

# set up test data
Lines - ID  meas  ID.1   meas.1
1   1.13  1.2
2   2.14  2.2

DF - read.table(textConnection(Lines), header = TRUE)

# reshape
matrix(t(DF), nc = 2, byrow = TRUE, dimnames = list(NULL, 
colnames(DF)[1:2]))


On 7/18/06, Jesse Albert Canchola [EMAIL PROTECTED] wrote:
 Greetings, fellow R'ers.

 How can I get this frame in R:

 ID  meas  ID.1   meas.1
 1   1.13  1.2
 2   2.14  2.2

 to look like this (stacking):

 ID meas
 1  1.1
 2  2.1
 3  1.2
 4  2.2

 It's not really the reshape function (or is it?) because we can consider
 the additional columns, viz., ID.1 and meas.1, as independent of ID and
 meas so it is basically a stacking problem (no longitudinal component). 
I
 can't seem to find a good example to do this in the docs.  Thanks for 
your
 help.

 Regards,
 Jesse








 Jesse A. Canchola
 Biostatistician III
 Bayer Healthcare
 725 Potter St.
 Berkeley, CA 94710
 P: 510.705.5855
 F: 510.705.5718
 E: [EMAIL PROTECTED]





 
___

 The information contained in this e-mail is for the exclusive use of the 
intended recipient(s) and may be confidential, proprietary, and/or legally 
privileged.  Inadvertent disclosure of this message does not constitute a 
waiver of any privilege.  If you receive this message in error, please do 
not directly or indirectly use, print, copy, forward, or disclose any part 
of this message.  Please also delete this e-mail and all copies and notify 
the sender.  Thank you.

 For alternate languages please go to http://bayerdisclaimer.bayerweb.com
 
___

[[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] Reconfiguring wide frame to long frame

2006-07-18 Thread Jesse Albert Canchola
Thanks, Gabor.  Since the data stacking components are independent, that 
didn't matter much but I am grateful for your follow-up code to match the 
desired output specifically. 

Regards,
Jesse





Gabor Grothendieck [EMAIL PROTECTED] 
07/18/2006 10:36 AM

To
Jesse Albert Canchola [EMAIL PROTECTED]
cc
r-help@stat.math.ethz.ch
Subject
Re: [R] Reconfiguring wide frame to long frame






Sorry, in looking at this again my previous code did not give the
same ordering you indicated.  Instead using the same DF try
this:

rbind(as.matrix(DF[,1:2]), as.matrix(DF[,3:4]))

Both this and the last piece of code produce matrices so
use as.data.frame if you want a data frame.

On 7/18/06, Gabor Grothendieck [EMAIL PROTECTED] wrote:
 Try this:

 # set up test data
 Lines - ID  meas  ID.1   meas.1
 1   1.13  1.2
 2   2.14  2.2
 
 DF - read.table(textConnection(Lines), header = TRUE)

 # reshape
 matrix(t(DF), nc = 2, byrow = TRUE, dimnames = list(NULL, 
colnames(DF)[1:2]))


 On 7/18/06, Jesse Albert Canchola [EMAIL PROTECTED] wrote:
  Greetings, fellow R'ers.
 
  How can I get this frame in R:
 
  ID  meas  ID.1   meas.1
  1   1.13  1.2
  2   2.14  2.2
 
  to look like this (stacking):
 
  ID meas
  1  1.1
  2  2.1
  3  1.2
  4  2.2
 
  It's not really the reshape function (or is it?) because we can 
consider
  the additional columns, viz., ID.1 and meas.1, as independent of ID 
and
  meas so it is basically a stacking problem (no longitudinal 
component).  I
  can't seem to find a good example to do this in the docs.  Thanks for 
your
  help.
 
  Regards,
  Jesse
 
 
 
 
 
 
 
 
  Jesse A. Canchola
  Biostatistician III
  Bayer Healthcare
  725 Potter St.
  Berkeley, CA 94710
  P: 510.705.5855
  F: 510.705.5718
  E: [EMAIL PROTECTED]
 
 
 
 
 
  
___
 
  The information contained in this e-mail is for the exclusive use of 
the intended recipient(s) and may be confidential, proprietary, and/or 
legally privileged.  Inadvertent disclosure of this message does not 
constitute a waiver of any privilege.  If you receive this message in 
error, please do not directly or indirectly use, print, copy, forward, or 
disclose any part of this message.  Please also delete this e-mail and all 
copies and notify the sender.  Thank you.
 
  For alternate languages please go to 
http://bayerdisclaimer.bayerweb.com
  
___
 
 [[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] bilinear regression

2006-07-18 Thread Christos Hatzis
It appears that you might have a latent (hidden) explanatory variable that
causes the two-population appearance.  If you have some ideas on what that
other factor might be, you could try two separate linear regressions for
each value of the latent factor and compare the slopes and intercepts.  You
can then do some formal tests on the slopes and intercepts to see if you can
further simplify the model.  Depending on what you find, you can formulate a
linear regression model that incorporates such dependence on the slopes or
intercepts to fit the bilinear trend.

You might find helpful the discussion and example in Ch.10 of Venables 
Ripley, 4th ed, that introduces the concepts behind random and mixed effects
models.

-Christos

Christos Hatzis, Ph.D.
Vice President, Technology
Nuvera Biosciences, Inc.
400 West Cummings Park
Suite 5350
Woburn, MA 01801
Tel: 781-938-3830
www.nuverabio.com
 


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Crabb, David
Sent: Tuesday, July 18, 2006 1:36 PM
To: r-help@stat.math.ethz.ch
Subject: [R] bilinear regression

I think this is an easy question, but I would be grateful for any advice on
how to implement this in R.

I simply have a response variable (y) that I am trying to predict with one
explanatory variable (x) but the shape of the scatter plot is distinctly
bilinear. It would be best described by two straight lines.
Is there a way of fitting a linear model to give me a bilinear fit and (more
importantly) automatically determine the 'cut off' point? I would also want
some statistic to convince myself that the bilinear fit is better.

Many thanks for your help.

David


Dr. David Crabb
Department of Optometry and Visual Science, City University, Northampton
Square, London EC1V OHB
Tel: 44 207 040 0191   [EMAIL PROTECTED]
http://www.city.ac.uk/optometry/html/david_crabb.html

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html
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] Test for equality of coefficients in multivariate multiple regression

2006-07-18 Thread Ulrich Keller
Hello,

suppose I have a multivariate multiple regression model such as the 
following:

  DF-data.frame(x1=rep(c(0,1),each=50),x2=rep(c(0,1),50))
  tmp-rnorm(100)
  DF$y1-tmp+DF$x1*.5+DF$x2*.3+rnorm(100,0,.5)
  DF$y2-tmp+DF$x1*.5+DF$x2*.7+rnorm(100,0,.5)
  x.mlm-lm(cbind(y1,y2)~x1+x2,data=DF)
  coef(x.mlm)
y1y2
(Intercept) 0.07800993 0.2303557
x1  0.52936947 0.3728513
x2  0.13853332 0.4604842

How can I test whether x1 and x2 respectively have the same effect on y1 
and y2? In other words, how can I test if coef(x.mlm)[2,1] is 
statistically equal to coef(x.mlm)[2,2] and coef(x.mlm)[3,1] to 
coef(x.mlm)[3,2]? I looked at linear.hypothesis {car} and glh.test 
{gmodels}, but these do not seem the apply to multivariate models.
Thank you in advance,

Uli Keller

__
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] JGR help()

2006-07-18 Thread Michael Kubovy
Dear R-helpers,

In JGR, how to I get the help() to update when I install a new package?

  sessionInfo()
Version 2.3.1 (2006-06-01)
powerpc-apple-darwin8.6.0

attached base packages:
[1] datasets  methods   stats graphics  grDevices  
utils base

other attached packages:
lattice   MASSJGR JavaGD  rJava
   0.13-9 7.2-27.11.4-20.3-30.4-3

_
Professor Michael Kubovy
University of Virginia
Department of Psychology
USPS: P.O.Box 400400Charlottesville, VA 22904-4400
Parcels:Room 102Gilmer Hall
 McCormick RoadCharlottesville, VA 22903
Office:B011+1-434-982-4729
Lab:B019+1-434-982-4751
Fax:+1-434-982-4766
WWW:http://www.people.virginia.edu/~mk9y/

__
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 corStruct in nlme

2006-07-18 Thread grieve
I am having trouble fitting correlation structures within nlme. I would like to 
fit corCAR1, corGaus and corExp correlation structures to my data.  I either 
get the error step halving reduced below minimum in pnls step or 
alternatively R crashes.

My dataset is similar to the CO2 example in the nlme package. The one major 
difference is that in my case the 'conc' steps are not the same for each 
'Plant'. I have replicated the problem using the CO2 data in nlme (based off of 
the Ch08.R script).

This works (when 'conc' is the same for each 'Plant':

(fm1CO2.lis - nlsList(SSasympOff, CO2))
(fm1CO2.nlme - nlme(fm1CO2.lis, control = list(tolerance = 1e-2)))
(fm2CO2.nlme - update(fm1CO2.nlme, random = Asym + lrc ~ 1))
CO2.nlme.var - update(fm2CO2.nlme,
 fixed = list(Asym ~ Type * Treatment, lrc + c0 ~ 1),
 start = c(32.412, 0, 0, 0, -4.5603, 49.344), 
 weights=varConstPower(fixed=list(const=0.1, power=1)), verbose=T)

CO2.nlme.CAR-update(CO2.nlme.var, corr=corCAR1())

CO2.nlme.gauss-update(CO2.nlme.var, 
correlation=corGaus(form=~as.numeric(conc)|Plant,nugget=F), data=CO2)

CO2.nlme.exp-update(CO2.nlme.var, 
correlation=corExp(form=~as.numeric(conc)|Plant,nugget=F), data=CO2)  

But, if i change each of the 'conc' numbers slightly so that they are no longer 
identical between subjects i can only get the corCAR1 correlation to work while 
R crashes for both corExp and corGaus:

for(i in 1:length(CO2$conc)){
CO2$conc[i]-(CO2$conc[i]+rnorm(1))
}

(fm1CO2.lis - nlsList(SSasympOff, CO2))
(fm1CO2.nlme - nlme(fm1CO2.lis, control = list(tolerance = 1e-2)))
(fm2CO2.nlme - update(fm1CO2.nlme, random = Asym + lrc ~ 1))
CO2.nlme.var - update(fm2CO2.nlme,
 fixed = list(Asym ~ Type * Treatment, lrc + c0 ~ 1),
 start = c(32.412, 0, 0, 0, -4.5603, 49.344), 
 weights=varConstPower(fixed=list(const=0.1, power=1)), verbose=T)

CO2.nlme.CAR-update(CO2.nlme.var, corr=corCAR1())

CO2.nlme.gauss-update(CO2.nlme.var, 
correlation=corGaus(form=~as.numeric(conc)|Plant,nugget=F), data=CO2)

CO2.nlme.exp-update(CO2.nlme.var, 
correlation=corExp(form=~as.numeric(conc)|Plant,nugget=F), data=CO2) 

I have read Pinheiro  Bates (2000) and i think that it should be possible to 
fit these correlation structures to my data, but maybe i am mistaken.

I am running R 2.3.1 and have recently updated all packages.

Thanks,
Katie Grieve

Quantitative Ecology  Resource Management
University of Washington

__
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] R-help in a newsgroup

2006-07-18 Thread Darren Weber
Hi,

I find a lot of the R-help email traffic overloads my inbox.  My IT
managers are not really happy for me to be subscribed to several
high-traffic email lists.  I don't want to lose my contact with the
R-help emails, so I'm having to consider various ways of handling the
traffic.  Anyhow, I'm wondering how many people on the R-help email
list would prefer that most of the traffic were in a newsgroup?  In
case your interested in that option, there is a group available at:

[EMAIL PROTECTED]

I think the subscription is through normal news group channels.  The
google search services on this group are nice too.  This group is not
divided into useful categories, like help, admin, develop etc., but
it's not too difficult to create new groups for that.

Best, Darren

__
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] Reproducible Research - Examples

2006-07-18 Thread Phil Heilman
All,

Recently I ran across a URL documenting published research using R: 

http://www.cgd.ucar.edu/ccr/ammann/millennium/CODES_MBH.html

A note on the site indicates that the code is being revised. The code and
data are provided, so that one could reproduce the results without having to
buy a proprietary software program. In poking around the R website it is
clear that a lot of thought has gone into documenting reproducible research,
notably by Harrell, Gentleman, and the Sweave effort, among others.

http://biostat.mc.vanderbilt.edu/twiki/bin/view/Main/StatReport
http://cran.ssds.ucdavis.edu/doc/contrib/Harrell-statcomp-notes.pdf
http://www.bioconductor.org/docs/papers/2003/Compendium

Question: Reproducible research is clearly desirable and feasible. Could
anyone provide examples (stand-alone URLs or supplementary material in
journals) that you would recommend as a models for reproducible research in
R?

Thanks,

Phil

Philip Heilman
USDA-ARS Southwest Watershed Research Center
2000 E. Allen Rd.
Tucson, AZ 85704
(520) 670-6380 x148
[EMAIL PROTECTED]
http://www.tucson.ars.ag.gov/

__
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] R-help in a newsgroup

2006-07-18 Thread Marc Schwartz (via MN)
On Tue, 2006-07-18 at 11:30 -0700, Darren Weber wrote:
 Hi,
 
 I find a lot of the R-help email traffic overloads my inbox.  My IT
 managers are not really happy for me to be subscribed to several
 high-traffic email lists.  I don't want to lose my contact with the
 R-help emails, so I'm having to consider various ways of handling the
 traffic.  Anyhow, I'm wondering how many people on the R-help email
 list would prefer that most of the traffic were in a newsgroup?  In
 case your interested in that option, there is a group available at:
 
 [EMAIL PROTECTED]
 
 I think the subscription is through normal news group channels.  The
 google search services on this group are nice too.  This group is not
 divided into useful categories, like help, admin, develop etc., but
 it's not too difficult to create new groups for that.
 
 Best, Darren

r-help is already available with an NNTP interface at gmane.org:

  http://dir.gmane.org/gmane.comp.lang.r.general

There is also a web based interface, where you can see that your post is
already available:

  http://news.gmane.org/gmane.comp.lang.r.general

Similarly, r-devel is also present:

  http://dir.gmane.org/gmane.comp.lang.r.devel


The Google group you reference is completely independent of the R e-mail
lists, whereas the gmane interface is synchronized with the R e-mail
lists.

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] R-help in a newsgroup

2006-07-18 Thread Duncan Murdoch
On 7/18/2006 2:30 PM, Darren Weber wrote:
 Hi,
 
 I find a lot of the R-help email traffic overloads my inbox.  My IT
 managers are not really happy for me to be subscribed to several
 high-traffic email lists.  I don't want to lose my contact with the
 R-help emails, so I'm having to consider various ways of handling the
 traffic.  Anyhow, I'm wondering how many people on the R-help email
 list would prefer that most of the traffic were in a newsgroup?  In
 case your interested in that option, there is a group available at:
 
 [EMAIL PROTECTED]
 
 I think the subscription is through normal news group channels.  The
 google search services on this group are nice too.  This group is not
 divided into useful categories, like help, admin, develop etc., but
 it's not too difficult to create new groups for that.

If you prefer the newsgroup interface, you should also look at gmane. 
Gabor G posted a list of the newsgroups here:

http://finzi.psych.upenn.edu/R/Rhelp02a/archive/75239.html

recently.

Duncan Murdoch
 
 Best, Darren
 
 __
 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] Question about summing to zero

2006-07-18 Thread Jim Frederick
Hi,

When I used
x - c(10,10,10,10,5,5,5,5)
sum(x)
x - x - .Last.value/8
the result was zero, as I expected.
However, when I used
x - rnorm(101,0,10)
sum(x)
x - x - .Last.value/101
sum(x)
I did not get zero, but  -2.664535e-15.  OK, that's fairly close to 
zero, but I tried to improve the figure.  Each time I repeated the last 
two commands, the sum got closer to zero.  The series seemed to converge 
on -1.30e-15, so changed the 101 to 50, then to 20, and then to 10.  I 
had sum(x) down to -5.551115e-17 before I quit.

If R can store values of x which sum to -5.551115e-17, then why can't I 
get that value on the first try?  Is this a bug or just rounding error?

Jim Frederick

__
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] Test for equality of coefficients in multivariate multiple regression

2006-07-18 Thread John Fox
Dear Ulrich,

I'll look into generalizing linear.hypothesis() so that it handles
multivariate linear models.

Meanwhile, vcov(x.mlm) will give you the covariance matrix of the
coefficients, so you could construct your own test by ravelling
coef(x.mlm) into a vector.

I hope that this helps,
 John

On Tue, 18 Jul 2006 20:15:12 +0200
 Ulrich Keller [EMAIL PROTECTED] wrote:
 Hello,
 
 suppose I have a multivariate multiple regression model such as the 
 following:
 
   DF-data.frame(x1=rep(c(0,1),each=50),x2=rep(c(0,1),50))
   tmp-rnorm(100)
   DF$y1-tmp+DF$x1*.5+DF$x2*.3+rnorm(100,0,.5)
   DF$y2-tmp+DF$x1*.5+DF$x2*.7+rnorm(100,0,.5)
   x.mlm-lm(cbind(y1,y2)~x1+x2,data=DF)
   coef(x.mlm)
 y1y2
 (Intercept) 0.07800993 0.2303557
 x1  0.52936947 0.3728513
 x2  0.13853332 0.4604842
 
 How can I test whether x1 and x2 respectively have the same effect on
 y1 
 and y2? In other words, how can I test if coef(x.mlm)[2,1] is 
 statistically equal to coef(x.mlm)[2,2] and coef(x.mlm)[3,1] to 
 coef(x.mlm)[3,2]? I looked at linear.hypothesis {car} and glh.test 
 {gmodels}, but these do not seem the apply to multivariate models.
 Thank you in advance,
 
 Uli Keller
 
 __
 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.


John Fox
Department of Sociology
McMaster University
Hamilton, Ontario, Canada
http://socserv.mcmaster.ca/jfox/

__
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] Question about summing to zero

2006-07-18 Thread Thomas Lumley
On Tue, 18 Jul 2006, Jim Frederick wrote:

 Hi,

 When I used
 x - c(10,10,10,10,5,5,5,5)
 sum(x)
 x - x - .Last.value/8
 the result was zero, as I expected.
 However, when I used
 x - rnorm(101,0,10)
 sum(x)
 x - x - .Last.value/101
 sum(x)
 I did not get zero, but  -2.664535e-15.  OK, that's fairly close to
 zero, but I tried to improve the figure.  Each time I repeated the last
 two commands, the sum got closer to zero.  The series seemed to converge
 on -1.30e-15, so changed the 101 to 50, then to 20, and then to 10.  I
 had sum(x) down to -5.551115e-17 before I quit.

 If R can store values of x which sum to -5.551115e-17, then why can't I
 get that value on the first try?  Is this a bug or just rounding error?


It's just rounding error.  The *relative* error is always a multiple of 
2^-52, or about 2e-16 but as sum(x) gets smaller a given relative error is 
a smaller absolute error.

Comparing values from doing this once or twice is not very reliable. To 
see how much variation there is from sample to sample, do something like

a-replicate(1, {x-rnorm(101,0,10); y-sum(x); 
sum(x-y/101)/.Machine$double.eps})

A histogram or qqplot shows an approximately Normal distribution, with 
mean close to zero and standard deviation about 70.  Zero error does 
happen: I got 20/1 exactly zero.

There aren't any simple answers to exactly how big the error is for 
particular computations.  The exact answers are complicated and the simple 
answers are approximate. For example, in your case a reasonable upper 
bound for the error might be 102 computations multiplied by 10 as a 
typical value of the numbers, multiplied by .Machine$double.eps. This is 
much larger than the typical error, of course.  A crude estimate of the 
typical error might be sqrt(102)*10*.Machine$double.eps, treating the 
errors as a random walk, and this is not far off (though perhaps only 
coincidentally so).


-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] Extended example of R2HTML?

2006-07-18 Thread Michael Kubovy
Dear R-helpers,

Can someone point me to an extended example of use of R2HTML?
_
Professor Michael Kubovy
University of Virginia
Department of Psychology
USPS: P.O.Box 400400Charlottesville, VA 22904-4400
Parcels:Room 102Gilmer Hall
 McCormick RoadCharlottesville, VA 22903
Office:B011+1-434-982-4729
Lab:B019+1-434-982-4751
Fax:+1-434-982-4766
WWW:http://www.people.virginia.edu/~mk9y/

__
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] FW: Large datasets in R

2006-07-18 Thread Marshall Feldman
Well, SPSS used to claim that all its algorithms dealt with only one case at
a time and therefore that it could handle very large files. I suppose a
large correlation matrix could cause it problems.

Marsh Feldmman

-Original Message-
From: Ritwik Sinha [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, July 18, 2006 10:54 AM
To: Prof Brian Ripley
Cc: Marshall Feldman; r-help@stat.math.ethz.ch
Subject: Re: [R] FW: Large datasets in R

Hi,

I have a related question. How differently do other statistical
softwares handle large data?

The original post claims that 350 MB is fine on Stata. Some one
suggested S-Plus. I have heard people say that SAS can handle large
data sets. Why can others do it and R seem to have a problem? Don't
these softwares load the data onto RAM.

-- 
Ritwik Sinha
Graduate Student
Epidemiology and Biostatistics
Case Western Reserve University

http://darwin.cwru.edu/~rsinha

__
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] How to write a function in a graph

2006-07-18 Thread junguo liu
Dear R-ers,
   
  I conducted a regression analysis, and then intended to add the regression 
function (y=4.33+1.07x) in a graph. But the following code can only give me a 
text like y=a+bx. Who can help me out? Thank you very much in advance.
   
   
  CODE
   
  # Read data
  x - c(1, 2, 3, 4, 5, 6, 7, 8, 9)
  y - c(6, 5, 8, 9, 11, 10, 11, 12, 15)
  data01 - data.frame(x, y)
   
  # Regression analysis
  res.lm.y - nls(y~a+b*x, start=list(a=1, b=2),data=data01)
   
  # Obtain parameters
  a- coef(res.lm.y)[a]
  b- coef(res.lm.y)[b]
  a
  b
  #a=4.33
  #b=1.07
   
  # Plot the results
  def.par - par()
  par(mfrow=c(1,1),xaxs=i,yaxs=i)
  plot(data01$x,data01$y,main=Fit,xlab=x,ylab=y)
  lines(data01$x,predict(res.lm.y))
   
  #===
  text (6, 13, expression(y==a+b*x))
  #===
   
  ## I intended to add text like y=4.33+1.07x 
  ## but the above code added y=a+bx
   


Swiss Federal Institute for Environmental Science and Technology (EAWAG)
Ueberlandstrasse 133
P.O.Box 611
CH-8600 Duebendorf
Switzerland
Phone: 0041-18235012
Fax: 0041-18235375

-


[[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] FW: Large datasets in R

2006-07-18 Thread François Pinard
[Thomas Lumley]

People have used R in this way, storing data in a database and reading it 
as required. There are also some efforts to provide facilities to support 
this sort of programming (such as the current project funded by Google 
Summer of Code:  http://tolstoy.newcastle.edu.au/R/devel/06/05/5525.html). 

Interesting project indeed!  However, if R requires uses more swapping 
because arrays do not all fit in physical memory, crudely replacing 
swapping with database accesses is not necessarily going to buy
a drastic speed improvement: the paging gets done in user space instead 
of being done in the kernel.

Long ago, while working on CDC mainframes, astonishing at the time but 
tiny by nowadays standards, there was a program able to invert or do 
simplexes on very big matrices.  I do not remember the name of the 
program, and never studied it but superficially (I was in computer 
support for researchers, but not a researcher myself).  The program was 
documented as being extremely careful at organising accesses to rows and 
columns (or parts thereof) in such a way that real memory was best used.
In other words, at the core of this program was a paging system very 
specialised and cooperative with the problems meant to be solved.

However, the source of this program was just plain huge (let's say from 
memory, about three or four times the size of the optimizing FORTRAN 
compiler, which I already knew better as an impressive algorithmic 
undertaking).  So, good or wrong, the prejudice stuck solidly in me at 
the time, if nothing else, that handling big arrays the right way, 
speed-wise, ought to be very difficult.

One reason there isn't more of this is that relying on Moore's Law has 
worked very well over the years.

On the other hand, the computational needs for scientific problems grow 
fairly quickly to the size of our ability to solve them.  Let me take
weather forecasting for example.  3-D geographical grids are never fine 
enough for the resolution meteorologists would like to get, and the time 
required for each prediction step grows very rapidly, to increase 
precision by not so much.  By merely tuning a few parameters, these 
people may easily pump nearly all the available cycles out the 
supercomputers given to them, and they do so without hesitation.  
Moore's Law will never succeed at calming their starving hunger! :-).

-- 
François Pinard   http://pinard.progiciels-bpi.ca

__
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 fit of a generic function

2006-07-18 Thread Gregor Gorjanc
Hello!

Say I have a function, which creates a design matrix i.e.

myFunc - function(x)
{
  ret - cbind(x, x*x, x*x*x)
  colnames(ret) - 1:ncol(ret)
  return(ret)
}

n - 200
x - runif(n=n, min=0, max=100)
y - myFunc(x) %*% c(1, 0.2, -0.0002) +  rnorm(n=n, sd=100)

then I can use this in formulae as here

(fit - lm(y ~ myFunc(x)))

Now I would like to plot data and fitted function on the plot, but I do
not want to access each parameter estimate from object fit i.e. I
would like to use something similar to abline for linear regression but
in a generic way. Is there anything similar to my case?

plot(y=y, x=x)

???plotMyFunc???

Thanks!

-- 
Lep pozdrav / With regards,
Gregor Gorjanc

--
University of Ljubljana PhD student
Biotechnical Faculty
Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan
Groblje 3   mail: gregor.gorjanc at bfro.uni-lj.si

SI-1230 Domzale tel: +386 (0)1 72 17 861
Slovenia, Europefax: +386 (0)1 72 17 888

--
One must learn by doing the thing; for though you think you know it,
 you have no certainty until you try. Sophocles ~ 450 B.C.

__
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] FW: Large datasets in R

2006-07-18 Thread Berton Gunter
Or, more succinctly, Pinard's Law:

The demands of ever more data always exceed the capabilities of ever better
hardware.

;-D

-- Bert Gunter
Genentech Non-Clinical Statistics
South San Francisco, CA
  

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of François Pinard
 Sent: Tuesday, July 18, 2006 3:56 PM
 To: Thomas Lumley
 Cc: r-help@stat.math.ethz.ch
 Subject: Re: [R] FW: Large datasets in R
 
 [Thomas Lumley]
 
 People have used R in this way, storing data in a database 
 and reading it 
 as required. There are also some efforts to provide 
 facilities to support 
 this sort of programming (such as the current project funded 
 by Google 
 Summer of Code:  
 http://tolstoy.newcastle.edu.au/R/devel/06/05/5525.html). 
 
 Interesting project indeed!  However, if R requires uses more 
 swapping 
 because arrays do not all fit in physical memory, crudely replacing 
 swapping with database accesses is not necessarily going to buy
 a drastic speed improvement: the paging gets done in user 
 space instead 
 of being done in the kernel.
 
 Long ago, while working on CDC mainframes, astonishing at the 
 time but 
 tiny by nowadays standards, there was a program able to invert or do 
 simplexes on very big matrices.  I do not remember the name of the 
 program, and never studied it but superficially (I was in computer 
 support for researchers, but not a researcher myself).  The 
 program was 
 documented as being extremely careful at organising accesses 
 to rows and 
 columns (or parts thereof) in such a way that real memory was 
 best used.
 In other words, at the core of this program was a paging system very 
 specialised and cooperative with the problems meant to be solved.
 
 However, the source of this program was just plain huge 
 (let's say from 
 memory, about three or four times the size of the optimizing FORTRAN 
 compiler, which I already knew better as an impressive algorithmic 
 undertaking).  So, good or wrong, the prejudice stuck solidly 
 in me at 
 the time, if nothing else, that handling big arrays the right way, 
 speed-wise, ought to be very difficult.
 
 One reason there isn't more of this is that relying on 
 Moore's Law has 
 worked very well over the years.
 
 On the other hand, the computational needs for scientific 
 problems grow 
 fairly quickly to the size of our ability to solve them.  Let me take
 weather forecasting for example.  3-D geographical grids are 
 never fine 
 enough for the resolution meteorologists would like to get, 
 and the time 
 required for each prediction step grows very rapidly, to increase 
 precision by not so much.  By merely tuning a few parameters, these 
 people may easily pump nearly all the available cycles out the 
 supercomputers given to them, and they do so without hesitation.  
 Moore's Law will never succeed at calming their starving hunger! :-).
 
 -- 
 François Pinard   http://pinard.progiciels-bpi.ca
 
 __
 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] Plot fit of a generic function

2006-07-18 Thread Gabor Grothendieck
You could plot y vs. fitted(y.lm) where y.lm is the output of lm or
plot both y and fitted(y.lm) against x on the same chart.


On 7/18/06, Gregor Gorjanc [EMAIL PROTECTED] wrote:
 Hello!

 Say I have a function, which creates a design matrix i.e.

 myFunc - function(x)
 {
  ret - cbind(x, x*x, x*x*x)
  colnames(ret) - 1:ncol(ret)
  return(ret)
 }

 n - 200
 x - runif(n=n, min=0, max=100)
 y - myFunc(x) %*% c(1, 0.2, -0.0002) +  rnorm(n=n, sd=100)

 then I can use this in formulae as here

 (fit - lm(y ~ myFunc(x)))

 Now I would like to plot data and fitted function on the plot, but I do
 not want to access each parameter estimate from object fit i.e. I
 would like to use something similar to abline for linear regression but
 in a generic way. Is there anything similar to my case?

 plot(y=y, x=x)

 ???plotMyFunc???

 Thanks!

 --
 Lep pozdrav / With regards,
Gregor Gorjanc

 --
 University of Ljubljana PhD student
 Biotechnical Faculty
 Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan
 Groblje 3   mail: gregor.gorjanc at bfro.uni-lj.si

 SI-1230 Domzale tel: +386 (0)1 72 17 861
 Slovenia, Europefax: +386 (0)1 72 17 888

 --
 One must learn by doing the thing; for though you think you know it,
  you have no certainty until you try. Sophocles ~ 450 B.C.

 __
 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] JavaGD

2006-07-18 Thread Castalanelli, Mark
Can someone please help im trying to use JGR' version 1.4-2 on a IBM
Thinkcentre P4 with windows xp with the R  v2.3.1, but any time I try and
plot or use JavaGD I get this error

 

 plot(1:10)

Error in JavaGD() : unable to start device JavaGD

In addition: Warning message:

Another VM is running already and the VM did not allow me to append paths to
the class path. in: .jinit(.javaGD.get.class.path())

 

Or

 

 JavaGD(name=JavaGD, width=400, height=300, ps=12)

Error in JavaGD(name = JavaGD, width = 400, height = 300, ps = 12) : 

unable to start device JavaGD

 

if I try and reinstall I get

 

Warning: package 'JavaGD' is in use and will not be installed

 

Any help will be greatly appreciated

 

Regards

 

Mark Castalanelli

Bsc (Hons) Molecular Biology

Bsc Forensic Biology and Toxicology

DAFWA - European House Borer Project

(08) 9368 3754

 

 


This e-mail and any files transmitted with it are privileged and
confidential information 
intended for use of the addressee.The confidentiality and/or privilege is 
not waived, lost or destroyed if it has been transmitted to you in error. If
you received this 
e-mail in error you must (a) not disseminate, copy or take any action in
reliance on it; 
(b) please notify the Department of Agriculture immediately by return e-mail
to the sender; 
(c) please delete the original e-mail.

[[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] Test for equality of coefficients in multivariate multiple regression

2006-07-18 Thread Andrew Robinson
Hi Uli,

I suggest that you try to rewrite the model system into a single
mixed-effects model, which would allow direct parameterization of the
tests that you're interested in.  A useful article, which may be
overkill for your needs, is:

Hall, D.B. and Clutter, M. (2004). Multivariate multilevel nonlinear
mixed effects models for timber yield predictions,  Biometrics, 60:
16-24.

See the publications link on Daniel Hall's website:

http://www.stat.uga.edu/~dhall/

Cheers

Andrew

On Tue, Jul 18, 2006 at 08:15:12PM +0200, Ulrich Keller wrote:
 Hello,
 
 suppose I have a multivariate multiple regression model such as the 
 following:
 
   DF-data.frame(x1=rep(c(0,1),each=50),x2=rep(c(0,1),50))
   tmp-rnorm(100)
   DF$y1-tmp+DF$x1*.5+DF$x2*.3+rnorm(100,0,.5)
   DF$y2-tmp+DF$x1*.5+DF$x2*.7+rnorm(100,0,.5)
   x.mlm-lm(cbind(y1,y2)~x1+x2,data=DF)
   coef(x.mlm)
 y1y2
 (Intercept) 0.07800993 0.2303557
 x1  0.52936947 0.3728513
 x2  0.13853332 0.4604842
 
 How can I test whether x1 and x2 respectively have the same effect on y1 
 and y2? In other words, how can I test if coef(x.mlm)[2,1] is 
 statistically equal to coef(x.mlm)[2,2] and coef(x.mlm)[3,1] to 
 coef(x.mlm)[3,2]? I looked at linear.hypothesis {car} and glh.test 
 {gmodels}, but these do not seem the apply to multivariate models.
 Thank you in advance,
 
 Uli Keller
 
 __
 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.

-- 
Andrew Robinson  
Department of Mathematics and StatisticsTel: +61-3-8344-9763
University of Melbourne, VIC 3010 Australia Fax: +61-3-8344-4599
Email: [EMAIL PROTECTED] http://www.ms.unimelb.edu.au

__
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] [R-pkgs] odfWeave Package

2006-07-18 Thread Kuhn, Max
I've been meaning send an announcement for this package, but Greg Snow
beat me to the punch today.

Max

snip

The odfWeave package is now available on CRAN at

http://lib.stat.cmu.edu/R/CRAN/src/contrib/Descriptions/odfWeave.html

and your local mirror.

The package extends Sweave to Open Document Format (ODF) text document 
files. Latex-style code chunks and in-line Sexpr commands can be used 
to embed R output into ODF file, which can then be exported to doc, 
rtf, html, pdf and other formats.

Other functions in the package facilitate ODF formatted tables, text 
and lists.

The current limitations of the package are:

 O tangling is not yet implement (but will be)

 O testing has been done on text documents generated by OpenOffice. 
   Other formats/editors may work, but are not (yet) supported.

Please send comments, suggestions and/or contributions.

Max Kuhn
Research Statistics
Pfizer Global RD
Max.Kuhn at pfizer.com
--
LEGAL NOTICE\ Unless expressly stated otherwise, this messag...{{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] How to find S4 generics? (was: inames() function and lmer())

2006-07-18 Thread Spencer Graves
*
* methods *
*
  You have asked an excellent question.  I can provide a partial answer 
below.  First, however, I wish to pose a question of my own, which could 
help answer your question:

  How can one obtain a simple list of the available generics for a 
class?  For an S3 class, the 'methods' functions provide that.  What 
about an S4 class?  That's entirely opaque to me, if I somehow can't 
find the relevant information in other ways.  For example, ?lmer-class 
lists many but not all of the methods available for objects of class 
'lmer'.  I think I once found a way to get that, but I'm not able to 
find documentation on it now.

*
* Retrieving information from an 'lmer' object *
*
  There are many ways to retrieve information from an object.  For 
'lmer', I think the best source of information is probably the help 
pages for 'lmer' and 'lmer-class'.  The latter tells you that there are 
Methods anova, coef, coerce, deviance, logLik, update, simulate, 
solve, terms, vcov, ranef and VarCorr for extracting information or 
modifying an object of class 'lmer'.  There are also other methods not 
listed on that page like 'fixef'.  I don't know how to find those easily.

  There is also the excellent vignette(MlmSoftRev) in the 'mlmRev' 
package.  (For help with it, see, e.g., 
http://finzi.psych.upenn.edu/R/Rhelp02a/archive/76134.html;.)

  Finally, the function 'str' will in most cases expose the structure 
of an object, thereby making it relatively easy to figure out how to get 
what is needed for many applications.  That does not always work, 
however, because 'str' is a generic function, not a primitive.  'str' 
seems to expose everything one might possibly want to know about an 
'lmer' object (apart from the theory behind it).  This is not the case 
for an object of class 'logLik', because a function 'str.logLik' 
provides a succinct summary of a 'logLik' object in a non-standard 
format.  The following will defeat 'str.logLik':

  fm1 - lmer(Reaction ~ Days + (Days|Subject), sleepstudy)
  lglk1 - logLik(fm1)
  str(lglk1)
Class 'logLik' : -871.8 (df=5) # I don't understand this.
  str(unclass(lglk1)) # This is in the standard 'str' format:
  atomic [1:1] -872
  - attr(*, nobs)= int 180
  - attr(*, nall)= int 180
  - attr(*, df)= num 5
  - attr(*, REML)= logi TRUE

  Best Wishes,
  Spencer Graves

A.R. Criswell wrote:
 Hello All,
 
 I would like to retrieve some of the results from the lmer(...)
 function in library lme4. If I run a model, say
 
 fm.1 - lmer(y ~ 1 + (1 | x), data = dog)
 
 and try names(fm.1), I get NULL. Is there anyway to retrieve the information?
 
 Thanks
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

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


[R] voronoi tessellations

2006-07-18 Thread zubin
Hello, looking to draw a voronoi tessellations in R - can anyone 
recommend a package that has tackled this?

some background:

i have a economic data set and created a sammons projection, like to now 
overlay a voronoi tessellation over the sammons 2-D solution for a slick 
visual, and potentially color each tessellation element based on a metric.

home.u - unique(home1)
home.dist - dist(home.u)
home.sam - sammon(home.dist,k=2)
plot(home.sam$points)

__
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 with ordered logistic regression using polr function.

2006-07-18 Thread Debarchana Ghosh
Hi,
I'm trying to fit a ordered logistic regression. The response variable 
(y) has three levels (0,1,2).
The command I've used is:

/ordlog-polr(y~x1+x2+x3+x4, data=finalbase, subset=heard, weight=wt, 
na.action=na.omit)
/
(There are no NA's in y but there are NA's in X's)

The error I'm getting is:
/Warning messages:
1: non-integer #successes in a binomial glm! in: eval(expr, envir, enclos)
2: design appears to be rank-deficient, so dropping some coefs in: 
polr(right.ans ~ S107 + children + work + rel + media + V013 +
/
Also, if I write
/summary(ordlog)/

I'm getting the following error:

/Re-fitting to get Hessian

Error in if (all(pr  0)) -sum(wt * log(pr)) else Inf :
missing value where TRUE/FALSE needed

/Could anybody point out the problem?

Thanks,
Debarchana.

-- 
Debarchana Ghosh
Research Assistant
Department of Geography
University of Minnesota
PH: 8143607580
email to: [EMAIL PROTECTED]
www.tc.umn.edu/~ghos0033

__
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 with ordered logistic regression using polr function

2006-07-18 Thread Debarchana Ghosh
Hi,
I'm trying to fit a ordered logistic regression. The response variable 
(y) has three levels (0,1,2).
The command I've used is:

ordlog-polr(y~x1+x2+x3+x4, data=finalbase, subset=heard, weight=wt, 
na.action=na.omit)

(There are no NA's in y but there are NA's in X's)

The error I'm getting is:
Warning messages:
1: non-integer #successes in a binomial glm! in: eval(expr, envir, enclos)
2: design appears to be rank-deficient, so dropping some coefs in: 
polr(right.ans ~ S107 + children + work + rel + media + V013 +

Also, if I write
summary(ordlog)

I'm getting the following error:

Re-fitting to get Hessian

Error in if (all(pr  0)) -sum(wt * log(pr)) else Inf :
   missing value where TRUE/FALSE needed

Could anybody point out the problem?

Thanks,
Debarchana.

-- 
Debarchana Ghosh
Research Assistant
Department of Geography
University of Minnesota
PH: 8143607580
email to: [EMAIL PROTECTED]
www.tc.umn.edu/~ghos0033

__
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] voronoi tessellations

2006-07-18 Thread Don MacQueen
I'll suggest going to the CRAN packages page and doing a search for voronoi.
Also, search for 'triangulation', since that is one of the uses of them.

-Don

At 11:46 PM -0400 7/18/06, zubin wrote:
Hello, looking to draw a voronoi tessellations in R - can anyone
recommend a package that has tackled this?

some background:

i have a economic data set and created a sammons projection, like to now
overlay a voronoi tessellation over the sammons 2-D solution for a slick
visual, and potentially color each tessellation element based on a metric.

home.u - unique(home1)
home.dist - dist(home.u)
home.sam - sammon(home.dist,k=2)
plot(home.sam$points)

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


[R] conditional plot

2006-07-18 Thread Manoj
Hi,
 Can anyone pls help me in plotting the following data?

 The data-set contains company name, specification-1, specification-2.

 The graph would basically plot company name with specification-1
on x-axis,  specification-2 on y-axis.

 Simply put - company name should get classified into one of the
four quardrants created by specification 1  specification2.

Thanks.

Manoj

__
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] ts and stl functions - still a problem

2006-07-18 Thread Spencer Graves
  Have you tried the following:

tstkr - ts(tkr[, 1], deltat=1/12)

  I had previously thought that 'tkr' was a numeric matrix;  if that 
had been the case, as.numeric(tkr) would have converted it to a numeric 
vector.  You've now said that class(tkr) = 'data.frame' of dim = c(131, 
1).  If this is the case, then tkr[, 1] should be a (numeric) vector.

  This should solve your problem.  However, I encourage you to spend 
more time studying the similarities and differences between vectors, 
matrices and data.frames, especially the examples in the ?matrix and 
?data.frame help pages, plus the corresponding sections of An 
Introduction to R, the first of the Manuals available via 
'help.start()'.

  Hope this helps.
  Spencer Graves

Daniel sutcliffe wrote:
 I am still having a problem with my coercing my data frame (tkr) into a time 
 series using ts  to use the stl function.

   When I read the data into R and do dim tkr the result is 132 1, when I type 
 class I get (data.frame).

   I have tried several methods so far to to coerce it into a a time series 
 and use the stl function,( see thread) .

   A suggestion was to  use the following:

   tstkr - ts(as.numeric(tkr), deltat=1/12)

   before using the stl function, however I now get this error message:

   Error in as.double.default(tkr) : (list) object cannot be coerced to 
 'double'

   I don't know what this meansdoes anybody have any other ideas...? Hope 
 I have put enough information on here for people to be able to help..if not 
 let me know, also if anyone wants to send me to email them my data then I am 
 happy to do so..

   Thanks to everyone who has tried to help so far much appreciated...
 
 Spencer Graves [EMAIL PROTECTED] wrote:
   The 'ts' function retains the 'dim' attribute of 'tkr'. When 'stl' 
 finds this 'dim' attribute, it thinks 'tstkr' is a multivariate time 
 series. This causes it to stop with the error, only univariate series 
 allowed.
 
 Consider the following modification of an example from the 'stl' help 
 file:
 
 not.1 - stl(nottem, per)
 Nottem - ts(array(nottem, dim=c(240, 1)))
 Not.1 - stl(Nottem)
 Error in stl(Nottem) : only univariate series are allowed
 
 Solution:
 
 tstkr - ts(as.numeric(tkr), deltat=1/12)
 
 After converting tkr and tstkr from a matrix to a vector like this, 
 please try 'stl(tstkr)'. If it doesn't work, please submit another post.
 
 Hope this helps.
 Spencer Graves
 p.s. Your example was not quite self-contained, because I didn't know 
 for sure the format, class, and attributes of your 'tkr' object. The 
 absence of these details made it harder for me (and, I believe, anyone 
 else) to reply. You might get better replies quicker with greater 
 attention to such details.
 
 Daniel sutcliffe wrote:
 Hi

 I am still having problems with using the stl 
 function, when I read the csv file into R into a
 file called tkr and use dim(tkr) the result is 132 x 1
 which is fine.
 When coerce it into a trime series using ts either:


 tstkr - ts(t(tkr), deltat=1/12) or

 tstkr - ts(c(tkr), deltat=1/12) 

 and use the stl function I get the following error:

 Error in stl(tstkr) : only univariate series are allowed

 id just use the tkr file I get the same error..does anyibe have an idea what 
 to do next, here is my data...it's not sensitive so if anyone wants to try 
 then you are very welcome!
 Rate 184.0222 180.517 222.5792 173.5066 192.7852 198.0429 182.2696 189.28 
 178.7644 206.8059 236.6 155.9807 231.7314 249.2868 222.9537 198.3761 
 201.8872 208.9094 242.2646 221.1982 228.2203 245.7757 244.0202 194.865 
 239.3664 234.0862 251.6867 235.8463 197.1253 237.6063 267.5271 228.8061 
 241.1264 249.9267 256.9669 188.325 258.8788 239.5069 214.8518 234.2237 
 211.3296 234.2237 237.7458 156.7361 239.5069 225.4183 257.1177 170.8248 
 230.1611 265.3001 296.9253 193.265 233.675 240.7028 249.4876 205.5637 
 237.1889 237.1889 289.8975 245.9736 283.1755 316.3875 372.3234 234.2316 
 263.9476 314.6395 286.6715 272.6875 323.3795 295.4115 300.6555 174.7997 
 227.184 277.4767 317.364 234.121 286.1478 279.2109 280.9452 235.8552 
 319.0982 
 296.5532 303.4901 173.4229 302.6072 312.8651 389.7991 223.9635 254.7371 
 329.9615 288.93 317.994 312.8651 381.2509 333.3808 194.8996 285.5743 
 304.0526 335.9698 307.4123 346.0489 288.934 335.9698 243.5781 384.6854 
 359.4876 357.8078 221.74 336.3712 344.6562 389.3952 286.6611 338.0282 
 407.6222 356.2552 241.9221 347.9702 400.9942 381.1102 304.8882 383.9077 
 418.5089 476.1774 331.1822 378.9647 375.6694 339.4206 364.1357 420.1565 
 446.5193 410.2705 296.5811

 Cheers and thanks to everyone who offered suggestions before.

 Daniel





 SAULEAU Erik-André wrote:
 Perhaps ts(t(tkr))?

 -Message d'origine-
 De : Daniel sutcliffe [mailto:[EMAIL PROTECTED] 
 Envoyé : mercredi 12 juillet 2006 15:53
 À : r-help@stat.math.ethz.ch
 Objet : [R] ts and stl functions


 Hi, 

 I have imported a csv