Re: [R] (no subject)

2005-01-04 Thread Petr Pikal
Hi Jeff

If you tried to search e.g. in Google

detrended canonical correspondence R

would give you some hints

e.g.

decorana {vegan}
 R Documentation

Detrended Correspondence Analysis and 
Basic Reciprocal Averaging

Cheers
Petr


On 4 Jan 2005 at 12:13, [EMAIL PROTECTED] wrote:

 Hi
 
 I'd like to know if the R can do the DCCA? Because I can't find the
 package about the DCCA in R. If it can not, please introduce a free
 software to me, which you think can easily do the work , thanks!
 
 
 
jeff
 
 __
 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

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


Re: [R] ISNAN() broken? in ver 2.x on MacOS X

2005-01-04 Thread Prof Brian Ripley
This is a good example of why it is necessary to include all the pertinent 
details (and I know that demands knowing the answer, but using standalone 
Rmath.h is *not* `an extension').  That you were using C++ was also 
pertinent.

I don't think you should be using R.h if you are building against
standalone libRmath.
On Tue, 4 Jan 2005, Bill Northcott wrote:
I see you are quite correct that IEEE_754 is defined in Rconfig.h on MacOS X. 
However, I was building against a standalone libRmath v1.9.1.  So I was 
including Rmath.h only and IEEE_754 was not defined.  The result was that I 
got R_IsNaNorNA in the preprocessed source.

I finally found it.  The culprit is
#include iostream
which is used in our real code
If I preprocess the following code then the substitution is ISNAN() -- 
(isnan(x)!=0)
#include iostream
#include R.h
#include Rmath.h
ISNAN(x);

Removing the #include iostream the substitution becomes
ISNAN(x)   -- (( ( sizeof ( x ) == sizeof(double) ) ? __isnand ( x ) : ( 
sizeof ( x ) == sizeof( float) ) ? __isnanf ( x ) : __isnan ( x ) )!=0)
which is correct.

This behaviour is the same with both gcc 3.3 and pre-release gcc 4.0 on MacOS 
X 10.3.7.

Is this a bug we should report to someone such the gcc maintainers?
You might want to swap the order of inclusion of headers.  Using C headers 
in a C++ program is always slightly dodgy.


Bill Northcott
On 04/01/2005, at 1:48 PM, Thomas Lumley wrote:
In R 1.9.1 Arith.h and Rmath.h contained code like
#ifdef IEEE_754
# define ISNAN(x) (isnan(x)!=0)
#else
# define ISNAN(x)  R_IsNaNorNA(x)
#endif
#define R_FINITE(x)R_finite(x)
int R_IsNaNorNA(double);
Although you have clearly gone to some effort to diagnose this, I think 
your diagnosis is incorrect.

1) In R 1.9.1 IEEE_754 was #defined on OS X, so we would already have had
  #define ISNAN(x) (isnan(x)!=0)
2) The gcc C preprocessor documentation says
  When the preprocessor expands a macro name, the macro's expansion
  replaces the macro invocation, then the expansion is examined for more
  macros to expand. For example,
 #define TABLESIZE BUFSIZE
 #define BUFSIZE 1024
 TABLESIZE
  == BUFSIZE
  == 1024
  TABLESIZE is expanded first to produce BUFSIZE, then that macro is
  expanded to produce the final result, 1024.
and while I haven't been able to find anything definitive about the ANSI 
standard, the gcc documentation usually flags extensions fairly well and in 
any case you are presumably using gcc (though you don't say explicitly).

A work-around would be to use isnan() rather than ISNAN().
--
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


[R] about kriging

2005-01-04 Thread Prodromos Zanis

Dear R-project users 

I want to use kriging method to interpolate irregularly distributed temperature 
data (station data) with latitude, longtitude and altitude in order to produce 
a gridded dataset altidude corrected.
Do you have any idea which package to use? 

I look forward for your hints.

With best regards
Prodromos Zanis



-- 

Dr. Prodromos Zanis
Centre for Atmospheric Physics and Climatology 
Academy of Athens
3rd September, Athens 15784, Greece
Tel. +30 210 8832048
Fax: +30 210 8832048
e-mail: [EMAIL PROTECTED]
Web address: http://users.auth.gr/~zanis/

__
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] about kriging

2005-01-04 Thread Ernesto Jardim
Hi,

Take a look at

http://agec144.agecon.uiuc.edu/csiss/Rgeo/

Regards

EJ

On Tue, 2005-01-04 at 09:09, Prodromos Zanis wrote:
 Dear R-project users 
 
 I want to use kriging method to interpolate irregularly distributed 
 temperature 
 data (station data) with latitude, longtitude and altitude in order to 
 produce 
 a gridded dataset altidude corrected.
 Do you have any idea which package to use? 
 
 I look forward for your hints.
 
 With best regards
 Prodromos Zanis
 


__
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] Question about creating error bars

2005-01-04 Thread Dan Bolser
On Tue, 28 Dec 2004, Dan Bolser wrote:


On Thu, 23 Dec 2004, Dan Bolser wrote:


I have data that looks (very roughly) like this...

Declarative: 
Several 'groups', each group with a very variable number of
data points associated.


Procedural:
v.1 - c(rep(50,1), rep(5,5), rep(2,10))  # Set up 
v.2 - c('a','b','c','d','e','f','g','h', # the
 'i','j','k','l','m','n','o','p') # groups
v.3 - rep(v.2,v.1)   # here.
v.4 - rnorm(length(v.3)) # Simulate data.
v.5 - tapply(v.4,v.3,mean)   # My analysis.

plot(v.5)

As the number of data points in a group gets smaller, so the variance of
the mean value for that group goes up. I would like to bootstrap some
error bars to show roughly how variable the value for each group is. Here
we have a normal distribution, but mostly my data is binary (i.e. each
group has a different number of (nearly) binary observations). The groups
are ordered, and I want to see any trend in my data accross the groups.

Dan.

Nothing I can do to help pal, sorry.


No, me either. Reading the ?boot documentation (in the library(boot)) is
less than useful too. The docs appear to be written for an expert in the
field (and R) rather than someone who would like to pick up the function
and run with it.

Its funny because on contrast to the complexity of the (tecnical)
spefication of the required functions is the conceptual simplicity of what
I want to do ...

Sample from some bins and create an error bar (of some kind) from the
samples.

It seems that without knowing how to do this (or exactly where to
look) their is nothing you can do.



__
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


[R] Difference between R CMD build --binary and R CMD INSTALL --build

2005-01-04 Thread michael watson \(IAH-C\)
As the title suggests, when building R packages on Windows, what is the
difference between:

R CMD build --binary mypack

And 

R CMD INSTALL --build mypack

??  The former is suggested by my previous notes and seems to work, and
the latter is suggested by
http://www.biostat.jhsph.edu/~kbroman/Rintro/Rwinpack.html, and also
seems to work.

Thanks in advance

Mick

__
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] Where to put example files?

2005-01-04 Thread michael watson \(IAH-C\)
I'm writing an R package which includes some text file parsing
functions, and I want to include with my package some example files to
be used with those functions.  My question is which directory should I
put these example files in for the user to access?  I have tried demo,
example, doc and sample but none seem to work or fit.

Thanks in advance
Mick

__
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] ISNAN() broken? in ver 2.x on MacOS X

2005-01-04 Thread Bill Northcott
I was attempting builds using both the standalone library including 
only Rmath.h and the using the installed R using R.h as well.  
Basically I have the following in relevant programs:
#ifndef MATHLIB_STANDALONE
#include R.h
#endif /* MATHLIB_STANDALONE */

As far as I can see, the only difference is the version of R.  ISNAN() 
will always fail on MacOS X with R 2.0.x whereas it might work with a 
standalone v1.9.x libRmath.

I tried reordering the headers but without any success.
The minimal test case to illustrate the problem is:
#include iostream
#include math.h
isnan(x)
Preprocess this on MacOS X and the isnan(x) will be unchanged which is 
wrong as isnan(x) is a macro in math.h.  Remove the iostream include 
and it will work properly.

In short there is a problem with the IEEE macros and C++ on MacOS X.
Bill Northcott
On 04/01/2005, at 7:09 PM, Prof Brian Ripley wrote:
This is a good example of why it is necessary to include all the 
pertinent details (and I know that demands knowing the answer, but 
using standalone Rmath.h is *not* `an extension').  That you were 
using C++ was also pertinent.

I don't think you should be using R.h if you are building against
standalone libRmath.
I finally found it.  The culprit is
#include iostream
which is used in our real code
If I preprocess the following code then the substitution is ISNAN() 
-- (isnan(x)!=0)
#include iostream
#include R.h
#include Rmath.h
ISNAN(x);

Removing the #include iostream the substitution becomes
ISNAN(x)   -- (( ( sizeof ( x ) == sizeof(double) ) ? __isnand ( x ) 
: ( sizeof ( x ) == sizeof( float) ) ? __isnanf ( x ) : __isnan ( x ) 
)!=0)
which is correct.

This behaviour is the same with both gcc 3.3 and pre-release gcc 4.0 
on MacOS X 10.3.7.

Is this a bug we should report to someone such the gcc maintainers?
You might want to swap the order of inclusion of headers.  Using C 
headers in a C++ program is always slightly dodgy.


Bill Northcott
On 04/01/2005, at 1:48 PM, Thomas Lumley wrote:
In R 1.9.1 Arith.h and Rmath.h contained code like
#ifdef IEEE_754
# define ISNAN(x) (isnan(x)!=0)
#else
# define ISNAN(x)  R_IsNaNorNA(x)
#endif
#define R_FINITE(x)R_finite(x)
int R_IsNaNorNA(double);
Although you have clearly gone to some effort to diagnose this, I 
think your diagnosis is incorrect.
1) In R 1.9.1 IEEE_754 was #defined on OS X, so we would already 
have had
  #define ISNAN(x) (isnan(x)!=0)
2) The gcc C preprocessor documentation says
  When the preprocessor expands a macro name, the macro's expansion
  replaces the macro invocation, then the expansion is examined for 
more
  macros to expand. For example,
 #define TABLESIZE BUFSIZE
 #define BUFSIZE 1024
 TABLESIZE
  == BUFSIZE
  == 1024
  TABLESIZE is expanded first to produce BUFSIZE, then that macro is
  expanded to produce the final result, 1024.
and while I haven't been able to find anything definitive about the 
ANSI standard, the gcc documentation usually flags extensions fairly 
well and in any case you are presumably using gcc (though you don't 
say explicitly).
A work-around would be to use isnan() rather than ISNAN().
--
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


Re: [R] ISNAN() broken? in ver 2.x on MacOS X

2005-01-04 Thread Bill Northcott
This sort of confirms that it is a bug.
From: Andrew Pinski [EMAIL PROTECTED]
Date: 4 January 2005 7:39:38 PM
To: Bill Northcott [EMAIL PROTECTED]
Cc: gcc@gcc.gnu.org
Subject: Re: C++ header file problem - is this a bug?
On Jan 4, 2005, at 2:13 AM, Bill Northcott wrote:
Is this a bug or is it expected behaviour and if so why?
Yes this is a bug but it is already filed see PR 14608.
Thanks,
Andrew Pinski
__
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] Difference between R CMD build --binary and R CMD INSTALL --build

2005-01-04 Thread Duncan Murdoch
On Tue, 4 Jan 2005 11:31:27 -, michael watson \(IAH-C\)
[EMAIL PROTECTED] wrote:

As the title suggests, when building R packages on Windows, what is the
difference between:

R CMD build --binary mypack

And 

R CMD INSTALL --build mypack

??  The former is suggested by my previous notes and seems to work, and
the latter is suggested by
http://www.biostat.jhsph.edu/~kbroman/Rintro/Rwinpack.html, and also
seems to work.

The former builds the package in a temporary directory.

The latter installs the package in the standard library location, then
builds from the installed copy.  This does a better job because it
allows help links to other packages.  

Duncan

__
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] Where to put example files?

2005-01-04 Thread Roger Bivand
On Tue, 4 Jan 2005, michael watson (IAH-C) wrote:

 I'm writing an R package which includes some text file parsing
 functions, and I want to include with my package some example files to
 be used with those functions.  My question is which directory should I
 put these example files in for the user to access?  I have tried demo,
 example, doc and sample but none seem to work or fit.
 

Try using a subdirectory to inst/ in the package source. For example, 
inst/shapes/sids.shp in package maptools can be accessed by:

system.file(shapes/sids.shp, package=maptools)[1]

See examples in the pixmap package.

Roger


 Thanks in advance
 Mick
 
 __
 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
 

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Breiviksveien 40, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 93 93
e-mail: [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


[R] Adding values to the end of a vector?

2005-01-04 Thread Dan Bolser

I want to add values onto the end of a vector, for example...

x - vector

for (i in 1:5){
  add_to_end_of_vector(i,x)
}

I just cant find the answer to this question!


Sorry for such a basic question, I tried...

x - c()

for (i in 1:5) x[length(x)] - i

but it didn't work.

__
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] Adding values to the end of a vector?

2005-01-04 Thread Liaw, Andy
Is this what you're looking for?

 x - numeric(0)
 for (i in 1:5) x - append(x, i)
 x
[1] 1 2 3 4 5

Andy


 From: Dan Bolser
 
 I want to add values onto the end of a vector, for example...
 
 x - vector
 
 for (i in 1:5){
   add_to_end_of_vector(i,x)
 }
 
 I just cant find the answer to this question!
 
 
 Sorry for such a basic question, I tried...
 
 x - c()
 
 for (i in 1:5) x[length(x)] - i
 
 but it didn't work.
 
 __
 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


Re: [R] Adding values to the end of a vector?

2005-01-04 Thread Ingmar Visser
The following works, but there may be more efficient ways to do this ...

 x=numeric(0)
 for(i in 1:5) { 
+ x[length(x)+1]=i
+ }
 x
[1] 1 2 3 4 5
 
Best, ingmar


On 1/4/05 2:41 PM, Dan Bolser [EMAIL PROTECTED] wrote:

 
 I want to add values onto the end of a vector, for example...
 
 x - vector
 
 for (i in 1:5){
   add_to_end_of_vector(i,x)
 }
 
 I just cant find the answer to this question!
 
 
 Sorry for such a basic question, I tried...
 
 x - c()
 
 for (i in 1:5) x[length(x)] - i
 
 but it didn't work.
 
 __
 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


Re: [R] Adding values to the end of a vector?

2005-01-04 Thread Roger Bivand
On Tue, 4 Jan 2005, Dan Bolser wrote:

 
 I want to add values onto the end of a vector, for example...
 
 x - vector
 
 for (i in 1:5){
   add_to_end_of_vector(i,x)
 }
 

?append


 I just cant find the answer to this question!
 
 
 Sorry for such a basic question, I tried...
 
 x - c()
 
 for (i in 1:5) x[length(x)] - i
 
 but it didn't work.
 
 __
 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
 

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Breiviksveien 40, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 93 93
e-mail: [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


RE: [R] Adding values to the end of a vector?

2005-01-04 Thread John Fox
Dear Dan,

The following also works:

 x - numeric(0)
 for (i in 1:5) x[i] - i
 x
[1] 1 2 3 4 5

It's worth noting, however, that extending a vector in this manner can be
very inefficient for large vectors, since the vector is recopied each time.
If you can anticipate the number of elements (or place an upper bound on
it), then it's better to do something like

 x - numeric(5)
 for (i in 1:5) x[i] - i

I hope this helps,
 John


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

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Liaw, Andy
 Sent: Tuesday, January 04, 2005 8:51 AM
 To: 'Dan Bolser'; R mailing list
 Subject: RE: [R] Adding values to the end of a vector?
 
 Is this what you're looking for?
 
  x - numeric(0)
  for (i in 1:5) x - append(x, i)
  x
 [1] 1 2 3 4 5
 
 Andy
 
 
  From: Dan Bolser
  
  I want to add values onto the end of a vector, for example...
  
  x - vector
  
  for (i in 1:5){
add_to_end_of_vector(i,x)
  }
  
  I just cant find the answer to this question!
  
  
  Sorry for such a basic question, I tried...
  
  x - c()
  
  for (i in 1:5) x[length(x)] - i
  
  but it didn't work.
  
  __
  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


Re: [R] Adding values to the end of a vector?

2005-01-04 Thread Lefebure Tristan
why not :

x-vector()
for (i in 1:5) { x -c(x,i) }

x
[1] 1 2 3 4 5

for (i in 1:5) { x -c(x,i) }

x
[1] 1 2 3 4 5 1 2 3 4 5



On Tuesday 04 January 2005 14:57, Ingmar Visser wrote:
  x=numeric(0)
  for(i in 1:5) {

 + x[length(x)+1]=i
 + }

  x

-- 

Tristan LEFEBURE
Laboratoire d'écologie des hydrosystèmes fluviaux (UMR 5023)
Université Lyon I - Campus de la Doua
Bat. Darwin C 69622 Villeurbanne - France

Phone: (33) (0)4 26 23 44 02
Fax: (33) (0)4 72 43 15 23

__
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] Adding values to the end of a vector?

2005-01-04 Thread Peter Dalgaard
Liaw, Andy [EMAIL PROTECTED] writes:

 Is this what you're looking for?
 
  x - numeric(0)
  for (i in 1:5) x - append(x, i)
  x
 [1] 1 2 3 4 5
 
 Andy

Also notice that in R many things are vectorized, so you may prefer

 append(x,1:5)
[1] 1 2 3 4 5

Extending a vector is done by allocating a longer vector and copying
the original. You really don't want to do that for every element if
you at all can avoid it. So vectorize, or at least preallocate the
extra storage, if you can.

-- 
   O__   Peter Dalgaard Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics 2200 Cph. N   
 (*) \(*) -- 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


RE: [R] Adding values to the end of a vector?

2005-01-04 Thread Daniel Almirall

I am curious.  How are these suggestions different (better, worse?) from

 x - NULL
 for (i in 1:5) x - c(x, i)


Thanks,
Danny



On Tue, 4 Jan 2005, John Fox wrote:

 Dear Dan,

 The following also works:

  x - numeric(0)
  for (i in 1:5) x[i] - i
  x
 [1] 1 2 3 4 5

 It's worth noting, however, that extending a vector in this manner can be
 very inefficient for large vectors, since the vector is recopied each time.
 If you can anticipate the number of elements (or place an upper bound on
 it), then it's better to do something like

  x - numeric(5)
  for (i in 1:5) x[i] - i

 I hope this helps,
  John

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

  -Original Message-
  From: [EMAIL PROTECTED]
  [mailto:[EMAIL PROTECTED] On Behalf Of Liaw, Andy
  Sent: Tuesday, January 04, 2005 8:51 AM
  To: 'Dan Bolser'; R mailing list
  Subject: RE: [R] Adding values to the end of a vector?
 
  Is this what you're looking for?
 
   x - numeric(0)
   for (i in 1:5) x - append(x, i)
   x
  [1] 1 2 3 4 5
 
  Andy
 
 
   From: Dan Bolser
  
   I want to add values onto the end of a vector, for example...
  
   x - vector
  
   for (i in 1:5){
 add_to_end_of_vector(i,x)
   }
  
   I just cant find the answer to this question!
  
  
   Sorry for such a basic question, I tried...
  
   x - c()
  
   for (i in 1:5) x[length(x)] - i
  
   but it didn't work.
  
   __
   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




__
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] How to verify using more than 2GB of memory

2005-01-04 Thread roger bos
My machine has 4Gb of memory under WinXP Pro.  Re-reading R for
Windows FAQ 2.7 I discovered that I can use editbin to add the
/LARGEADDRESSAWARE tag in the header without re-compiling, so that
is what I did.  I also check that it worked using dumpbin.  I then
edited my Boot.ini file to add the /3GB switch.  Then I went to my
R.0.0.1 patched that I modified as above and checked memory limit:

 memory.limit(NA)
[1] 1073741824

This is usual default.

 memory.limit(3*1024)
NULL
 memory.limit(4*1024)
Error in memory.size(size) : cannot decrease memory limit

It seems to work, since I am able to allocate 3Gb of memory, but not
4Gb  (though the error message I get isn't very helpful since I am
clearly not trying to decrease the memory limit).

However, this does not seem a good way to check that my
LARGEADDRESSAWARE version of R is working properly, because when I do
the same memory.limit operations on 2.0.1.0 dev that I downloaded this
morning I get the same results, without having made the program
LARGEADDRESSAWARE

Also, although trying to allocate 4Gb of memory does produce an error,
I can allocate 3.9Gb, which seems hard to beleive because the OS is
supposed to reserve 1Gb.

 memory.limit(3.9*1024)
NULL
 memory.limit(NA)
[1] 4187593113
 

So, finally, here are my questions, in order of interest:
1)  Once I have made my version of R LARGEADDRESSAWARE, how do I best
verify that all is well?
2)  Why was I able to increase the memory.limit to 3.9Gb on the new
version of R.0.1.0 that I did not make LARGEADDRESSAWARE?
3)  Is there any side-effect to making a program LARGEADDRESSAWARE?  I
don't want to sound lazy, but for the benefit of those who don't have
Visual Studio, why not make the distributed binary LARGEADDRESSAWARE?

Thanks in advance for any insight.

Roger J. Bos

__
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] boot and variances of the bootstrap replicates of the variable of interest?

2005-01-04 Thread Dan Bolser

I want to use boot.ci to generate confidence intervals over the
bootstrapped mean(s) of a group of observations (i.e. I have 10
observations and I want to know how confident I can be on the value for
the mean).

I don't know (or want to know) the details of bootstrapping - I just have
the simplistic idea of taking samples, measuring a statistic on the
sample, and getting some confidence in the result based on the variance of
the sample statistics.

I am not sure which type of interval [is] required, so I wanted to try
studentized intervals, because some of my groups have a small number of
samples (like one or two). However, variance estimates are required for
studentized intervals.

I can generate the variance for the statistic like this..


# Shame the 'mean' function dosn't work with boot
mean.x - function(xx,ii) mean(xx[ii])

# Don't know how (or why) to pick a value for this.
nboot - 1000 

# The 10 or so observations (in this case)
boot.sub - boot(data=shabby.sub$a, statistic=mean.x, R=nboot)

# Variance of the statistic over the 1000 replicates
my.var.t - var(boot.sub$t)

# t: A matrix with 'R' rows each of which is a bootstrap replicate
#of 'statistic'. 

However, I need the variance for each R statistic... I think...

It is a shame that boot and boot.ci cant work more together better,
without me (a patent idiot) having to pass values (correctly) from the
results of boot into boot.ci.


Any help with the above would be appreciated, as I am about to weep
horrible tears (once more) at the alter of R.

(not really :)

Dan.

__
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] How to verify using more than 2GB of memory

2005-01-04 Thread Uwe Ligges
roger bos wrote:
My machine has 4Gb of memory under WinXP Pro.  Re-reading R for
Windows FAQ 2.7 I discovered that I can use editbin to add the
/LARGEADDRESSAWARE tag in the header without re-compiling, so that
is what I did.  I also check that it worked using dumpbin.  I then
edited my Boot.ini file to add the /3GB switch.  Then I went to my
R.0.0.1 patched that I modified as above and checked memory limit:

memory.limit(NA)
[1] 1073741824
This is usual default.

memory.limit(3*1024)
NULL
memory.limit(4*1024)

memory.limit(4*1024-1)
should work (you get an overflow with 4*1024).

Error in memory.size(size) : cannot decrease memory limit
It seems to work, since I am able to allocate 3Gb of memory, but not
4Gb  (though the error message I get isn't very helpful since I am
clearly not trying to decrease the memory limit).
However, this does not seem a good way to check that my
LARGEADDRESSAWARE version of R is working properly, because when I do
the same memory.limit operations on 2.0.1.0 dev that I downloaded this
morning I get the same results, without having made the program
LARGEADDRESSAWARE
Also, although trying to allocate 4Gb of memory does produce an error,
I can allocate 3.9Gb, which seems hard to beleive because the OS is
supposed to reserve 1Gb.
Yes, but R does have the permission now to request 3.9 Gb, even if it 
does not get it from the OS.



memory.limit(3.9*1024)
NULL
memory.limit(NA)
[1] 4187593113
So, finally, here are my questions, in order of interest:
1)  Once I have made my version of R LARGEADDRESSAWARE, how do I best
verify that all is well?

If you don't trust the FAQ, you can try it out by assigning some big 
objects and look what happens. if it crashes, you will see...


2)  Why was I able to increase the memory.limit to 3.9Gb on the new
version of R.0.1.0 that I did not make LARGEADDRESSAWARE?
I think you won't get that many memory from the OS, but R is now allowed 
to ask the OS in order to get it.


3)  Is there any side-effect to making a program LARGEADDRESSAWARE?  I
don't want to sound lazy, but for the benefit of those who don't have
Visual Studio, why not make the distributed binary LARGEADDRESSAWARE?
I guess because of license issues. Is it permitted to distribute such a 
software (modified by Visual Studio) given both the Visual Studio 
license and the GPL from R???

Uwe Ligges

Thanks in advance for any insight.
Roger J. Bos
__
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


RE: [R] Adding values to the end of a vector?

2005-01-04 Thread Thomas Lumley
On Tue, 4 Jan 2005, Daniel Almirall wrote:
I am curious.  How are these suggestions different (better, worse?) from
x - NULL
for (i in 1:5) x - c(x, i)
One imporant difference is between solutions that preallocate storage and 
those that don't.
  x-numeric(5)
  for(i in 1:5) x[i]-i
allocates one vector of length 5 and then modifies it, but
  x-NULL
  for(i in 1:5) x-c(x,i)
allocates vectors of length 1, 2, 3, 4, 5 in turn.

You can't tell this from anything in the language definition, since 
conceptually x[i]-i also copies: it does
   x - [-(x,i,i)
and for more complicated replacement functions it will really copy.  Even 
if the first version really copied there would be some potential for 
having more efficient memory allocation with all the objects being of size 
5 (at least, for very large values of 5).

If you don't know how long the vector needs to be then you can't 
preallocate, but a common programming strategy in other languages is to 
allocate powers of 2 (eg start out with x-numeric(4) and if that isn't 
big enough do something like x-c(x,numeric(4)) to double the size). I 
don't know if anyone has looked at whether this is ever useful in R.

-thomas
Thanks,
Danny

On Tue, 4 Jan 2005, John Fox wrote:
Dear Dan,
The following also works:
x - numeric(0)
for (i in 1:5) x[i] - i
x
[1] 1 2 3 4 5
It's worth noting, however, that extending a vector in this manner can be
very inefficient for large vectors, since the vector is recopied each time.
If you can anticipate the number of elements (or place an upper bound on
it), then it's better to do something like
x - numeric(5)
for (i in 1:5) x[i] - i
I hope this helps,
 John

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

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Liaw, Andy
Sent: Tuesday, January 04, 2005 8:51 AM
To: 'Dan Bolser'; R mailing list
Subject: RE: [R] Adding values to the end of a vector?
Is this what you're looking for?
x - numeric(0)
for (i in 1:5) x - append(x, i)
x
[1] 1 2 3 4 5
Andy

From: Dan Bolser
I want to add values onto the end of a vector, for example...
x - vector
for (i in 1:5){
  add_to_end_of_vector(i,x)
}
I just cant find the answer to this question!
Sorry for such a basic question, I tried...
x - c()
for (i in 1:5) x[length(x)] - i
but it didn't work.
__
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

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


[R] R help search and Java(tm)?

2005-01-04 Thread Dan Bolser

I found this great search 

source(http://www.statslab.cam.ac.uk/~djw1005/Stats/Interests/search.R;)

helpHTML()

Has (or will) this become the standard search method?

Is R 'Free Software'? The dependence on Java seems a bit of a pain for
'freeness'. 

Did the above make it into CRAN?

Cheers,
Dan.

__
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] Statistical Learning and Data Mining Course

2005-01-04 Thread Trevor Hastie
Short course: Statistical Learning and Data Mining

Trevor Hastie and Robert Tibshirani, Stanford University

Sheraton Hotel,
Palo Alto, California
February 24  25, 2005


This two-day course gives a detailed overview of statistical models
for data mining, inference and prediction.  With the rapid
developments in internet technology, genomics and other high-tech
industries, we rely increasingly more on data analysis and statistical
models to exploit the vast amounts of data at our fingertips.

This sequel to our popular Modern Regression and Classification
course covers many new areas of unsupervised learning and data mining,
and gives an in-depth treatment of some of the hottest tools in
supervised learning.

The first course is not a prerequisite for this new course.
Most of the techniques discussed in the course are implemented by the
authors and others in the S language (S-plus or R), and all of the
examples were developed in S.

Day one focuses on state-of-art  methods for supervised
learning, including PRIM, boosting, support vector machines,
and very recent work on least angle regression and the lasso.

Day two covers unsupervised learning, including clustering, principal
components, principal curves and self-organizing maps.  Many
applications will be discussed, including the analysis of DNA
expression arrays - one of the hottest new areas in biology!

###
Much of the material is based on the book:

Elements of Statistical Learning: data mining, inference and prediction

Hastie, Tibshirani  Friedman, Springer-Verlag, 2001

http://www-stat.stanford.edu/ElemStatLearn/

A copy of this book will be given to all attendees.

###

For more information, and to register, visit the course homepage:

http://www-stat.stanford.edu/~hastie/mrc.html



---
  Trevor Hastie   [EMAIL PROTECTED]
  Professor, Department of Statistics, Stanford University
  Phone: (650) 725-2231 (Statistics)  Fax: (650) 725-8977 
  (650) 498-5233 (Biostatistics)   Fax: (650) 725-6951
  URL: http://www-stat.stanford.edu/~hastie 
    address: room 104, Department of Statistics, Sequoia Hall
   390 Serra Mall, Stanford University, CA 94305-4065 
  

[[alternative text/enriched 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


[R] rownames and plot lablels

2005-01-04 Thread Derek Margetts

I have a question about changing rownames.  In the
following function I am plotting the regression
coeficients with their corresponding mean.  Right now,
the labels on the plot and the rownames in the
dataframe are x1,x2,x3...etc.  Is there a way to make
the row names the same as the variable name entered
into the formula?  I.E. if x1 was a vector called
opinions, it would be labeled opinions on the plot
instead of x1.  I have tried using variations of
rownames(x)- namevector but have not been successful.
I keep getting a null.  Any suggestions would be
appreciated

Quadplot-function(y, x1, x2, x3 = NULL, x4  =
NULL,x5=NULL,x6=NULL,x7=NULL,x8=NULL,x9=NULL,x10=NULL,
x11=NULL, x12=NULL, x13=NULL, x14=NULL)

#section of code ommitted

my.formula - as.formula(y ~ x1 + x2 + x3+ x4+ x5+
x6+ x7+ x8+ x9+x10+x11+x12+x13+x14)
outlm - lm(my.formula)

#section of code ommitted

meanvec-c(mean(x1,na.rm=TRUE),mean(x2,na.rm=TRUE),mean(x3,na.rm=TRUE),mean(x4,na.rm=TRUE),mean(x5,na.rm=TRUE),mean(x6,na.rm=TRUE),mean(x7,na.rm=TRUE),mean(x8,na.rm=TRUE),mean(x9,na.rm=TRUE),mean(x10,na.rm=TRUE),mean(x11,na.rm=TRUE)
,mean(x12,na.rm=TRUE) ,mean(x13,na.rm=TRUE)
,mean(x14,na.rm=TRUE)) }
meanper-meanvec/6
meanper1-meanper*100

#This is the data frame created
mf - data.frame(Impact = abs(outlm$coef[-1]),
Performance = meanper1)

meanx-mean(abs(outlm$coef[-1]))
meany-mean(meanper1)
n-length(meanvec)
color-rep(blue,n)
color[(mf$Impactmeanx 
mf$Performancemeany)]-green
color[(mf$Impactmeanx  mf$Performancemeany)]-red
color[(mf$Impactmeanx 
mf$Performancemeany)]-gray

plot((mf),col=color,main=Perfomance vs.
Impact,xlab=Impact,ylab=Performance, type = n)
points(mf, pch=21, bg=color, cex=4)
text(x = mf$Impact, y = mf$Performance, labels =
rownames(mf))
abline(h=mean(mf$Performance))
abline(v=mean(mf$Impact))
print(mf)
}

Thanks
Derek

__
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] R help search and Java(tm)?

2005-01-04 Thread Peter Dalgaard
Dan Bolser [EMAIL PROTECTED] writes:

 I found this great search 
 
 source(http://www.statslab.cam.ac.uk/~djw1005/Stats/Interests/search.R;)
 
 helpHTML()

 Has (or will) this become the standard search method?

I think it got superseded by Jon Baron's RSiteSearch() function which
is finding its way into r-devel.
 
 Is R 'Free Software'? The dependence on Java seems a bit of a pain for
 'freeness'. 

A pain yes, but free software can rely on non-free compilers and OS's
if need be. It's just more convenient to build on tools that everyone
can get hold of. 

 Did the above make it into CRAN?

Well, you could check... It doesn't look like there is enough of the
ancillary matter (help pages etc.) for a CRAN package.

-- 
   O__   Peter Dalgaard Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics 2200 Cph. N   
 (*) \(*) -- 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


Re: [R] How to verify using more than 2GB of memory

2005-01-04 Thread Prof Brian Ripley
You forgot that 32-bit machines do integer operation mod 2^32.
So you actually asked for a memory limit of 0, which was a decrease.
We do recommend that you use the command-line flag, e.g. in the rw-FAQ.
% rterm --max-mem-size=4096M
WARNING: --max-mem-size=4096`M': too large and ignored
would have told you the error.
You don't seem to appreciate the difference between `limit' and 
`allocate': please read the help page for memory.limit with a modicum of 
care.  Once you appreciate that you have seriously misread the page, 
things will become a lot clearer.

On Tue, 4 Jan 2005, roger bos wrote:
My machine has 4Gb of memory under WinXP Pro.  Re-reading R for
Windows FAQ 2.7 I discovered that I can use editbin to add the
/LARGEADDRESSAWARE tag in the header without re-compiling, so that
is what I did.  I also check that it worked using dumpbin.  I then
edited my Boot.ini file to add the /3GB switch.  Then I went to my
R.0.0.1 patched that I modified as above and checked memory limit:
memory.limit(NA)
[1] 1073741824
This is usual default.
memory.limit(3*1024)
NULL
memory.limit(4*1024)
Error in memory.size(size) : cannot decrease memory limit
It seems to work, since I am able to allocate 3Gb of memory, but not
4Gb  (though the error message I get isn't very helpful since I am
clearly not trying to decrease the memory limit).
However, this does not seem a good way to check that my
LARGEADDRESSAWARE version of R is working properly, because when I do
the same memory.limit operations on 2.0.1.0 dev that I downloaded this
morning I get the same results, without having made the program
LARGEADDRESSAWARE
Also, although trying to allocate 4Gb of memory does produce an error,
I can allocate 3.9Gb, which seems hard to beleive because the OS is
supposed to reserve 1Gb.
memory.limit(3.9*1024)
NULL
memory.limit(NA)
[1] 4187593113

So, finally, here are my questions, in order of interest:
1)  Once I have made my version of R LARGEADDRESSAWARE, how do I best
verify that all is well?
2)  Why was I able to increase the memory.limit to 3.9Gb on the new
version of R.0.1.0 that I did not make LARGEADDRESSAWARE?
3)  Is there any side-effect to making a program LARGEADDRESSAWARE?  I
don't want to sound lazy, but for the benefit of those who don't have
Visual Studio, why not make the distributed binary LARGEADDRESSAWARE?
The maintainer does not have it.  Simple!
--
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


[R] x11 is not available

2005-01-04 Thread [EMAIL PROTECTED]
Dear list,

I have problems installing R-2.0.1 on SUSE Linux 9.2. I used the
following commands in order install R in 
/usr/local 

./configure --with x11 --with-readline
make
make   install

When starting R and trying to display a plot on the X-window system
output is written to a postscript file. When I try to run x11 with 

x11()

Error in X11(): X11 is not available.


I do have a running x11 window system with KDE


Any help is appreciated.

Many thanks

Peter Schlattmann

__
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] Non linear Square fit Function

2005-01-04 Thread Jagarlamudi, Choudary
Hi all,
I'm trying to use the nls function to do a nls curve fit. I have a histogram 
for my data. I need to get athe best curve fit for this. i am plotting 
experimental vs the theoretical values. my experimental values are got from my 
dnorm function, mean=mean of my mid values(hist) and sd=sd of my mid values. 
For the theoretical i'm using mean and sd of all 2 raw values as the start 
values. I'm getting no sd in my new curve. Can someone gimme some pointers to 
get started here.
I need my nls to spit out sd and mean of the new fit which it does'nt. is there 
a better function or can i somehow get around this.
Thanks in advance.
 
Choudary Jagarlamudi
Instructor
Southwestern Oklahoma State University
STF 254
100 campus Drive
Weatherford OK 73096
Tel 580-774-7136

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


[R] scree plot

2005-01-04 Thread Anne
Hi!

Is there an easy way to add to the scree-plot labels to each value pertaining 
to the cumulative proportion of explained variance?

Thanks and a happy new year

Anne

Anne Piotet
Tel: +41 79 359 83 32 (mobile)
Email: [EMAIL PROTECTED]
---
M-TD Modelling and Technology Development
PSE-C
CH-1015 Lausanne
Switzerland
Tel: +41 21 693 83 98
Fax: +41 21 646 41 33
--
 
[[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


[R] bootstrap proportions?

2005-01-04 Thread Dan Bolser

Hello, 

I have several ordered groups (20), each with several observations. Each
group has fewer observations roughly linearly from 30 to 0. Each
observation is a proportion. As I know the max and min values for a
proporion are 1 and 0, I am adding these values to each group to allow
bootstrap for groups with = 1 observations. Sometimes the bootstrap
confidence interval is  1, which makes me think that I am doing something
deeply wrong.

How can I do bootstrap properly with observations which are proportions?

What special precautions should I be taking for very low sample sizes with
bootstrap?

Is this a bad question for R-help?

Thanks,
Dan.

__
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] x11 is not available

2005-01-04 Thread Sean Davis
If I remember correctly, the correct command line switch is:
-with-x11
Note the dash.
Sean
On Jan 4, 2005, at 4:41 PM, [EMAIL PROTECTED] wrote:
Dear list,
I have problems installing R-2.0.1 on SUSE Linux 9.2. I used the
following commands in order install R in
/usr/local
./configure --with x11 --with-readline
make
make   install
When starting R and trying to display a plot on the X-window system
output is written to a postscript file. When I try to run x11 with
x11()
Error in X11(): X11 is not available.
I do have a running x11 window system with KDE
Any help is appreciated.
Many thanks
Peter Schlattmann
__
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


Re: [R] x11 is not available

2005-01-04 Thread Gardar Johannesson
My guess is that you have a 'Desktop' version of SUSE installed which
does not include the needed X11 development environment; from the R
Installation and Administration manual:

Unless you do not want to view graphs on-screen you need X11 installed,
including its headers and client libraries. (On Fedora Core 2 Linux this
means the xorg-x11-devel and xorg-x11-libs RPMs, for example. Older
Linuxen used XFree86-.)


Good luck,
Gardar

On Tue, 2005-01-04 at 13:41, [EMAIL PROTECTED] wrote:
 Dear list,
 
 I have problems installing R-2.0.1 on SUSE Linux 9.2. I used the
 following commands in order install R in 
 /usr/local 
 
 ./configure --with x11 --with-readline
 make
 make   install
 
 When starting R and trying to display a plot on the X-window system
 output is written to a postscript file. When I try to run x11 with 
 
 x11()
 
 Error in X11(): X11 is not available.
 
 
 I do have a running x11 window system with KDE
 
 
 Any help is appreciated.
 
 Many thanks
 
 Peter Schlattmann
 
 __
 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

Gardar Johannesson  [EMAIL PROTECTED]
 Applied Statistics  Economics Group   Tel: 925 422-3901
 Systems  Decision Sciences SectionFax: 925 422-4141
Lawrence Livermore National Laboratory  Loc: B141/R1128
7000 East Ave., L-229
Livermore, CA 94550-9234

__
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] print(cat(bleh)) shows up strange NULL

2005-01-04 Thread Dan Bolser

I am trying the following code...

for(i in 1:bins){
  print(cat(c(i, length(var1[var1==i]
}

Where var1 is a vector with zero or more values = {1, 2, ..., bins} (or
something like that).

The result I get is...

1 33NULL
2 28NULL
3 39NULL
4 27NULL
5 32NULL
6 30NULL
7 23NULL
8 16NULL
9 10NULL
10 15NULL
11 13NULL
12 7NULL
13 3NULL
14 7NULL
15 2NULL
16 0NULL
17 2NULL
18 0NULL
19 0NULL
20 3NULL

I don't know what I am doing to get those stray NULL characters printed.

I also tried...

for(i in 1:bins){
  print(cat(i, length(var1[var1==i])))
}

Which is essentially the same.

__
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] warnings and errors with R CMD INSTALL

2005-01-04 Thread thomas
Hello,

unfortunately I had to compile latest version of R-2.0.1 by myself. I'd
rather would prefer vendors binaries but since the current version of
Ubuntu defaults to 1.9.x I had to compile R on my own in order to be up
to date!
So far, everything went fine and R runs smoothly. Unfortunately I am not
able to use R CMD INSTALL command to install add-on packages.

I followed RNews 3/3 and used:

1. R CMD INSTALL package_version.tar.gz 

and

2.options(CRAN=http://umfragen.sowi.uni-mainz.de/CRAN/;)
install.packages(pkg1. pkg2)

Both approaches end up i.e.:

WARNING: invalid package 'pkg1.tar.gz'
ERROR: no packages specified

Well, R administration manual and RNews give some examples which I took
as basis to install further packages.
I, as suggested in RNews and administration manual alike, omitted the -l
option, since I want to stay with default library location!

Obviously I am stuck in a situation not covered by the docs! Well, most
likely I misunderstand something, can anyone help out with this?

greetings

Thomas



system:


platform i686-pc-linux-gnu
arch i686 
os   linux-gnu
system   i686, linux-gnu  
status
major2
minor0.1  
year 2004 
month11   
day  15   
language R

__
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] Re : Frequency count

2005-01-04 Thread ssim
Dear list,

I have a dataset as follow and I would like to count the frequencies for
the combination of the two variables (f1 and f2)  for each id. I know it is
should be straight forward, but I just don't know how to do it in R. Here
is the SAS code I will use to get the output I want :

proc means nway;
class id f1 f2;
var flag
output out=temp;


Dataset:
idf1f2flag
798   1 2 1
777   0 2 1
798   2 2 1
777   0 2 1
777   1 1 1

Output:
Id=798
1-2   1
2-2   1

Id=777
0-2   2
1-1   1
___
This message, including attachments, is confidential. If you...{{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


Re: [R] print(cat(bleh)) shows up strange NULL

2005-01-04 Thread Peter Dalgaard
Dan Bolser [EMAIL PROTECTED] writes:

 I am trying the following code...
 
 for(i in 1:bins){
   print(cat(c(i, length(var1[var1==i]
 }
 
 Where var1 is a vector with zero or more values = {1, 2, ..., bins} (or
 something like that).
 
 The result I get is...
 
 1 33NULL
 2 28NULL

 19 0NULL
 20 3NULL
 
 I don't know what I am doing to get those stray NULL characters printed.

You're printing them, will you believe it...?
 
Consider this:

 x - cat(abc)
abc print(x)
NULL
 x
NULL
 print(cat(abc))
abcNULL

I.e. cat() always returns NULL, invisibly unless you force it to be
printed. 


-- 
   O__   Peter Dalgaard Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics 2200 Cph. N   
 (*) \(*) -- 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


Re: [R] print(cat(bleh)) shows up strange NULL

2005-01-04 Thread Dan Bolser
On 4 Jan 2005, Peter Dalgaard wrote:

Dan Bolser [EMAIL PROTECTED] writes:

 I am trying the following code...
 
 for(i in 1:bins){
   print(cat(c(i, length(var1[var1==i]
 }
 
 Where var1 is a vector with zero or more values = {1, 2, ..., bins} (or
 something like that).
 
 The result I get is...
 
 1 33NULL
 2 28NULL

 19 0NULL
 20 3NULL
 
 I don't know what I am doing to get those stray NULL characters printed.

You're printing them, will you believe it...?
 
Consider this:

 x - cat(abc)
abc print(x)
NULL
 x
NULL
 print(cat(abc))
abcNULL

I.e. cat() always returns NULL, invisibly unless you force it to be
printed. 

never trust a cat!





__
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] quantiles for geometric distribution

2005-01-04 Thread dax42
Dear list,

I have got an array with observational values t and I would like to fit 
a geometric distribution to it.
As I understand the geometric distribution, there is only one 
parameter, the probability p. I estimated it by 1/mean(t).

Now I plotted the estimated density function by
plot(ecdf(t),do.points=FALSE,col.h=blue);

and I would like to add the geometric distribution. This should be 
possibly with the function pgeom().

Unfortunately I do not understand what is meant by the argument q, 
vector of quantiles representing the number of failures in a sequence 
of Bernoulli trials before success occurs according to R help.

I am familiar with quantiles, but why do I need them here?
Does anybody know what this means? What am I supposed to do?

Thanks again for all the help.
Cheers, Dax
[[alternative text/enriched 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


Re: [R] print(cat(bleh)) shows up strange NULL

2005-01-04 Thread Spencer Graves
 Consider the following: 

 for(i in 1:2)cat(i, )
1 2 
 for(i in 1:2)print(i)
[1] 1
[1] 2
 for(i in 1:2)print(cat(i))
1NULL
2NULL
  
 hope this helps.  spencer graves

Dan Bolser wrote:
I am trying the following code...
for(i in 1:bins){
 print(cat(c(i, length(var1[var1==i]
}
Where var1 is a vector with zero or more values = {1, 2, ..., bins} (or
something like that).
The result I get is...
1 33NULL
2 28NULL
3 39NULL
4 27NULL
5 32NULL
6 30NULL
7 23NULL
8 16NULL
9 10NULL
10 15NULL
11 13NULL
12 7NULL
13 3NULL
14 7NULL
15 2NULL
16 0NULL
17 2NULL
18 0NULL
19 0NULL
20 3NULL
I don't know what I am doing to get those stray NULL characters printed.
I also tried...
for(i in 1:bins){
 print(cat(i, length(var1[var1==i])))
}
Which is essentially the same.
__
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


Re: [R] print(cat(bleh)) shows up strange NULL

2005-01-04 Thread Dan Bolser
On Tue, 4 Jan 2005, Dan Bolser wrote:

On 4 Jan 2005, Peter Dalgaard wrote:

Dan Bolser [EMAIL PROTECTED] writes:

 I am trying the following code...
 
 for(i in 1:bins){
   print(cat(c(i, length(var1[var1==i]
 }
 
 Where var1 is a vector with zero or more values = {1, 2, ..., bins} (or
 something like that).
 
 The result I get is...
 
 1 33NULL
 2 28NULL

 19 0NULL
 20 3NULL
 
 I don't know what I am doing to get those stray NULL characters printed.

You're printing them, will you believe it...?
 
Consider this:

 x - cat(abc)
abc print(x)
NULL
 x
NULL
 print(cat(abc))
abcNULL

I.e. cat() always returns NULL, invisibly unless you force it to be
printed. 

never trust a cat!

I meant to add that this was causing me problems when trying to create a
file name for use with the png command.

png tries to create a 'NULL' file name, and returns a rather cryptic
message...

Error in X11(paste(png::, filename, sep = ), width, height, pointsize,: 
unable to start device PNG
In addition: Warning message: 
could not open PNG file `' 
 

However, the warning provides the answer to the problem... use paste
instead of cat.

Cheers,
Dan.









__
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] Re : Frequency count

2005-01-04 Thread Andrew Robinson
Try table(), aggregate(), or tapply(), using length() in the last two
functions.

I hope that this helps,

Andrew

On Wed, Jan 05, 2005 at 11:36:07AM +1300, [EMAIL PROTECTED] wrote:
 Dear list,
 
 I have a dataset as follow and I would like to count the frequencies for
 the combination of the two variables (f1 and f2)  for each id. I know it is
 should be straight forward, but I just don't know how to do it in R. Here
 is the SAS code I will use to get the output I want :
 
 proc means nway;
 class id f1 f2;
 var flag
 output out=temp;
 
 
 Dataset:
 idf1f2flag
 798   1 2 1
 777   0 2 1
 798   2 2 1
 777   0 2 1
 777   1 1 1
 
 Output:
 Id=798
 1-2   1
 2-2   1
 
 Id=777
 0-2   2
 1-1   1
 ___
 This message, including attachments, is confidential. If you...{{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

-- 
Andrew Robinson  Ph: 208 885 7115
Department of Forest Resources   Fa: 208 885 6226
University of Idaho  E : [EMAIL PROTECTED]
PO Box 441133W : http://www.uidaho.edu/~andrewr
Moscow ID 83843  Or: http://www.biometrics.uidaho.edu
No statement above necessarily represents my employer's opinion.

__
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] Re : Frequency count

2005-01-04 Thread Tarmo Remmel
This might help...

Here KI is a matrix such as your dataset (without the flag)

dups - function (intab=KI) {

  # CREATE A MATRIX WITH ONLY THE UNIQUE ROWS OF intab
  intabunique - unique(intab)

  # COLLAPSE THE FULL TABLE
  a2 - apply(intab, 1, paste, collapse=:)

  # COLLAPSE THE UNIQUE TABLE
  b2 - apply(intabunique, 1, paste, collapse=:)

  # COUNT UNIQUE ROW OCCURRENCES AND WRITE TO .COUNT
  assign(.COUNT,c(table(c(a2,unique(b2)))[b2] - 1) ,pos=1)

  # WRITE THE UNIQUE TABLE TO .KIUNIQUE
  assign(.KIUNIQUE, intabunique, pos=1)
}


 KI
 col1 col2 col3
[1,]111
[2,]211
[3,]121
[4,]111
[5,]121
[6,]111
[7,]222

 dups(KI)

 .KIUNIQUE
 col1 col2 col3
[1,]111
[2,]211
[3,]121
[4,]222

 .COUNT
1:1:1 2:1:1 1:2:1 2:2:2
3 1 2 1


__
Tarmo Remmel  B.E.S., M.Sc.F., Ph.D. Candidate
GUESS Lab, Department of Geography
University of Toronto, Toronto, ON, Canada
http://eratos.erin.utoronto.ca/remmelt




 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] Behalf Of [EMAIL PROTECTED]
 Sent: Tuesday, January 04, 2005 5:36 PM
 To: r-help@stat.math.ethz.ch
 Subject: [R] Re : Frequency count


 Dear list,

 I have a dataset as follow and I would like to count the frequencies for
 the combination of the two variables (f1 and f2)  for each id. I
 know it is
 should be straight forward, but I just don't know how to do it in R. Here
 is the SAS code I will use to get the output I want :

 proc means nway;
 class id f1 f2;
 var flag
 output out=temp;


 Dataset:
 idf1f2flag
 798   1 2 1
 777   0 2 1
 798   2 2 1
 777   0 2 1
 777   1 1 1

 Output:
 Id=798
 1-2   1
 2-2   1

 Id=777
 0-2   2
 1-1   1
 __
 _
 This message, including attachments, is confidential. If you...{{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


Re: [R] Re : Frequency count

2005-01-04 Thread Peter Dalgaard
[EMAIL PROTECTED] writes:

 Dear list,
 
 I have a dataset as follow and I would like to count the frequencies for
 the combination of the two variables (f1 and f2)  for each id. I know it is
 should be straight forward, but I just don't know how to do it in R. Here
 is the SAS code I will use to get the output I want :
 
 proc means nway;
 class id f1 f2;
 var flag
 output out=temp;
 
 
 Dataset:
 idf1f2flag
 798   1 2 1
 777   0 2 1
 798   2 2 1
 777   0 2 1
 777   1 1 1
 
 Output:
 Id=798
 1-2   1
 2-2   1
 
 Id=777
 0-2   2
 1-1   1

Here's one way:

 dd - read.table(stdin(),header=TRUE)
0: idf1f2flag
1: 798   1 2 1
2: 777   0 2 1
3: 798   2 2 1
4: 777   0 2 1
5: 777   1 1 1
6:
 by(dd, dd$id, function(x)table(paste(x$f1,x$f2,sep=-)))
 dd$id: 777

0-2 1-1
  2   1

dd$id: 798

1-2 2-2
  1   1


-- 
   O__   Peter Dalgaard Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics 2200 Cph. N   
 (*) \(*) -- 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


Re: [R] Re : Frequency count

2005-01-04 Thread Thomas Lumley
On Wed, 5 Jan 2005 [EMAIL PROTECTED] wrote:
Dear list,
I have a dataset as follow and I would like to count the frequencies for
the combination of the two variables (f1 and f2)  for each id. I know it is
should be straight forward, but I just don't know how to do it in R. Here
is the SAS code I will use to get the output I want :
table() will count frequencies, and interaction() will create a variable 
with all combinations of a set of variables, so something like

table(interaction(f1,f2))
-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


[R] Histogram

2005-01-04 Thread duraikannan sundaramoorthi
I have data on a single variable LOGT. It has about
300,000 observations. I am trying to make a Histogram
out of this data set. Following is my effort. Could
anyone help me to solve this error.


 hist(x)
Error in hist.default(x) : `x' must be numeric
 class(x)
[1] data.frame
 is.object(x)
[1] TRUE
 is.vector(x)
[1] FALSE
 is.numeric(x)
[1] FALSE
 is.factor(x)
[1] FALSE

note:plot(x) works okay

durai

__
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] warnings and errors with R CMD INSTALL

2005-01-04 Thread thomas
Hello,

Am Dienstag, den 04.01.2005, 23:25 + schrieb Prof Brian Ripley:
 On Tue, 4 Jan 2005, thomas wrote:

 
  I followed RNews 3/3 and used:
 
  1. R CMD INSTALL package_version.tar.gz
 
  and
 
  2.options(CRAN=http://umfragen.sowi.uni-mainz.de/CRAN/;)
  install.packages(pkg1. pkg2)
 
  Both approaches end up i.e.:
 
  WARNING: invalid package 'pkg1.tar.gz'
  ERROR: no packages specified
 
 But there is no package `pkg1' on CRAN.  Try a real name like
 
 install.packages(tree)

Well, of cause I didn't want install pkg1 or pkg2,
the precise commandline was:

1. R CMD INSTALL epitools_0.3-3.tar.gz

and

2.  install.packages(accuracy, zoo, abind)

Sorry for being so unclear in my first message! I did take the package
names from R-CRAN website, copied and pasted to commandline


Thanks
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


Re: [R] Histogram

2005-01-04 Thread Andrew Robinson
x is not a numeric vector, so R doesn't know how to take a histogram.
Here are your clues:

 class(x)
 [1] data.frame
 is.numeric(x)
 [1] FALSE

so, try

names(x)

I speculate that LOGT is contained in the dataframe x.  If so, try

hist(x$LOGT)

I hope that this helps.

Andrew


On Tue, Jan 04, 2005 at 03:37:16PM -0800, duraikannan sundaramoorthi wrote:
 I have data on a single variable LOGT. It has about
 300,000 observations. I am trying to make a Histogram
 out of this data set. Following is my effort. Could
 anyone help me to solve this error.
 
 
  hist(x)
 Error in hist.default(x) : `x' must be numeric
  class(x)
 [1] data.frame
  is.object(x)
 [1] TRUE
  is.vector(x)
 [1] FALSE
  is.numeric(x)
 [1] FALSE
  is.factor(x)
 [1] FALSE
 
 note:plot(x) works okay
 
 durai
 
 __
 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

-- 
Andrew Robinson  Ph: 208 885 7115
Department of Forest Resources   Fa: 208 885 6226
University of Idaho  E : [EMAIL PROTECTED]
PO Box 441133W : http://www.uidaho.edu/~andrewr
Moscow ID 83843  Or: http://www.biometrics.uidaho.edu
No statement above necessarily represents my employer's opinion.

__
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] subsetting within a function using lme

2005-01-04 Thread Pamela McCaskie
Thankyou for your help with subsetting within a function. I have now tried
to apply the same theory in the framework of an lme as follows:

fit1.lme - eval(substitute(lme(fixed=fixed, data=dataframe,
random=random, correlation=corCAR1(form= corr), na.action=na.omit,
subset=subset),list(subset=subs)))

but I get the following error:

Error in switch(mode(object), name = , numeric = , call = object,
character = as.name(object),  :
[[ cannot be of mode logical

I'm not sure why. Can anyone help me with this?
kind regards
Pam



On Thu, 30 Dec 2004, Thomas Lumley wrote:

 On Thu, 30 Dec 2004, Pamela McCaskie wrote:
  And so my attempt to wrap a simple function around this looks like:
  test.fun - function(formula, mydata, sub=NULL){
   subs - with(mydata, eval(sub))
   fit.glm - glm(formula=formula, data=mydata, family=binomial, subset=subs)
   return(fit.glm)
  }
 
  But when I tested it out with
  test - test.fun(y~x1+x2, mydata=testdata, sub=expression(SEX==0))
 
  I get:
  Error in [.data.frame(structure(list(N_ASTHMA = as.integer(c(0, 0, 0,  :
 invalid subscript type

 I get a different error: it may be that you have an object called `subs`
 in the global environment

  I'm guessing that it's looking in the global environment for
  subs,

 More precisely, it is looking in environment where `formula` was created,
 which happens to be the global environment.

 This is the sort of thing that happens with the fitting functions because
 they go to such lengths to break the basic scoping of R.


 You probably have to substitute() the evaluated subset into the glm call.

fit.glm - eval(substitute(glm(formula=formula, data=mydata,
   family=binomial, subset=subset),list(subset=subs)))


   -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


RE: [R] Non linear Square fit Function

2005-01-04 Thread Liaw, Andy
Have you tried fitdistr in the MASS package (should be installed with R by
default)?

Andy

 From: Jagarlamudi, Choudary
 
 Hi all,
 I'm trying to use the nls function to do a nls curve fit. I 
 have a histogram for my data. I need to get athe best curve 
 fit for this. i am plotting experimental vs the theoretical 
 values. my experimental values are got from my dnorm 
 function, mean=mean of my mid values(hist) and sd=sd of my 
 mid values. For the theoretical i'm using mean and sd of all 
 2 raw values as the start values. I'm getting no sd in my 
 new curve. Can someone gimme some pointers to get started here.
 I need my nls to spit out sd and mean of the new fit which it 
 does'nt. is there a better function or can i somehow get around this.
 Thanks in advance.
  
 Choudary Jagarlamudi
 Instructor
 Southwestern Oklahoma State University
 STF 254
 100 campus Drive
 Weatherford OK 73096
 Tel 580-774-7136
 
   [[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
 


__
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] subsetting within a function using lme

2005-01-04 Thread Andrew Robinson
Hi Pam,

can you provide just enough code for us to reproduce the error on one
of the sample datasets included with lme?  No more and no less than
the minimum necessary, please.

I find it easier to debug when things are concrete :)

Thanks,

Andrew

On Wed, Jan 05, 2005 at 08:48:45AM +0800, Pamela McCaskie wrote:
 Thankyou for your help with subsetting within a function. I have now tried
 to apply the same theory in the framework of an lme as follows:
 
 fit1.lme - eval(substitute(lme(fixed=fixed, data=dataframe,
 random=random, correlation=corCAR1(form= corr), na.action=na.omit,
 subset=subset),list(subset=subs)))
 
 but I get the following error:
 
 Error in switch(mode(object), name = , numeric = , call = object,
 character = as.name(object),  :
 [[ cannot be of mode logical
 
 I'm not sure why. Can anyone help me with this?
 kind regards
 Pam
 
 
 
 On Thu, 30 Dec 2004, Thomas Lumley wrote:
 
  On Thu, 30 Dec 2004, Pamela McCaskie wrote:
   And so my attempt to wrap a simple function around this looks like:
   test.fun - function(formula, mydata, sub=NULL){
subs - with(mydata, eval(sub))
fit.glm - glm(formula=formula, data=mydata, family=binomial, 
   subset=subs)
return(fit.glm)
   }
  
   But when I tested it out with
   test - test.fun(y~x1+x2, mydata=testdata, sub=expression(SEX==0))
  
   I get:
   Error in [.data.frame(structure(list(N_ASTHMA = as.integer(c(0, 0, 0,  :
  invalid subscript type
 
  I get a different error: it may be that you have an object called `subs`
  in the global environment
 
   I'm guessing that it's looking in the global environment for
   subs,
 
  More precisely, it is looking in environment where `formula` was created,
  which happens to be the global environment.
 
  This is the sort of thing that happens with the fitting functions because
  they go to such lengths to break the basic scoping of R.
 
 
  You probably have to substitute() the evaluated subset into the glm call.
 
 fit.glm - eval(substitute(glm(formula=formula, data=mydata,
family=binomial, subset=subset),list(subset=subs)))
 
 
  -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

-- 
Andrew Robinson  Ph: 208 885 7115
Department of Forest Resources   Fa: 208 885 6226
University of Idaho  E : [EMAIL PROTECTED]
PO Box 441133W : http://www.uidaho.edu/~andrewr
Moscow ID 83843  Or: http://www.biometrics.uidaho.edu
No statement above necessarily represents my employer's opinion.

__
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] subsetting within a function using lme

2005-01-04 Thread Pamela McCaskie
Here you go
A simplified version of the function looks like this:

test.fun - function(fixed, random, mydata, sub=NULL){

  library(nlme)
  subs - with(mydata, eval(sub))
  fit.lme - eval(substitute(lme(fixed=fixed, data=mydata, random=random,
na.action=na.omit, subset=subset),list(subset=subs)))

  return(fit.lme)
}

So using the Orthodont dataset I tried:

test - snp.long(fixed=distance~age, random=~1|Subject, mydata=Orthodont,
sub=expression(Sex==Male))

and get that error.
Error in switch(mode(object), name = , numeric = , call = object,
character = as.name(object),  :
[[ cannot be of mode logical

Thanks for your help

 Hi Pam,

 can you provide just enough code for us to reproduce the error on one
 of the sample datasets included with lme?  No more and no less than
 the minimum necessary, please.

 I find it easier to debug when things are concrete :)

 Thanks,

 Andrew

 On Wed, Jan 05, 2005 at 08:48:45AM +0800, Pamela McCaskie wrote:
  Thankyou for your help with subsetting within a function. I have now tried
  to apply the same theory in the framework of an lme as follows:
 
  fit1.lme - eval(substitute(lme(fixed=fixed, data=dataframe,
  random=random, correlation=corCAR1(form= corr), na.action=na.omit,
  subset=subset),list(subset=subs)))
 
  but I get the following error:
 
  Error in switch(mode(object), name = , numeric = , call = object,
  character = as.name(object),  :
  [[ cannot be of mode logical
 
  I'm not sure why. Can anyone help me with this?
  kind regards
  Pam
 
 
 
  On Thu, 30 Dec 2004, Thomas Lumley wrote:
 
   On Thu, 30 Dec 2004, Pamela McCaskie wrote:
And so my attempt to wrap a simple function around this looks like:
test.fun - function(formula, mydata, sub=NULL){
 subs - with(mydata, eval(sub))
 fit.glm - glm(formula=formula, data=mydata, family=binomial, 
subset=subs)
 return(fit.glm)
}
   
But when I tested it out with
test - test.fun(y~x1+x2, mydata=testdata, sub=expression(SEX==0))
   
I get:
Error in [.data.frame(structure(list(N_ASTHMA = as.integer(c(0, 0, 0, 
 :
   invalid subscript type
  
   I get a different error: it may be that you have an object called `subs`
   in the global environment
  
I'm guessing that it's looking in the global environment for
subs,
  
   More precisely, it is looking in environment where `formula` was created,
   which happens to be the global environment.
  
   This is the sort of thing that happens with the fitting functions because
   they go to such lengths to break the basic scoping of R.
  
  
   You probably have to substitute() the evaluated subset into the glm call.
  
  fit.glm - eval(substitute(glm(formula=formula, data=mydata,
 family=binomial, subset=subset),list(subset=subs)))
  
  
 -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

 --
 Andrew Robinson  Ph: 208 885 7115
 Department of Forest Resources   Fa: 208 885 6226
 University of Idaho  E : [EMAIL PROTECTED]
 PO Box 441133W : http://www.uidaho.edu/~andrewr
 Moscow ID 83843  Or: http://www.biometrics.uidaho.edu
 No statement above necessarily represents my employer's opinion.


__
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] scree plot

2005-01-04 Thread Mulholland, Tom
I thought this would be simple enough and in some ways it is, but I don't have 
an answer I would call easy

The manual process would be to use barplot instead of screeplot, so that you 
could return the x values. The other choice would be to hack the screeplot 
function to return the values. (see the end)

Then you need to get the y values. If you follow the example in screeplot

## The variances of the variables in the
 ## USArrests data vary by orders of magnitude, so scaling is appropriate
 (pc.cr - princomp(USArrests, cor = TRUE))  # inappropriate
 screeplot(pc.cr)

 then you might use
   pc.cr$sdev^2 * 0.9 

My difficulty came when I looked at pc.cr$loadings. This uses the 
print.loadings method to calulate the cumulative values

a very quick kludge gives me

cumvar - function (x, digits = 3, cutoff = 0.1, sort = FALSE, ...) 
{
Lambda - unclass(x)
p - nrow(Lambda)
factors - ncol(Lambda)
if (sort) {
mx - max.col(abs(Lambda))
ind - cbind(1:p, mx)
mx[abs(Lambda[ind])  0.5] - factors + 1
Lambda - Lambda[order(mx, 1:p), ]
}
cat(\nLoadings:\n)
fx - format(round(Lambda, digits))
names(fx) - NULL
nc - nchar(fx[1])
fx[abs(Lambda)  cutoff] - paste(rep( , nc), collapse = )
vx - colSums(x^2)
varex - rbind(SS loadings = vx)
if (is.null(attr(x, covariance))) {
varex - rbind(varex, Proportion Var = vx/p)
if (factors  1) 
varex - rbind(varex, Cumulative Var = cumsum(vx/p))
}
invisible(return(cumsum(vx/p)))
}


screeplot - function (x, npcs = min(10, length(x$sdev)), type = c(barplot,
lines), main = deparse(substitute(x)), ...)
{
main
type - match.arg(type)
pcs - x$sdev^2
xp - seq(length = npcs)
if (type == barplot)
tt - barplot(pcs[xp], names = names(pcs[xp]), main = main,
ylab = Variances, ...)
else {
plot(xp, pcs[xp], type = b, axes = FALSE, main = main,
xlab = , ylab = Variances, ...)
axis(2)
axis(1, at = xp, labels = names(pcs[xp]))
}
invisible(return(tt))

}

here - screeplot(pc.cr)
text(here,pc.cr$sdev^2 + 0.1,paste(cumvar(pc.cr$loadings)*100,%,sep = 
),xpd=T)



 -Original Message-
 From: Anne [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, 5 January 2005 5:45 AM
 To: R list
 Subject: [R] scree plot
 
 
 Hi!
 
 Is there an easy way to add to the scree-plot labels to each 
 value pertaining to the cumulative proportion of explained variance?
 
 Thanks and a happy new year
 
 Anne
 
 Anne Piotet
 Tel: +41 79 359 83 32 (mobile)
 Email: [EMAIL PROTECTED]
 ---
 M-TD Modelling and Technology Development
 PSE-C
 CH-1015 Lausanne
 Switzerland
 Tel: +41 21 693 83 98
 Fax: +41 21 646 41 33
 --
  
   [[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


__
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] quantiles for geometric distribution

2005-01-04 Thread Gabor Grothendieck

dax42 Dax42 at web.de writes:

: 
: Dear list,
: 
: I have got an array with observational values t and I would like to fit 
: a geometric distribution to it.
: As I understand the geometric distribution, there is only one 
: parameter, the probability p. I estimated it by 1/mean(t).

p=1/EX if the geometric distribution starts at 1 but in R the
geometric distribution starts at 0. That is, in R the geometric 
distribution is the number of failures before a success, not the 
number of trials including the success.  

If X is a geometric random variable then EX = 0p + (EX+1)(1-p)
and solving for EX gives 1/p-1.

: 
: Now I plotted the estimated density function by
: plot(ecdf(t),do.points=FALSE,col.h=blue);
: 
: and I would like to add the geometric distribution. This should be 
: possibly with the function pgeom().
: 
: Unfortunately I do not understand what is meant by the argument q, 
: vector of quantiles representing the number of failures in a sequence 
: of Bernoulli trials before success occurs according to R help.
: 
: I am familiar with quantiles, but why do I need them here?
: Does anybody know what this means? What am I supposed to do?

The quantiles are just the values of the geometric random
variable.  That is if you have a data vector x in which the
ith element of x is the ith observation (where each
observation is the number of failures before a success, viz.
a non-negative integer) then dgeom(x, .2) would give a vector 
of density values assuming the probability of a success is .2 .

__
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] warnings and errors with R CMD INSTALL

2005-01-04 Thread Prof Brian Ripley
On Wed, 5 Jan 2005, thomas wrote:
Hello,
Am Dienstag, den 04.01.2005, 23:25 + schrieb Prof Brian Ripley:
On Tue, 4 Jan 2005, thomas wrote:

I followed RNews 3/3 and used:
1. R CMD INSTALL package_version.tar.gz
and
2.options(CRAN=http://umfragen.sowi.uni-mainz.de/CRAN/;)
install.packages(pkg1. pkg2)
Both approaches end up i.e.:
WARNING: invalid package 'pkg1.tar.gz'
ERROR: no packages specified
But there is no package `pkg1' on CRAN.  Try a real name like
install.packages(tree)
Well, of cause I didn't want install pkg1 or pkg2,
the precise commandline was:
1. R CMD INSTALL epitools_0.3-3.tar.gz
Have you downloaded the file first to the current directory?
and
2.  install.packages(accuracy, zoo, abind)
The syntax is install.packages(c(accuracy, zoo, abind))
[I did suggest an example you could have tried, deliberately with one 
package.  I don't get the error message you said you got from your line.]

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