Re: [R] atan2(1,1i)

2006-03-29 Thread Prof Brian Ripley
On Wed, 29 Mar 2006, Robin Hankin wrote:

> Hi guys
>
> perhaps my original message wasn't so clear.
>
> My point was that the documentation is inconsistent with the
> function.

I think it is _your reading_ of the documentation that is inconsistent.
An equally plausible reading is that both x and y must be numeric or 
complex.

> How to remedy this?
>
> (i) add a line to Trig.Rd along the lines of "atan2() will not work
> if the first argument
> is real and the second argument complex"
>
> or
> (ii) Modify atan2() so that it coerces the first argument to a
> complex if necessary.
>
>
> I'd prefer option (ii) but can't see a quick fix.

Really?  It's a one-line change.

BTW, this *really* is an R-devel topic, so please try to use the
appropriate list.  Suggestions for changes to R get lost in the torrent of 
R-help extremely easily.

And only the designers can say

'but atan2 wasn't originally designed for complex arguments.'

but the code suggests otherwise.

>
>
> rksh
>
>
>
>
> On 28 Mar 2006, at 19:52, Jeff Newmiller wrote:
>
>> Robin Hankin wrote:
>>> Hi
>>>
>>> ?atan2 says that atan2(y,x)=atan(y/x) for x and y numeric or complex
>>> vectors.
>>>
>>> Well, I would expect atan2(1,1i) to be equal to atan(-1i), but
>>>
 atan2(1,1i)
>>> Error in atan2(y, x) : Non-numeric argument to mathematical function
>>
>> Ravi Varadhan pointed out that you need to make both arguments complex
>> to address the error message you obtained... but atan2 wasn't
>> originally
>> designed for complex arguments. I suspect that what you really want is
>> to use the Arg function:
>>
>>> Arg(1/1i)
>> [1] -1.570796
>>
>> --
>
>
> --
> Robin Hankin
> Uncertainty Analyst
> National Oceanography Centre, Southampton
> European Way, Southampton SO14 3ZH, UK
>  tel  023-8059-7743
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

-- 
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] Spectra for continious time

2006-03-29 Thread Prof Brian Ripley
You cannot observe a time series in continuous time.  So either you have 
regularly spaced observations (and see ?spectrum), or irregular ones
(and there may be something in one of the packages for irregular time 
series, but there is no support in R itself).


On Tue, 28 Mar 2006, Martin Albers wrote:

> Is there any way to apply a spectra or periodogramm to my time series.
>
> My first problem is, that I do not know how to get a 
> spectra/periodogramm for my data.
>
> I have found time series tools but nothing for spectral analysis.
>
> My second problem: The time series function I have found, wanted a 
> discrete timeline, but my timeline is continious.

-- 
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] psychometrics in R

2006-03-29 Thread Jan de Leeuw
The hitcounters show a lot of interest. I have now updated

http://www.cuddyvalley.org/psychoR/

by putting index files in every (well, almost every) subdirectory.  
This makes
browsing the subdirectories much easier, and it also protects
some stuff that nobody needs to see anyway.

In addition, the probit package had a major update and is now
almost usable.

===
Jan de Leeuw; Distinguished Professor and Chair, UCLA Department of  
Statistics;
Editor: Journal of Multivariate Analysis, Journal of Statistical  
Software
US mail: 8125 Math Sciences Bldg, Box 951554, Los Angeles, CA 90095-1554
phone (310)-825-9550;  fax (310)-206-5658;  email: [EMAIL PROTECTED]
.mac: jdeleeuw ++  aim: deleeuwjan ++ skype: j_deleeuw
homepages: http://gifi.stat.ucla.edu ++ http://www.cuddyvalley.org
   
 
-
   No matter where you go, there you are. --- Buckaroo Banzai
http://gifi.stat.ucla.edu/sounds/nomatter.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


Re: [R] Skewed t distribution

2006-03-29 Thread Konrad Banachewicz
On 3/28/06, Prof Brian Ripley <[EMAIL PROTECTED]> wrote:
>
> You need to learn to supply adequate information.  The current
> version of sn *does* have such an argument, and I was careful to check.
> So it seems that you are using an unstated obselete version of sn.
> Do ugrade as the posting guide asked you to.


 Ok, point taken, I just forgot about it and had no way to do it
before computations started (I have to work on two machines,
and the one with R on it has no access to the internet).
My apologies for wasting Your & everyone else's time.

rg,
konrad

--
> "We are what we pretend to be, so we must be careful about what we pretend
> to be"
>
>   Kurt Vonnegut Jr. "Mother Night"

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


Re: [R] lme plot

2006-03-29 Thread Prof Brian Ripley
On Fri, 24 Mar 2006, Dieter Menne wrote:

> Leonardo D Bacigalupe  sheffield.ac.uk> writes:
>
>> I'm trying to plot e.g. fitted vs residuals for each level of the
>> random effects, and i'm getting the same error.
>> I guess this might be a problem of the graphic capabilities of R.
>>
>> Is there any way to obtain those plots?
>>
>> library(nlme)
>> attach(ergoStool)
>> names(ergoStool)
>> [1] "effort"  "Type""Subject"
>> m1<-lme(effort~Type,random=~1|Subject)
>> plot(m1,form=resid(.,type="p")~fitted(.)|Subject,abline=0)#resid and
>> fitted for each level of subject
>> Error in as.vector(x, "list") : cannot coerce to vector
>>
>
> I don't believe your idea is wrong, and I don't understand why this does not
> work, but a similar line on page 176 of Pinheiro/Bates does (there, the call 
> to
> getData returns non-null).  The lines I don't understand in plot.lme are
>
>alist <- lapply(as.list(allV), as.name)
>names(alist) <- allV
> # next line
>alist <- c(as.list(as.name("data.frame")), alist)
>mode(alist) <- "call"
>data <- eval(alist, sys.parent(1))
>
> This code turn up again and again in nlme, but I admit I don't understand what
> it means.
>
> Anybody taking the challenge to dissect it?

It's a bug.

The first two lines sets up a list, in this case, list(Subject=Subject).
The idea is then to call data.frame(Subject=Subject) in the parent 
environment, but whenever you see things like

 data <- eval(alist, sys.parent(1))

you might want to suspect code copied from S-PLUS.  And indeed,

as.list(as.name("data.frame"))

works in S-PLUS but not in R (although just list(as.name("data.frame")) 
works in both).

I think the best fix is to make as.list work on symbols, but replacing
as.list by list in plot.lme appears to fix this (that is, it works and the 
output appears plausible).


-- 
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] cat(), Rgui, and support for carriage return \r...

2006-03-29 Thread Philippe Grosjean
Prof Brian Ripley wrote:
> On Tue, 28 Mar 2006, Duncan Murdoch wrote:
> 
> 
>>On 3/28/2006 11:00 AM, Prof Brian Ripley wrote:
>>
>>>Rgui now supports \r in the same way as rterm.
>>
>>I notice that there's a slight change to the colour scheme:  now the prompt 
>>">" is in foreground colour, rather than user colour.  This might make sense 
>>(it's printed by the system, after all), but it looks a little strange at 
>>first.
> 
> 
> Yes, it was intentional.  The problem is that you can now do
> 
> 
>>cat("abcde\rf")
> 
> 
> and then the next line will be
> 
> f> de

Actually, there is an interest to do so with GUIs, like R Commander or 
SciViews-R (although R commander uses its own in/out window by default). 
The idea is to work with commands constructed by the GUI, and report the 
corresponding command to the console, but to flag them with a "special" 
prompt, telling it is different from what the user actually entered. 
Something like:
 > cat("\rGUI") # Tcl-triggered instruction
would give the following prompt:
GUI>
which is nice if there is a way to append a command in user color just 
after it, for instance:
 > cat("ls()\n") # Also triggered by Tcl code
giving:
GUI> ls()
with GUI> in foreground colour and ls() in user color.
Perhaps is it not possible, or even, not desirable to get this result 
for other situations.
Best,

philippe Grosjean

> with the cursor on the 'd'.  There is no longer a left-right divide 
> between system output and user input, as you can have output to the right 
> of user input.  The previous behaviour was to mark as system output all 
> the columns up to the 'e' here, so when you started entering new input it 
> looked very odd indeed, changing colour in mid-word.
> 
> I can change to making the prompt be explicitly regarded as user input, 
> which would be backwards compatible and less odd in cases like this.
> 
> 
>>Duncan Murdoch
>>
>>
>>
>>>On Sun, 19 Mar 2006, Duncan Murdoch wrote:
>>>
>>>
On 3/18/2006 2:39 PM, Duncan Murdoch wrote:

>On 3/17/2006 9:44 AM, Jeffrey Racine wrote:
>
>>Hi, and thanks in advance for your time.
>>
>>Background - I am working on a package and wish to have a routine's
>>progress reported. The routine can take some time, and I would like to
>>inform the user about the routine's progress. I have scoured the
>>archives but to no avail, so would like to solicit input from this list.
>>
>>I am successfully using
>>
>>cat("\rBootstrap replication ", i, " of ", boot.num,)
>>flush.console() # To flush stdout on windows systems
>>
>>which works as expected on *NIX systems and using Rterm under windows.
>>However, under Rgui the carriage return \r is ignored, and I certainly
>>don't want to use the newline escape sequence \n. Under Rgui it appears
>>as
>>
>>Bootstrap replication 1 of 399Bootstrap replication 2 of 399Bootstrap...
>>
>>but I want it to function properly if at all possible.
>>
>>My question is simply whether there is a portable way to implement this
>>so that it works regardless of the R platform the user may be working
>>on?
>>
>>Many thanks for any/all suggestions.
>
>I've just been looking at the source code for this.  I think it will be
>relatively easy to make \r in Rgui do a destructive CR (i.e. it will
>return to the start of the line, but clear any existing characters).
>I'll play around a bit and then do that for R-devel.

Oops, this was a bad idea.  I did commit the change for a while, but
have reverted it now.

It seems that the help system displays help pages by writing CR LF at
the end of each line; the CR is \r, and my change above caused it to
wipe out the line it had just written.  The help pages ended up
completely blank.

I may look into supporting \r as a non-destructive CR, but that's
harder, because it means low-level changes to the console display.
Right now it only writes to the end of the text buffer; this would mean
it would sometimes write to a spot before the end.  I don't think it
would be impossible to do, but it will take more time than I have right 
now.

Duncan Murdoch

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

>>>
>>
>

__
R-help@stat.math.ethz.ch 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] load file RData which store in zip file

2006-03-29 Thread Muhammad Subianto
Dear R users,
My situation:
(1) I have limited workspace for my work harddisk (about 10 GiB).
(2) I have a lot of data files in R workspace (*.RData) which most of
them > 200 MiB. For some reason I zip some of them, for instance
"filename.RData (250 MiB)" to "filename.zip (3MiB)". In this work I
have a lot of more space of my harddisk.

Normally, If I want to use "filename.RData" for my experiment, I can
do it with load("filename.RData").

Then I tried to open/load

> load("filename.zip")
Error: bad restore file magic number (file may be corrupted) -- no data loaded
>

My question:
How can I open/load "filename.zip"? Is there any function to open R
workspace which it store in zip file? I hope some one can give me
advices.


Best, Muhammad Subianto

> version
 _
platform i386-pc-mingw32
arch i386
os   mingw32
system   i386, mingw32
status
major2
minor2.1
year 2005
month12
day  20
svn rev  36812
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] missing value replacement for test data in random forest

2006-03-29 Thread Zhu Ailing
HI, 
  I have data set of 3 record with 162 features. when I try to fill out the 
missing values using rfImpute(), I got kicked out becz:  
tra.imputed <- rfImpute(tra.na[,-163],tra.na[,163],iter=5,ntree=10)
Error in matrix(0, n, n) : cannot allocate vector of length 9
 
I wonder how to set the parameters(nrnn) for computing the PROXIMITY.
thanks
iris

-Original Message- 
From: Zhu Ailing 
Sent: Wed 3/29/2006 11:41 AM 
To: '[EMAIL PROTECTED]' 
Cc: 
Subject: missing value replacement for test data in random forest


Hi,
 
In R, how to do missing value replacement for test data in randome 
forest in the way Breiman decribed.
 
thanks in advance
 
iris

__
R-help@stat.math.ethz.ch 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] lme plot

2006-03-29 Thread Peter Dalgaard
Prof Brian Ripley <[EMAIL PROTECTED]> writes:

> On Fri, 24 Mar 2006, Dieter Menne wrote:
> 
> > Leonardo D Bacigalupe  sheffield.ac.uk> writes:
> >
> >> I'm trying to plot e.g. fitted vs residuals for each level of the
> >> random effects, and i'm getting the same error.
> >> I guess this might be a problem of the graphic capabilities of R.
> >>
> >> Is there any way to obtain those plots?
> >>
> >> library(nlme)
> >> attach(ergoStool)
> >> names(ergoStool)
> >> [1] "effort"  "Type""Subject"
> >> m1<-lme(effort~Type,random=~1|Subject)
> >> plot(m1,form=resid(.,type="p")~fitted(.)|Subject,abline=0)#resid and
> >> fitted for each level of subject
> >> Error in as.vector(x, "list") : cannot coerce to vector
> >>
> >
> > I don't believe your idea is wrong, and I don't understand why this does not
> > work, but a similar line on page 176 of Pinheiro/Bates does (there, the 
> > call to
> > getData returns non-null).  The lines I don't understand in plot.lme are
> >
> >alist <- lapply(as.list(allV), as.name)
> >names(alist) <- allV
> > # next line
> >alist <- c(as.list(as.name("data.frame")), alist)
> >mode(alist) <- "call"
> >data <- eval(alist, sys.parent(1))
> >
> > This code turn up again and again in nlme, but I admit I don't understand 
> > what
> > it means.
> >
> > Anybody taking the challenge to dissect it?
> 
> It's a bug.

Drats, I never even realised that the problem was that it didn't
work... 
 
> The first two lines sets up a list, in this case, list(Subject=Subject).
> The idea is then to call data.frame(Subject=Subject) in the parent 
> environment, but whenever you see things like
> 
>  data <- eval(alist, sys.parent(1))
> 
> you might want to suspect code copied from S-PLUS.  And indeed,
> 
> as.list(as.name("data.frame"))
> 
> works in S-PLUS but not in R (although just list(as.name("data.frame")) 
> works in both).

Actually, even this works in R:

x <- c("bar","baz")
l <- lapply(x,as.name)
names(l) <- x
as.call(c(quote(data.frame), l))

and in Splus 6.2.1 too, substituting Quote() for quote(). (And Quote()
does actually exist in R too as a compatibility alias for quote())

> I think the best fix is to make as.list work on symbols, 

Maybe. It does look to me like bad coding, though: if ever the
argument happens not to be a symbol - an unnamed function, say - there
will be differences between what as.list() and list() does and the
latter is more likely to be as intended. It obviously cannot happen
here, but there are applications where you "rip the head off" a
function call and reuse it to build a new one.

> but replacing
> as.list by list in plot.lme appears to fix this (that is, it works and the 
> output appears plausible).



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


Re: [R] load file RData which store in zip file

2006-03-29 Thread Henrik Bengtsson
Hi. R can do all of this for you. See ?save.image and especially the
'compress' argument.

/Henrik

On 3/29/06, Muhammad Subianto <[EMAIL PROTECTED]> wrote:
> Dear R users,
> My situation:
> (1) I have limited workspace for my work harddisk (about 10 GiB).
> (2) I have a lot of data files in R workspace (*.RData) which most of
> them > 200 MiB. For some reason I zip some of them, for instance
> "filename.RData (250 MiB)" to "filename.zip (3MiB)". In this work I
> have a lot of more space of my harddisk.
>
> Normally, If I want to use "filename.RData" for my experiment, I can
> do it with load("filename.RData").
>
> Then I tried to open/load
>
> > load("filename.zip")
> Error: bad restore file magic number (file may be corrupted) -- no data loaded
> >
>
> My question:
> How can I open/load "filename.zip"? Is there any function to open R
> workspace which it store in zip file? I hope some one can give me
> advices.
>
>
> Best, Muhammad Subianto
>
> > version
>  _
> platform i386-pc-mingw32
> arch i386
> os   mingw32
> system   i386, mingw32
> status
> major2
> minor2.1
> year 2005
> month12
> day  20
> svn rev  36812
> 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
>
>


--
Henrik Bengtsson
Mobile: +46 708 909208 (+2h UTC)

__
R-help@stat.math.ethz.ch 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] load file RData which store in zip file

2006-03-29 Thread Philipp Pagel
On Wed, Mar 29, 2006 at 11:44:03AM +0200, Muhammad Subianto wrote:
> How can I open/load "filename.zip"? Is there any function to open R
> workspace which it store in zip file?

I think you have two options:

1) use zip.file.extract() to unzip the file before loading

2) save your data with save.image(file="foo.RData", compress = True)

cu
Philipp

-- 
Dr. Philipp PagelTel.  +49-8161-71 2131
Dept. of Genome Oriented Bioinformatics  Fax.  +49-8161-71 2186
Technical University of Munich
Science Center Weihenstephan
85350 Freising, Germany

 and

Institute for Bioinformatics / MIPS  Tel.  +49-89-3187 3675
GSF - National Research Center   Fax.  +49-89-3187 3585
  for Environment and Health
Ingolstädter Landstrasse 1
85764 Neuherberg, Germany
http://mips.gsf.de/staff/pagel

__
R-help@stat.math.ethz.ch 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] load file RData which store in zip file

2006-03-29 Thread Roger Bivand
On Wed, 29 Mar 2006, Muhammad Subianto wrote:

> Dear R users,
> My situation:
> (1) I have limited workspace for my work harddisk (about 10 GiB).
> (2) I have a lot of data files in R workspace (*.RData) which most of
> them > 200 MiB. For some reason I zip some of them, for instance
> "filename.RData (250 MiB)" to "filename.zip (3MiB)". In this work I
> have a lot of more space of my harddisk.
> 
> Normally, If I want to use "filename.RData" for my experiment, I can
> do it with load("filename.RData").

Please try to use the compress=TRUE argument to save(). If you save()ed 
uncompressed, you have to load uncompressed, unzip first. There are 
unzipping functions in R too, see ?zip.file.extract.

> 
> Then I tried to open/load
> 
> > load("filename.zip")
> Error: bad restore file magic number (file may be corrupted) -- no data loaded
> >
> 
> My question:
> How can I open/load "filename.zip"? Is there any function to open R
> workspace which it store in zip file? I hope some one can give me
> advices.
> 
> 
> Best, Muhammad Subianto
> 
> > version
>  _
> platform i386-pc-mingw32
> arch i386
> os   mingw32
> system   i386, mingw32
> status
> major2
> minor2.1
> year 2005
> month12
> day  20
> svn rev  36812
> 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
> 

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
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] load file RData which store in zip file

2006-03-29 Thread Muhammad Subianto
I apologize for my lack of  knowledge.
Thank you very much for the suggestions.
These are exactly what I was looking for.

> ?zip.file.extract
Help for 'zip.file.extract' is shown in the browser

Maybe I must re-run and re-save again to compress my R workspace.

> ?save.image
Help for 'save.image' is shown in the browser

Regards, Muhammad Subianto


On 3/29/06, Philipp Pagel <[EMAIL PROTECTED]> wrote:
> On Wed, Mar 29, 2006 at 11:44:03AM +0200, Muhammad Subianto wrote:
> > How can I open/load "filename.zip"? Is there any function to open R
> > workspace which it store in zip file?
>
> I think you have two options:
>
> 1) use zip.file.extract() to unzip the file before loading
>
> 2) save your data with save.image(file="foo.RData", compress = True)
>
> cu
> Philipp
>
> --
> Dr. Philipp PagelTel.  +49-8161-71 2131
> Dept. of Genome Oriented Bioinformatics  Fax.  +49-8161-71 2186
> Technical University of Munich
> Science Center Weihenstephan
> 85350 Freising, Germany
>
>  and
>
> Institute for Bioinformatics / MIPS  Tel.  +49-89-3187 3675
> GSF - National Research Center   Fax.  +49-89-3187 3585
>   for Environment and Health
> Ingolstädter Landstrasse 1
> 85764 Neuherberg, Germany
> http://mips.gsf.de/staff/pagel
>

__
R-help@stat.math.ethz.ch 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] load file RData which store in zip file

2006-03-29 Thread Prof Brian Ripley
On Wed, 29 Mar 2006, Henrik Bengtsson wrote:

> Hi. R can do all of this for you. See ?save.image and especially the
> 'compress' argument.

It is nice to know that we anticipated your needs.  It is actually even 
easier.  If you do (using the Rtools or other sources, or on a Unix-alike)

gzip filename.RData
mv filename.RData.gz filename.RData

R will read the compressed file directly (you don't need to rename it, but 
it helps keep things tidy).

[As an aside, I wonder whether compress=TRUE should not be the default for 
binary save/save.image.  It adds little time and may save a lot of disc 
space.]


> /Henrik
>
> On 3/29/06, Muhammad Subianto <[EMAIL PROTECTED]> wrote:
>> Dear R users,
>> My situation:
>> (1) I have limited workspace for my work harddisk (about 10 GiB).
>> (2) I have a lot of data files in R workspace (*.RData) which most of
>> them > 200 MiB. For some reason I zip some of them, for instance
>> "filename.RData (250 MiB)" to "filename.zip (3MiB)". In this work I
>> have a lot of more space of my harddisk.
>>
>> Normally, If I want to use "filename.RData" for my experiment, I can
>> do it with load("filename.RData").
>>
>> Then I tried to open/load
>>
>>> load("filename.zip")
>> Error: bad restore file magic number (file may be corrupted) -- no data 
>> loaded
>>>
>>
>> My question:
>> How can I open/load "filename.zip"? Is there any function to open R
>> workspace which it store in zip file? I hope some one can give me
>> advices.

-- 
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] In "step" command, how can I use "scope" parameter

2006-03-29 Thread Savio Ramos
Hi,

My code is:

andeti1 <- read.csv(file='andarai1.csv',head=T,sep=";")

andeti1lm <- lm(formula = valor ~ area+salao+quarto3+play+vaga+frente, data = 
andeti1) 

step(andeti1lm,direction=c("both"),steps=1000,k=2)


How can I specify "scope" parameter in "step" command?

Thanks.
-- 
Sávio Martins Ramos -  Arquiteto
Rio de Janeiro  ICQ 174972645
Pirataria não! Seja livre: Linux
http://www.debian.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


Re: [R] which function to use to do classification

2006-03-29 Thread Sean Davis
We have to be careful here.  Classification (which is the terminology that
the original poster used) is NOT the same as clustering, although the two
are often confused.  If the original poster wants to do clustering and
examine the results for the presence of three clusters, that is fine and
there are many methods for clustering that could be used.  However,
classification will require a different set of tools.  If the clustering
tools already pointed out are not doing what is needed (that is, that Cao
actually is interested in clustering and not classification), then perhaps a
further explanation of what the problem would help clarify.

Sean


On 3/29/06 1:46 AM, "Jacques VESLOT" <[EMAIL PROTECTED]> wrote:

> try this (suppose mat is your matrix):
> 
> hc <- hclust(dist(mat,"manhattan"), "ward")
> plot(hc, hang=-1)
> (x <- identify(hc)) # rightclick to stop
> cutree(hc, 3)
> 
> km<- kmeans(mat, 3)
> km$cluster
> km$centers
> 
> pam(daisy(mat, metric = "manhattan"), k=3, diss=T)$clust
> 
> 
> 
> Baoqiang Cao a écrit :
> 
>> Thanks!
>> I tried kmeans, the results is not very positive. Anyway, thanks Jacques!
>> Please let me know if you have any other thoughts!
>> 
>> Best regards, 
>>Baoqiang Cao
>> 
>> === At 2006-03-29, 00:08:44 you wrote: ===
>> 
>>  
>> 
>>> if you want to classify rows or columns, read:
>>> ?hclust
>>> ?kmeans
>>> library(cluster)
>>> ?pam
>>> 
>>> 
>>> Baoqiang Cao a écrit :
>>> 
>>>
>>> 
 Dear All,
 
 I have a data, suppose it is an N*M matrix data. All I want is to classify
 it into, let see, 3 classes. Which method(s) do you think is(are)
 appropriate for this purpose? Any reference will be welcome! Thanks!
 
 Best, 
 Baoqiang Cao
 
 
 
 
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide!
 http://www.R-project.org/posting-guide.html
 
  
 
>>> .
>>>
>>> 
>> 
>> = = = = = = = = = = = = = = = = = = = =
>> 
>> Baoqiang Cao
>> [EMAIL PROTECTED]
>> 2006-03-29
>> 
>> 
>>  
>> 
> 
> __
> R-help@stat.math.ethz.ch 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] S3 object

2006-03-29 Thread Uwe Ligges
stat stat wrote:

> hi all,
>
>   Somewhere I got a phrase - the function returns a S3 object of class 
> "hclust" - can anyone tell me what is "S3 objects"?

Simply an object with a "class" attribute.

See chapter "Object-oriented programming" in the R Language Definition 
manual.

Uwe Ligges



> 
> thanks in advance
>   
> -
> 
> 
>   [[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


[R] Plotting shapefiles on existing maps

2006-03-29 Thread nhy303
Dear All,

This is probably a very basic question but:

I have plotted a map of the Barents Sea and surrounding coastline using:

map('worldHires',ylim=c(50,85),xlim=c(5,65),fill=T,resolution=0)
map.axes()
map.scale(x=30,metric=T)

Next, I imported a shapefile with depth contours for the sea:

contours<-read.shape("D://My Documents/BarentsSea.shp",dbf.data=T)

(This is in mercator projection).

Despite extensive searches of the help files and R site, I cannot find a
way to plot the contours onto the map.  Does anyone have any suggestions?

Thankyou for you help,

Lillian.


-- 
Lillian Sandeman
PhD Student
School of Biological Sciences
University of Aberdeen
AB24 2TZ

Tel.: 01224 272648
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] which function to use to do classification

2006-03-29 Thread Prof Brian Ripley

On Wed, 29 Mar 2006, Sean Davis wrote:


We have to be careful here.  Classification (which is the terminology that
the original poster used) is NOT the same as clustering, although the two
are often confused.


Well, in one of its two English senses it is the same.  From a recent talk 
of mine (GfKL30), quoting the Concise Oxford Dictionary:


\emph{Classification} has two senses:

\begin{itemize}
\item `to arrange in classes or categories'
\item `assign (a thing) to a class or category'
\end{itemize}

There is a community (q.v. the International Federation of Classification 
Societies and Journal of Classification as well as the entry in the 
original Encyclopedia of Statistical Sciences) that meams (almost) 
entirely the first sense.


To add to this, the similar words to classification in e.g. French or 
German have (I am told) different shades of meaning.




If the original poster wants to do clustering and
examine the results for the presence of three clusters, that is fine and
there are many methods for clustering that could be used.  However,
classification will require a different set of tools.  If the clustering
tools already pointed out are not doing what is needed (that is, that Cao
actually is interested in clustering and not classification), then perhaps a
further explanation of what the problem would help clarify.


Yes, further explanation would help.


Sean


On 3/29/06 1:46 AM, "Jacques VESLOT" <[EMAIL PROTECTED]> wrote:


try this (suppose mat is your matrix):

hc <- hclust(dist(mat,"manhattan"), "ward")
plot(hc, hang=-1)
(x <- identify(hc)) # rightclick to stop
cutree(hc, 3)

km<- kmeans(mat, 3)
km$cluster
km$centers

pam(daisy(mat, metric = "manhattan"), k=3, diss=T)$clust



Baoqiang Cao a écrit :


Thanks!
I tried kmeans, the results is not very positive. Anyway, thanks Jacques!
Please let me know if you have any other thoughts!

Best regards,
   Baoqiang Cao

=== At 2006-03-29, 00:08:44 you wrote: ===




if you want to classify rows or columns, read:
?hclust
?kmeans
library(cluster)
?pam


Baoqiang Cao a écrit :




Dear All,

I have a data, suppose it is an N*M matrix data. All I want is to classify
it into, let see, 3 classes. Which method(s) do you think is(are)
appropriate for this purpose? Any reference will be welcome! Thanks!

Best,
Baoqiang Cao





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




.




= = = = = = = = = = = = = = = = = = = =

Baoqiang Cao
[EMAIL PROTECTED]
2006-03-29






__
R-help@stat.math.ethz.ch 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



--
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] Monmonier algorithm

2006-03-29 Thread Thibaut Jombart
Hello list,

does anyone know if Monmonier algorithm is available in R? I've checked 
several spatial libraries, but I didn't find anything related to it. 
However, there is a huge documentation and I may have missed it.

Before coding it, I'd like to be sure it doesn't already exist.

Cheers,

Thibaut Jombart.

-- 
##
Thibaut JOMBART
CNRS UMR 5558 - Laboratoire de Biométrie et Biologie Evolutive
Universite Lyon 1
43 bd du 11 novembre 1918
69622 Villeurbanne Cedex
Tél. : 04.72.43.29.35
Fax : 04.72.43.13.88
[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] cat(), Rgui, and support for carriage return \r...

2006-03-29 Thread Duncan Murdoch
On 3/29/2006 2:49 AM, Prof Brian Ripley wrote:
> On Tue, 28 Mar 2006, Duncan Murdoch wrote:
> 
>> On 3/28/2006 11:00 AM, Prof Brian Ripley wrote:
>>> Rgui now supports \r in the same way as rterm.
>> I notice that there's a slight change to the colour scheme:  now the prompt 
>> ">" is in foreground colour, rather than user colour.  This might make sense 
>> (it's printed by the system, after all), but it looks a little strange at 
>> first.
> 
> Yes, it was intentional.  The problem is that you can now do
> 
>> cat("abcde\rf")
> 
> and then the next line will be
> 
> f> de
> 
> with the cursor on the 'd'.  There is no longer a left-right divide 
> between system output and user input, as you can have output to the right 
> of user input.  The previous behaviour was to mark as system output all 
> the columns up to the 'e' here, so when you started entering new input it 
> looked very odd indeed, changing colour in mid-word.
> 
> I can change to making the prompt be explicitly regarded as user input, 
> which would be backwards compatible and less odd in cases like this.

I'd lean towards backwards compatibility here, but don't have a strong 
preference.  It's less than perfect that the de is shown as user input, 
but fixing that would require a pretty large change to the console code.

Duncan Murdoch
> 
>> Duncan Murdoch
>>
>>
>>> On Sun, 19 Mar 2006, Duncan Murdoch wrote:
>>>
 On 3/18/2006 2:39 PM, Duncan Murdoch wrote:
> On 3/17/2006 9:44 AM, Jeffrey Racine wrote:
>> Hi, and thanks in advance for your time.
>>
>> Background - I am working on a package and wish to have a routine's
>> progress reported. The routine can take some time, and I would like to
>> inform the user about the routine's progress. I have scoured the
>> archives but to no avail, so would like to solicit input from this list.
>>
>> I am successfully using
>>
>> cat("\rBootstrap replication ", i, " of ", boot.num,)
>> flush.console() # To flush stdout on windows systems
>>
>> which works as expected on *NIX systems and using Rterm under windows.
>> However, under Rgui the carriage return \r is ignored, and I certainly
>> don't want to use the newline escape sequence \n. Under Rgui it appears
>> as
>>
>> Bootstrap replication 1 of 399Bootstrap replication 2 of 399Bootstrap...
>>
>> but I want it to function properly if at all possible.
>>
>> My question is simply whether there is a portable way to implement this
>> so that it works regardless of the R platform the user may be working
>> on?
>>
>> Many thanks for any/all suggestions.
> I've just been looking at the source code for this.  I think it will be
> relatively easy to make \r in Rgui do a destructive CR (i.e. it will
> return to the start of the line, but clear any existing characters).
> I'll play around a bit and then do that for R-devel.
 Oops, this was a bad idea.  I did commit the change for a while, but
 have reverted it now.

 It seems that the help system displays help pages by writing CR LF at
 the end of each line; the CR is \r, and my change above caused it to
 wipe out the line it had just written.  The help pages ended up
 completely blank.

 I may look into supporting \r as a non-destructive CR, but that's
 harder, because it means low-level changes to the console display.
 Right now it only writes to the end of the text buffer; this would mean
 it would sometimes write to a spot before the end.  I don't think it
 would be impossible to do, but it will take more time than I have right 
 now.

 Duncan Murdoch

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

>>
>

__
R-help@stat.math.ethz.ch 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

2006-03-29 Thread Sven Schaltenbrand
dear list,
 
i have a problem using the adaboost function from the package boost.
running the example of leukemia works out very well, but so it does not on
my own data.
 
i always get the following 22 warnings:
 
1: cannot compute exact p-value with ties in: wilcox.test.default(x[which(y
== 0)], x[which(y == 1)])
 
can anybody please help me with the meaning of this warning.
 
thnak you
 
stefan

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


Re: [R] warnings

2006-03-29 Thread Gabor Grothendieck
Try this:

options(warn = 2)

Now rerun it and it will fail with an error at the point of the warning
and you can issue a:

traceback()

to find the exact point at which it failed so you can investigate further.

On 3/29/06, Sven Schaltenbrand <[EMAIL PROTECTED]> wrote:
> dear list,
>
> i have a problem using the adaboost function from the package boost.
> running the example of leukemia works out very well, but so it does not on
> my own data.
>
> i always get the following 22 warnings:
>
> 1: cannot compute exact p-value with ties in: wilcox.test.default(x[which(y
> == 0)], x[which(y == 1)])
>
> can anybody please help me with the meaning of this warning.
>
> thnak you
>
> stefan
>
>[[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] warnings

2006-03-29 Thread Uwe Ligges
Sven Schaltenbrand wrote:

> dear list,
>  
> i have a problem using the adaboost function from the package boost.
> running the example of leukemia works out very well, but so it does not on
> my own data.
>  
> i always get the following 22 warnings:
>  
> 1: cannot compute exact p-value with ties in: wilcox.test.default(x[which(y
> == 0)], x[which(y == 1)])
>  
> can anybody please help me with the meaning of this warning.


As far as I understand, adaboost() uses the Wilcoxon test statistic as 
some measure to do variable preselection.

Since you can adjust how many "features" should be selected, it seems to 
be less important to obtain *exact* p-values and you can ignore the 
warning. Nevertheless it makes sense to look into your data where the 
ties come from ...

Uwe Ligges




> thnak you
>  
> stefan
> 
>   [[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] Monmonier algorithm

2006-03-29 Thread Roger Bivand
On Wed, 29 Mar 2006, Thibaut Jombart wrote:

> Hello list,
> 
> does anyone know if Monmonier algorithm is available in R? I've checked 
> several spatial libraries, but I didn't find anything related to it. 
> However, there is a huge documentation and I may have missed it.
> 
> Before coding it, I'd like to be sure it doesn't already exist.

Googling, I found:

http://www-med-physik.vu-wien.ac.at/staff/rub/abstracts/ISCB_2005.pdf

which is a poster, and refers to using R for boundary finding, and other
software for data management and display. Perhaps the authors are able to
help by making code available, the poster looks like a nice example of
spatial data analysis.

> 
> Cheers,
> 
> Thibaut Jombart.
> 
> 

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
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] ANOVA & BOOTSTRAP

2006-03-29 Thread Romain . Mayor

Hello,

I'm working on 30 natural populations of Aster amellus L. a threatened
plant species. My aim is to see if the population size influence on several
fitness trait. I build a multi-factorial ANOVA. The independents variables
are altitude, humidity, soil component, maintenance  and population
density. Unfortunately my data have some heteroscedasticity even after
classical transformation. I'm looking for using resampling method or
bootstrap to test my multi-factorial Anova. I look on the different
packages but I'm not sure to understand the right procedure.
Could somebody help me, in giving me an example for testing multi-factorial
ANOVA with resampling or bootsrap procedure.

Thank you very much.

Romain Mayor
Assistant Doctorant Université Genève
Conservatoire et Jardin botaniques de la Ville de Genève
1 Ch de l'Impératrice
CP 60
1292 Chambésy, Geneva, Switzerland
tél office : 004122/4185125
tél reception : 004122/4185100
email : [EMAIL PROTECTED]

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


Re: [R] [R-pkgs] hybridHclust (new package)

2006-03-29 Thread Martin Maechler
> "Hugh" == Hugh Chipman <[EMAIL PROTECTED]>
> on Tue, 28 Mar 2006 12:17:44 -0400 writes:

Hugh> I'd like to announce the availability of a new library for hybrid
Hugh> hierarchical clustering, "hybridHclust".  The library has been 
uploaded
Hugh> to CRAN and is now available.

Hugh> The library implements a hybrid of top-down and bottom-up hierarchical
Hugh> clustering.  

(3 times... .gh... ) and why do you think the mailing list is called
R- *packages* ???
Please do 
   for(i in 1:20)
  cat("It's a package!\n")

Martin

__
R-help@stat.math.ethz.ch 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] bug in pictex() (package:grDevices)

2006-03-29 Thread Sam Steingold
running
 pictex()
 plot(1:11,(-5:5)^2, type='b', main="Simple_Example_Plot")
 dev.off()
(as in the pictex example, but with underscores instead of spaces).
the TeX file contains

\put {Simple_Example_Plot}  [lB] <0.00pt,0.00pt> at 124.00 275.33

the underscores have a special meaning in TeX, so they should be quoted
or converted to dashes.

-- 
Sam Steingold (http://www.podval.org/~sds) on Fedora Core release 4 (Stentz)
http://www.iris.org.il http://www.openvotingconsortium.org
http://pmw.org.il http://www.palestinefacts.org http://www.memri.org
Just because you're paranoid doesn't mean they AREN'T after 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


Re: [R] non parametric MANOVA

2006-03-29 Thread Brian S Cade
Jose:  You might want to check out the multiresponse permutation procedure 
(MRPP) family of statistics as they can perform permutation tests of 
common distributions among groups of multivariate response data or perform 
tests of equality of multivariate means among groups (i.e., a permutation 
version of MANOVA).  Note the former hypothesis test is more general than 
a test of multivariate means as it detects multiple forms of difference in 
distributions (shifts in medians, dispersion, both).  I don't know whether 
any of this has been programmed in R.  You can obtain a simple user 
friendly implementation in the USGS Blossom software 
(www.fort.usgs.gov/products/software/blossom/blossom.asp) or obtain the 
raw Fortran programs from Paul Mielke's web site at Colorado State 
University Statistics Department.

Brian

Brian S. Cade

U. S. Geological Survey
Fort Collins Science Center
2150 Centre Ave., Bldg. C
Fort Collins, CO  80526-8818

email:  [EMAIL PROTECTED]
tel:  970 226-9326



"Jose David Gomez" <[EMAIL PROTECTED]> 
Sent by: [EMAIL PROTECTED]
03/28/2006 07:20 AM

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

Subject
[R] non parametric MANOVA






Dear colleagues,

has anyone an idea how to carry out a nonparametric manova for comparing K
groups?

has anyone a good package of non-parametric stats?


Thank you for your help.



--
José David Gómez
Químico Farmacéutico
Universidad Nacional

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

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

Re: [R] load file RData which store in zip file

2006-03-29 Thread Seth Falcon
Prof Brian Ripley <[EMAIL PROTECTED]> writes:
> [As an aside, I wonder whether compress=TRUE should not be the default for 
> binary save/save.image.  It adds little time and may save a lot of disc 
> space.]

Here's one user who thinks that is a great idea.  I often have to
remind developers who contribute packages to Bioconductor to use the
compress=TRUE option to save().  I think it is a sensible default.

+ seth

__
R-help@stat.math.ethz.ch 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] QIC from gee() or geese()

2006-03-29 Thread Richard Chandler
Hello,

Is it possible to derive Pan's QIC (2001 Biometrics 57:120) from
either a fitted gee() object in the gee package or from a geese() fit
in the geepack package? If so, would anyone be kind enough to provide
me with code to do so? I realize that QIC is part of the output from
yags() but I would like to use one of the other functions. Thanks.

Richard

__
R-help@stat.math.ethz.ch 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] which function to use to do classification

2006-03-29 Thread Baoqiang Cao

>On Wed, 29 Mar 2006, Sean Davis wrote:
>
>> We have to be careful here.  Classification (which is the terminology that
>> the original poster used) is NOT the same as clustering, although the two
>> are often confused.
>
>Well, in one of its two English senses it is the same.  From a recent talk 
>of mine (GfKL30), quoting the Concise Oxford Dictionary:
>
>\emph{Classification} has two senses:
>
>\begin{itemize}
>\item `to arrange in classes or categories'
>\item `assign (a thing) to a class or category'
>\end{itemize}
>
>There is a community (q.v. the International Federation of Classification 
>Societies and Journal of Classification as well as the entry in the 
>original Encyclopedia of Statistical Sciences) that meams (almost) 
>entirely the first sense.
>
>To add to this, the similar words to classification in e.g. French or 
>German have (I am told) different shades of meaning.
>
>
>> If the original poster wants to do clustering and
>> examine the results for the presence of three clusters, that is fine and
>> there are many methods for clustering that could be used.  However,
>> classification will require a different set of tools.  If the clustering
>> tools already pointed out are not doing what is needed (that is, that Cao
>> actually is interested in clustering and not classification), then perhaps a
>> further explanation of what the problem would help clarify.
>
>Yes, further explanation would help.
My intension is to arrange all the samples in classes. As a non-native English 
speaker, I should have checked the word before I actually use it to express 
myself. The quoting makes perfect sense to me. Appreciate!

Thank you Jacques and Martin, your comments and suggestion are well received!

Best,
 Baoqiang Cao

>
>> Sean
>>
>>
>> On 3/29/06 1:46 AM, "Jacques VESLOT" <[EMAIL PROTECTED]> wrote:
>>
>>> try this (suppose mat is your matrix):
>>>
>>> hc <- hclust(dist(mat,"manhattan"), "ward")
>>> plot(hc, hang=-1)
>>> (x <- identify(hc)) # rightclick to stop
>>> cutree(hc, 3)
>>>
>>> km<- kmeans(mat, 3)
>>> km$cluster
>>> km$centers
>>>
>>> pam(daisy(mat, metric = "manhattan"), k=3, diss=T)$clust
>>>
>>>
>>>
>>> Baoqiang Cao a �crit :
>>>
 Thanks!
 I tried kmeans, the results is not very positive. Anyway, thanks Jacques!
 Please let me know if you have any other thoughts!

 Best regards,
Baoqiang Cao

 === At 2006-03-29, 00:08:44 you wrote: ===



> if you want to classify rows or columns, read:
> ?hclust
> ?kmeans
> library(cluster)
> ?pam
>
>
> Baoqiang Cao a �crit :
>
>
>
>> Dear All,
>>
>> I have a data, suppose it is an N*M matrix data. All I want is to 
>> classify
>> it into, let see, 3 classes. Which method(s) do you think is(are)
>> appropriate for this purpose? Any reference will be welcome! Thanks!
>>
>> Best,
>> Baoqiang Cao
>>
>>
>>
>> 
>>
>> __
>> R-help@stat.math.ethz.ch mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide!
>> http://www.R-project.org/posting-guide.html
>>
>>
>>
> .
>
>

 = = = = = = = = = = = = = = = = = = = =

 Baoqiang Cao
 [EMAIL PROTECTED]
 2006-03-29




>>>
>>> __
>>> R-help@stat.math.ethz.ch 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
>>
>
>-- 
>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

= = = = = = = = = = = = = = = = = = = =

Baoqiang Cao
[EMAIL PROTECTED]
2006-03-29

__
R-help@stat.math.ethz.ch 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 crashes during 'eigen'

2006-03-29 Thread Simon Wood
> It looks like there might be a bug in the symmetry detection routine of
> eigen.   When I do
>
> eigen(M, symmetric=FALSE)
>
> it works fine.
- but the matrix is symmetric, which seems to be correctly detected
(since eigen() hangs whether symmetric=TRUE is supplied or not).

> Eigenvalues (after omitting their imaginary parts, which
> are essentially zeros) are the same as the ones obtained with EISPACK to
> within a small multiple of machine epsilon.
>
> However, the eigenvector matrices seem different !  This happens on
> R-2.2.1-patched and R-2.3.0 (both compiled from daily snapshots).
- This is OK isn't it? All the non-zero eigenvalues are the same for this
matrix, so the eigenvectors can't be uniquely defined, can they?

best,
Simon

>- Simon Wood, Mathematical Sciences, University of Bath, Bath BA2 7AY
>- +44 (0)1225 386603 www.maths.bath.ac.uk/~sw283/

>
> Andy
>
> PS.  My system is Windows 2000 on a Xeon CPU.  I use precompiled Pentium 4
> Rblas DLL from CRAN, but the same thing happens with standard Rblas.
>
> __
> Andy Jaworski
> 518-1-01
> Process Laboratory
> 3M Corporate Research Laboratory
> -
> E-mail: [EMAIL PROTECTED]
> Tel:  (651) 733-6092
> Fax:  (651) 736-3122
>
>
>
>  "C.J.Albers"
>  <[EMAIL PROTECTED]
>  ac.uk> To
>  Sent by:  
>  [EMAIL PROTECTED]  cc
>  at.math.ethz.ch
>Subject
>[R] R crashes during 'eigen'
>  03/28/2006 10:01
>  AM
>
>
>
>
>
>
>
>
> Hi all,
>
> Hi,
>
> When I want to compute the eigenvalues & eigenvectors of a specific
> matrix, R crashes (i.e. it stops responding to any input). I've tried it
> with different versions of R (2.1.1, 2.2.0, 2.2.1) - all with crashing
> as result.
>
> What I did before the crash was:
>
> M <- as.matrix(read.table("thematrix",header=T))
> eigen(M)
>
> If, instead of eigen(M), I use eigen(M, EISPACK=T), R doesn't crash. So,
> I know a workaround my problem, but still don't understand why R
> crashes. Could anyone explain this?
> In case someone wants to download my matrix to see where it goes wrong,
> it can be downloaded from http://mcs.open.ac.uk/cja235/thematrix
> (warning: obviously, R might crash so save your unsaved work first).
>
> thanks,
> Casper Albers
>
>
>  [[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
>

__
R-help@stat.math.ethz.ch 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] aggregate function....

2006-03-29 Thread Stephane CRUVEILLER
Dear R users,

I have some trouble with the aggregate function. Here are my data

> daf
  S_id AF_Class count... R_gc_percent S_length
5  82644971   30 0.4835678
6  826449737 0.4835678
8  82645541   31 0.5138894
9  82645542   11 0.5138894
10 826455431 0.5138894

for a given S_id, I would like to select the line corresponding to the
max count. To perform this, I used:
 > aggregate(daf,list(daf$S_id),max)
  Group.1S_id AF_Class count... R_gc_percent S_length
1 8264497 82644973   30 0.4835678
2 8264554 82645543   31 0.5138894

which is ok for the count. But I realized that max function is also
applied
to AF_class (should be 1 and 1 instead of 3 and 3), so it seems that
aggregate is not the appropriate function for that I want to do. Is
there any other function I could use instead?

Best whishes,


Stéphane.
-- 
==
Stephane CRUVEILLER Ph. D.
Genoscope - Centre National de Sequencage
Atelier de Genomique Comparative
2, Rue Gaston Cremieux   CP 5706
91057 Evry Cedex - France
Phone: +33 (0)1 60 87 84 58
Fax: +33 (0)1 60 87 25 14
EMails: [EMAIL PROTECTED] ,[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] Help with the zero.weights option of plotMA3by2 function in Limma package

2006-03-29 Thread Florian Chain
Dear all,

trying to get some insights in a data set resulting from a microarray 
experiment, I used the Limma package and its graphical function plotMA 
and plotMA3by2. I am wondering if there might be a problem with the 
zero.weights option.
Here are the command lines I have tried, and their results
 > plotMA(RGflag2[,1], zero.weights=TRUE)
I got a graphical display, with all data plotted for the first array of 
my data set named RGflag2. RGflag2 includes weights (2 possible values: 
0 and 1).

 > plotMA(RGflag2[,1], zero.weights=FALSE)
When I use this one, I get a plot but some data are missing ( not 
displayed), which is correct, given the option zero.weights=FALSE

However, when I tried to use plotMA3by2
 > plotMA3by2(RGflag2, prefix="zero weights included",  zero.weights=TRUE)
 > plotMA3by2(RGflag2, prefix="zero weights excluded", zero.weights=FALSE)

the images I obtain are identical and correspond to plots without data 
having a 0 as weight value, whatever the setting (TRUE or FALSE).
In other words, individually the zero.weights option gives the expected 
results, but when dealing with a batch of plots with the plotMA3by2 it 
is like it stays by default on the zero.weights=FALSE.
Could anyone know if I am doing something wrong or misunderstanding the 
function zero.weights in the plotMA3by2 ?

Thank you,
Florian

PS: thanks to the creator of R and the packages, by the way.

__
R-help@stat.math.ethz.ch 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] SNP array analysis

2006-03-29 Thread Natalie Twine
Hi

Does anyone who uses R know if there are any new R packages available - 
I imagine under Bioconductor - that process SNP microarray data and 
determine copy number and Loss of heterozygosity?

Thanks
Natalie Twine

--

__
R-help@stat.math.ethz.ch 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 crashes during 'eigen'

2006-03-29 Thread Martin Maechler
> "Simon" == Simon Wood <[EMAIL PROTECTED]>
> on Wed, 29 Mar 2006 16:14:14 +0100 (BST) writes:

>> It looks like there might be a bug in the symmetry detection routine of
>> eigen.   When I do
>> 
>> eigen(M, symmetric=FALSE)
>> 
>> it works fine.

Simon> - but the matrix is symmetric, which seems to be correctly detected
Simon> (since eigen() hangs whether symmetric=TRUE is supplied or not).

>> Eigenvalues (after omitting their imaginary parts, which
>> are essentially zeros) are the same as the ones obtained with EISPACK to
>> within a small multiple of machine epsilon.
>> 
>> However, the eigenvector matrices seem different !  This happens on
>> R-2.2.1-patched and R-2.3.0 (both compiled from daily snapshots).

Simon> - This is OK isn't it? All the non-zero eigenvalues are the same for 
this
Simon> matrix, so the eigenvectors can't be uniquely defined, can they?

Indeed, you are right, Simon.

But anyway the fact is that the LAPACK based eigen seems to end
in an infinite loop, and I can confirm the behavior for at least
R 2.2.1, R-patched and R-devel (aka "2.3.0 alpha") with the "R
builtin" versions of BLAS and LAPACK and also with Atlas.

Seems quite a bad story to me at the moment.
I assume that octave (or matlab) which are also based on BLAS +
LAPACK internally can eigen-decompose the matrix correctly?
Could anyone check this (without much effort) for us?

Thanks in advance,
Martin Maechler, ETH Zurich

Simon> best,
Simon> Simon

>> - Simon Wood, Mathematical Sciences, University of Bath, Bath BA2 7AY
>> - +44 (0)1225 386603 www.maths.bath.ac.uk/~sw283/

>> 
>> Andy
>> 
>> PS.  My system is Windows 2000 on a Xeon CPU.  I use precompiled Pentium 
4
>> Rblas DLL from CRAN, but the same thing happens with standard Rblas.
>> 
>> __
>> Andy Jaworski
>> 518-1-01
>> Process Laboratory
>> 3M Corporate Research Laboratory
>> -
>> E-mail: [EMAIL PROTECTED]
>> Tel:  (651) 733-6092
>> Fax:  (651) 736-3122
>> 
>> 
>> 
>> "C.J.Albers"
>> <[EMAIL PROTECTED]
ac.uk> To
>> Sent by:  
>> [EMAIL PROTECTED]  cc
>> at.math.ethz.ch
>> Subject
>> [R] R crashes during 'eigen'
>> 03/28/2006 10:01
>> AM
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> Hi all,
>> 
>> Hi,
>> 
>> When I want to compute the eigenvalues & eigenvectors of a specific
>> matrix, R crashes (i.e. it stops responding to any input). I've tried it
>> with different versions of R (2.1.1, 2.2.0, 2.2.1) - all with crashing
>> as result.
>> 
>> What I did before the crash was:
>> 
>> M <- as.matrix(read.table("thematrix",header=T))
>> eigen(M)
>> 
>> If, instead of eigen(M), I use eigen(M, EISPACK=T), R doesn't crash. So,
>> I know a workaround my problem, but still don't understand why R
>> crashes. Could anyone explain this?
>> In case someone wants to download my matrix to see where it goes wrong,
>> it can be downloaded from http://mcs.open.ac.uk/cja235/thematrix
>> (warning: obviously, R might crash so save your unsaved work first).
>> 
>> thanks,
>> Casper Albers
>> 
>> 
>> [[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
>> 

Simon> __
Simon> R-help@stat.math.ethz.ch mailing list
Simon> https://stat.ethz.ch/mailman/listinfo/r-help
Simon> 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] aggregate function....

2006-03-29 Thread jim holtman
try 'by':

> x
  S_id AF_Class count... R_gc_percent S_length
5  82644971   30 0.4835678
6  826449737 0.4835678
8  82645541   31 0.5138894
9  82645542   11 0.5138894
10 826455431 0.5138894
> do.call('rbind', by(x, x$S_id, function(y) y[which.max(y$AF_Class),]))
   S_id AF_Class count... R_gc_percent S_length
8264497 826449737 0.4835678
8264554 826455431 0.5138894
>



On 3/29/06, Stephane CRUVEILLER <[EMAIL PROTECTED]> wrote:
>
> Dear R users,
>
> I have some trouble with the aggregate function. Here are my data
>
> > daf
>  S_id AF_Class count... R_gc_percent S_length
> 5  82644971   30 0.4835678
> 6  826449737 0.4835678
> 8  82645541   31 0.5138894
> 9  82645542   11 0.5138894
> 10 826455431 0.5138894
>
> for a given S_id, I would like to select the line corresponding to the
> max count. To perform this, I used:
> > aggregate(daf,list(daf$S_id),max)
> Group.1S_id AF_Class count... R_gc_percent S_length
> 1 8264497 82644973   30 0.4835678
> 2 8264554 82645543   31 0.5138894
>
> which is ok for the count. But I realized that max function is also
> applied
> to AF_class (should be 1 and 1 instead of 3 and 3), so it seems that
> aggregate is not the appropriate function for that I want to do. Is
> there any other function I could use instead?
>
> Best whishes,
>
>
> Stéphane.
> --
> ==
> Stephane CRUVEILLER Ph. D.
> Genoscope - Centre National de Sequencage
> Atelier de Genomique Comparative
> 2, Rue Gaston Cremieux   CP 5706
> 91057 Evry Cedex - France
> Phone: +33 (0)1 60 87 84 58
> Fax: +33 (0)1 60 87 25 14
> EMails: [EMAIL PROTECTED] ,[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
>



--
Jim Holtman
Cincinnati, OH
+1 513 646 9390 (Cell)
+1 513 247 0281 (Home)

What the problem you are trying to solve?

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

Re: [R] graphing and scrolling

2006-03-29 Thread Gregory Snow
 

in regards to the dynamic resizing, one would think that
commands like
plot.default {package:graphics} does it, as I am exploring other
commands from graphics it seams like tkrplot may not be needed,
I am
not sure as I just started with graphics in R, maybe a better
way to
go is call TclTk from R but not sure how, or even save the data
to an
output file and run TclTk independently.
what do you think?

I have done it both ways, you can see examples of using the R graphics
window (which can be resized) with a Tk control box in several of the
functions in the TeachingDemos package (run.cor2.examp for example).
Unfortunatly when working in windows there is a tendancy for the R
window to jump in front of the Tk window which I find annoying, you can
get past this by running R with the SDI switch, but I favor the tkrplot
approach now (The TeachingDemos examples will be changing at some point
to allow either option).  This is less of an issue on Unix, I have no
idea about macs.

This is starting to get into details rather than general R discussion so
future discussion may be better as just e-mails rather than involving
the discussion list.
 
 
-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
[EMAIL PROTECTED]
(801) 408-8111

__
R-help@stat.math.ethz.ch 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 crashes during 'eigen'

2006-03-29 Thread mike waters
 Taking that matrix, stripping out the quoted row and column i.d.s and
entering it into MATLAB R14 (7.01) as M, I get from the eig(M) operation:
E = eig(M)

E =

   -0.
   -0.
   -0.
   -0.
   -0.
   -0.
   -0.
   -0.
   -0.
   -0.
   -0.
   -0.
   -0.
   -0.
   -0.
   -0.
0.
0.
0.
0.
0.
0.
0.
0.
0.
0.
0.
0.
0.
0.
7.4486
7.4486
7.4486
7.4486
7.4486
7.4486
7.4486
7.4486
7.4486
7.4486
7.4486
7.4486
7.4486
7.4486
7.4486
7.4486
7.4486
7.4486
7.4486
7.4486
7.4486
7.4486
7.4486
7.4486
7.4486
7.4486
7.4486
7.4486
7.4486
7.4486
7.4486
7.4486
7.4486
7.4486
7.4486
7.4486
7.4486
7.4486
7.4486
7.4486
7.4486
7.4486

>> 

I presume this is the expected output (i.e. all non-zero eigenvalues the
same, 7.4486).

Regards,

Mike

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Martin Maechler
Sent: 29 March 2006 17:02
To: Simon Wood
Cc: r-help@stat.math.ethz.ch; [EMAIL PROTECTED]
Subject: Re: [R] R crashes during 'eigen'

> "Simon" == Simon Wood <[EMAIL PROTECTED]>
> on Wed, 29 Mar 2006 16:14:14 +0100 (BST) writes:

>> It looks like there might be a bug in the symmetry detection routine
of
>> eigen.   When I do
>> 
>> eigen(M, symmetric=FALSE)
>> 
>> it works fine.

Simon> - but the matrix is symmetric, which seems to be correctly
detected
Simon> (since eigen() hangs whether symmetric=TRUE is supplied or not).

>> Eigenvalues (after omitting their imaginary parts, which
>> are essentially zeros) are the same as the ones obtained with EISPACK
to
>> within a small multiple of machine epsilon.
>> 
>> However, the eigenvector matrices seem different !  This happens on
>> R-2.2.1-patched and R-2.3.0 (both compiled from daily snapshots).

Simon> - This is OK isn't it? All the non-zero eigenvalues are the same
for this
Simon> matrix, so the eigenvectors can't be uniquely defined, can they?

Indeed, you are right, Simon.

But anyway the fact is that the LAPACK based eigen seems to end in an
infinite loop, and I can confirm the behavior for at least R 2.2.1,
R-patched and R-devel (aka "2.3.0 alpha") with the "R builtin" versions of
BLAS and LAPACK and also with Atlas.

Seems quite a bad story to me at the moment.
I assume that octave (or matlab) which are also based on BLAS + LAPACK
internally can eigen-decompose the matrix correctly?
Could anyone check this (without much effort) for us?

Thanks in advance,
Martin Maechler, ETH Zurich

Simon> best,
Simon> Simon

>> - Simon Wood, Mathematical Sciences, University of Bath, Bath BA2 7AY
>> - +44 (0)1225 386603 www.maths.bath.ac.uk/~sw283/

>> 
>> Andy
>> 
>> PS.  My system is Windows 2000 on a Xeon CPU.  I use precompiled
Pentium 4
>> Rblas DLL from CRAN, but the same thing happens with standard Rblas.
>> 
>> __
>> Andy Jaworski
>> 518-1-01
>> Process Laboratory
>> 3M Corporate Research Laboratory
>> -
>> E-mail: [EMAIL PROTECTED]
>> Tel:  (651) 733-6092
>> Fax:  (651) 736-3122
>> 
>> 
>> 
>> "C.J.Albers"
>> <[EMAIL PROTECTED]
ac.uk> To
>> Sent by:  
>> [EMAIL PROTECTED]  cc
>> at.math.ethz.ch
>> Subject
>> [R] R crashes during 'eigen'
>> 03/28/2006 10:01
>> AM
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> Hi all,
>> 
>> Hi,
>> 
>> When I want to compute the eigenvalues & eigenvectors of a specific
>> matrix, R crashes (i.e. it stops responding to any input). I've tried
it
>> with different versions of R (2.1.1, 2.2.0, 2.2.1) - all with
crashing
>> as result.
>> 
>> What I did before the crash was:
>> 
>> M <- as.matrix(read.table("thematrix",header=T))
>> eigen(M)
>> 
>> If, instead of eigen(M), I use eigen(M, EISPACK=T), R doesn't crash.
So,
>> I know a workaround my problem, but still don't understand why R
>> crashes. Could anyone explain this?
>> In case someone wants to download my matrix to see where it goes
wrong,
>> it can be downloaded from http://mcs.open.ac.uk/cja235/thematrix
>> (warning: obviously, R might crash so save your unsaved work first).
>> 
>> thanks,
>> Casper Albers
>> 
>> 
>> [[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-gu

Re: [R] atan2(1,1i)

2006-03-29 Thread Jeff Newmiller
Prof Brian Ripley wrote:
 >

[...]

> And only the designers can say
> 
> 'but atan2 wasn't originally designed for complex arguments.'
> 
> but the code suggests otherwise.

I was not referring to the _coding_ of the function... I was
referring to the _design_.  The design of the "atan2" function
preceeds the existence of the "R" software package by decades,
and it was created to get around the limitations of the "atan"
function for extracting the angular component of a polar
coordinate from rectangular coordinates.  Applications of this
function with complex arguments remain obscure, while its use
in obtaining the argument of a complex number is not.

Regardless of obscurity, given that the "R" version does
support complex numbers, I agree with Robin that it should accept
any combination of numeric and complex parameters, and I concur
with you that this suggestion belongs on the developers list.

>> On 28 Mar 2006, at 19:52, Jeff Newmiller wrote:
>>
>>> Robin Hankin wrote:
>>>
 Hi

 ?atan2 says that atan2(y,x)=atan(y/x) for x and y numeric or complex
 vectors.

 Well, I would expect atan2(1,1i) to be equal to atan(-1i), but

> atan2(1,1i)

 Error in atan2(y, x) : Non-numeric argument to mathematical function
>>>
>>>
>>> Ravi Varadhan pointed out that you need to make both arguments complex
>>> to address the error message you obtained... but atan2 wasn't
>>> originally
>>> designed for complex arguments. I suspect that what you really want is
>>> to use the Arg function:
>>>
 Arg(1/1i)
>>>
>>> [1] -1.570796


-- 
---
Jeff NewmillerThe .   .  Go Live...
DCN:<[EMAIL PROTECTED]>Basics: ##.#.   ##.#.  Live Go...
   Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k

__
R-help@stat.math.ethz.ch 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] Sub-vector

2006-03-29 Thread Wuming Gong
Dear list,

Given a vector of logical values, say

>a <- c(TRUE,TRUE,TRUE,FALSE,FALSE,FALSE,FALSE,TRUE,TRUE,TRUE)

Are there any R functions that can tell whether there are two or more
"TRUE" in a row in this vector?

Thanks,

Wuming

__
R-help@stat.math.ethz.ch 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] Sub-vector

2006-03-29 Thread King, David

Wuming,

which(a) will identify the TRUE values and sum(a) will tell you how many
TRUE values there are.

David


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Wuming Gong
Sent: 29 March 2006 18:21
To: r-help@stat.math.ethz.ch
Subject: [R] Sub-vector


* Please Note : This message was received from the Internet *
_

Dear list,

Given a vector of logical values, say

>a <- c(TRUE,TRUE,TRUE,FALSE,FALSE,FALSE,FALSE,TRUE,TRUE,TRUE)

Are there any R functions that can tell whether there are two or more
"TRUE" in a row in this vector?

Thanks,

Wuming

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


__


This message might contain confidential information. If it has been sent to you 
in error please do not forward it or copy it or act upon its contents, but 
report it to [EMAIL PROTECTED]

Schroders has the right lawfully to record, monitor and inspect messages 
between its employees and any third party. Your messages shall be subject to 
such lawful supervision as Schroders deems to be necessary in order to protect 
its information, its interests and its reputation.

Schroders prohibits and takes steps to prevent its information systems from 
being used to view, store or forward offensive or discriminatory material. If 
this message contains such material please report it to [EMAIL PROTECTED]

Schroders does not normally accept or offer business instructions via email 
unless prior agreements are in place. Any action that you might take upon this 
message might be at your own risk.



Schroder Investment Management Limited
31 Gresham Street
London EC2V 7QA

Authorised and regulated by the Financial Services Authority. Schroder 
Investment Management Limited is entered on the FSA register under the 
following register number: 119348

Registered Office
31 Gresham Street
London EC2V 7QA

Registered number 1893220
VAT registration number 243 8687 30

__
R-help@stat.math.ethz.ch 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] Sub-vector

2006-03-29 Thread Gabor Grothendieck
Try this:

with(rle(a), any(lengths[values]>1))


On 3/29/06, Wuming Gong <[EMAIL PROTECTED]> wrote:
> Dear list,
>
> Given a vector of logical values, say
>
> >a <- c(TRUE,TRUE,TRUE,FALSE,FALSE,FALSE,FALSE,TRUE,TRUE,TRUE)
>
> Are there any R functions that can tell whether there are two or more
> "TRUE" in a row in this vector?
>
> Thanks,
>
> Wuming
>
> __
> R-help@stat.math.ethz.ch 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] Sub-vector

2006-03-29 Thread Roger Bivand
On Thu, 30 Mar 2006, Wuming Gong wrote:

> Dear list,
> 
> Given a vector of logical values, say
> 
> >a <- c(TRUE,TRUE,TRUE,FALSE,FALSE,FALSE,FALSE,TRUE,TRUE,TRUE)
> 
> Are there any R functions that can tell whether there are two or more
> "TRUE" in a row in this vector?

?rle (a very useful function)

aa <- rle(a)
any(aa$values & aa$lengths > 1)


> 
> Thanks,
> 
> Wuming
> 
> __
> R-help@stat.math.ethz.ch 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, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
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] Lmer BLUPS: was(lmer multilevel)

2006-03-29 Thread Doran, Harold
Paul:

I may have found the issue (which is similar to your conclusion).  I
checked using egsingle in the mlmRev package as these individuals are
strictly nested in this case:

library(mlmRev)
library(nlme)

fm1 <- lme(math ~ year, random=~1|schoolid/childid, egsingle)
fm2 <- lmer(math ~ year +(1|schoolid:childid) + (1|schoolid), egsingle)

Checking the summary of both models, the output is exactly the same
w.r.t. the fixed effects, variance components, standard errors etc. The
prior two lines of code fit the same models. However, the following does
not generate similar output:

head(coef(fm2)[[1]])
   (Intercept)  year
2020:273026452 -0.30213394 0.7461233
2020:273030991  0.41469885 0.7461233
2020:273059461 -0.07443003 0.7461233
2020:278058841  0.61676579 0.7461233
2020:292017571  0.29529524 0.7461233
2020:292020281 -1.03811716 0.7461233

> head(coef(fm1, level=2))
   (Intercept)  year
2020/273026452   0.3248913 0.7461233
2020/273030991   1.0417241 0.7461233
2020/273059461   0.5525952 0.7461233
2020/278058841   1.2437910 0.7461233
2020/292017571   0.9223205 0.7461233
2020/292020281  -0.4110920 0.7461233

Although they are similar for schools:

> head(coef(fm1, level=1))
 (Intercept)  year
2020  -0.1534565 0.7461233
2040  -0.6985680 0.7461233
2180  -1.0621073 0.7461233
2330  -0.6262567 0.7461233
2340  -1.0090541 0.7461233
2380  -0.6095037 0.7461233

> head(coef(fm2)[[2]])
 (Intercept)  year
2020  -0.1534566 0.7461233
2040  -0.6985681 0.7461233
2180  -1.0621072 0.7461233
2330  -0.6262567 0.7461233
2340  -1.0090541 0.7461233
2380  -0.6095037 0.7461233

I checked a bit further to see if there was any pattern to the
differences:

tt <- cbind(coef(fm1, level=2)[1], coef(fm2)[[1]][1])
tt$dif <- tt[,1] - tt[,2]

There is clearly a systematic pattern to the difference between the two.
Now, when you go and look at the random effects

 head(ranef(fm2)[[2]])

You can see that this is the value that is not being added in to the
coefficients in lmer() and this accounts for the difference. So, these
need to be added in for now.

I hope this helps,
Harold



My question relates to problems that I'm having matching lme and lmer
examples in P&B. 
using Matix 0.995
 
In the Oxide example in p167-170 I can't get the level 2 coefficient
estimates to match the fm1Oxide model in lme is 
 
data(Oxide,package="nlme")
lme(Thickness~1,Oxide)

which I translate in Lmer syntax to 
 
fm3Oxide<-lmer(Thickness~ (1|Lot)+(1|Lot:Wafer),data=Oxide) #or
alternatively which gives the same result
Oxide$LW<-with(Oxide,Lot:Wafer)[drop=TRUE]
fm4Oxide<-lmer(Thickness~ (1|Lot)+(1|LW),data=Oxide)
 
however if you look at say Lot 8, lme gives
 
81993.767

8/11993.677
8/21995.170
8/31990.693

 
while  lmer gives
coef(fm3Oxide)

81993.767
8:1 2000.062

8:2 2001.555

8:3 1997.078

To me this looks like lmer in not including the lot random effect (8=
-6.385129, Intercept 2000.153 ). Is this because I'm not specifying the
model correctly?

Thanks Paul


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


Re: [R] nlme for groupedData with inner and outer factors

2006-03-29 Thread Spencer Graves
  1.  Have you read Pinheiro and Bates (2000) Mixed-Effects Models in S 
and S-Plus (Springer)?  If no, I believe your study of that book will be 
well rewarded;  mine has.

  2.  If you've looked at Pinheiro and Bates and still have questions 
about this, PLEASE do read the posting guide! 
"www.R-project.org/posting-guide.html", especially the bit about 
developing a toy example that is as simple as you can make it that still 
illustrates your question.  I've solved many of my own problems doing 
this, and I've answered many questions for people on this list dealing 
with functions I've not previously used.  You could help people like me 
by providing a few lines of R code that we could copy from your email, 
paste into R and replicate what you see.

  hope this helps,
  spencer graves

Dan Bebber wrote:

> Hello,
> 
> I am having trouble specifying a suitable nlme model.
> My data structure is described by
> 
> gd <- groupedData(ppath ~ lcut | exp, outer = ~ bait, inner = ~ weight, data 
> = d)
> 
> i.e. the response (ppath) of several subjects (sub) was measured at levels 
> of a continuous variable (lcut). Subjects were given either of one level of 
> a factor (bait), and all subjects were measured at two levels of another 
> factor (weight). Therefore bait varies among subjects and weight varies 
> within subjects.
> 
> The relationship ppath ~ cut for each subject and weight appear to follow a 
> logistic curve, with xmid and scal affected by bait and weight. There is 
> also a random effect of subject on xmid and scal.
> 
> Any help with formulating the correct model would be greatly appreciated.
> 
> Many thanks,
> Dan Bebber
> 
> Department of Plant Sciences
> University of Oxford
> 
> p.s. Part of my data are shown below:
> 
>  sublcut   ppath bait weight
> 1   pv1_  0.0 1.01  0
> 2   pv1_  0.1 0.8277738211  0
> 3   pv1_  0.2 0.3801025021  0
> 4   pv1_  0.3 0.2091518781  0
> 5   pv1_  0.4 0.0769293041  0
> 6   pv1_  0.5 0.0656815641  0
> 7   pv1_  0.6 0.0206701081  0
> 8   pv1_  0.7 0.0128170211  0
> 9   pv1_  0.8 0.0086615141  0
> 10  pv1_  0.9 0.0115683231  0
> 11  pv19  0.0 1.01  0
> 12  pv19  0.1 0.6683902911  0
> 13  pv19  0.2 0.3433184621  0
> 
> __
> R-help@stat.math.ethz.ch 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] R for Windows crash on new laptop

2006-03-29 Thread Karen Martien
I'm trying to use a contributed package (rmetasim) to generate simulated 
genetic datasets.  My scripts work fine when I run them on a Sun 
workstation running Solaris 7 and when I run them on a ~4 year old 
laptop PC that I have.  However, when I run them on my new laptop (Dell 
Latitude D410 purchased in August 2005), the simulation will run for a 
short (variable) period of time, then R crashes.  When it crashes, I 
either get an Application Popup that says

'The instruction at "0x5ad71531" referenced memory at "0x0014".  The 
memory could not be "read".',

or I simply get the popup saying that RGUI has experienced a problem, 
would I like to send a report to Microsoft.  When the latter happens, an 
event log is generated that says

'Fauling application rgui.exe, version 2.30.37590.0, fauling module 
ntdll.dll, version 5.1.2600.2180, fault address 0x0001888f.'

In both types of errors, the memory addresses listed are different every 
time a crash occurs.

I experience this problem primarily when attempting to simulate large 
datasets.  My script saves the 'landscape' (the object being simulated) 
every 100 time steps.  When R crashes, I can start it back up, reload 
the last landscape saved before the crash, and continue simulating from 
there.  Thus, there appears to be nothing wrong with the landscapes I'm 
simulating.

I've been in contact with the author of the contributed package I'm 
using, and he has been unable to find any bugs in the package or 
reproduce the error.  The bug seems to be platform specific since, as I 
mentioned, I'm able to run my scripts crash-free on other computers.  
However, I've tried running my scripts on another computer that is 
nearly identical to mine (a Dell D610 purchased in August 2005), and 
experience the same problems on that computer.  I've tried running my 
scripts from a command window using 'R --vanilla', and experience the 
same problems.  I've tried using the development version of R 
(R-2.3.0alpha) and experience the same problems.

In reading other bug reports I found that some people have had crashes 
caused by buggy video drivers.  I've updated my video drivers, but it 
didn't help.  However, I was only able to upgrade to the newest version 
of the video driver; I haven't been able to find an alternative driver 
to work with my display adapter.  The display adapter used by my 
computer is the mobile Intel 915GM/GMS,910GML Express Chipset.

I'm running R 2.2.1 (though I've tried R 2.0.1 and 2.3.0alpha and had 
the same problem).  The machine on which I've had problems is a Dell 
Latitude D410 laptop running Windows XP Pro SP2, 2GHz Pentium processor 
with 1GB of RAM.  The output of the R command 'version' is;

platform i386-pc-mingw32
arch i386  
os   mingw32   
system   i386, mingw32 
status 
major2 
minor2.1   
year 2005  
month12
day  20
svn rev  36812 
language R  

The exact sequence of commands I type, after launching the Rgui, is as 
follows:

 >library(rmetasim)
 >source("ArchI_burnin_NOdensdep-mod.R")

The script I'm running (which obviously requires that the package 
'rmetasim' be installed) follows.  Beware that the script takes about 15 
minutes to run on my old computer (the one on which it doesn't crash.  
For what it's worth, that computer is a Dell Latitude C400 running 
Windows XP Pro SP2, 866 MHz Pentium III processor, 512 MB of RAM).  Any 
suggestions would be greatly appreciated.


#ArchI_burnin_NOdensdep-mod.R#

habitats <- 1
carrycap <- 7500
stages <- 5
rland <- NULL
numreps <-  2
numsteps <- 50
stepsize <- 100
runlength <- numsteps*stepsize

rland <- new.landscape.empty()
rland <- new.intparam.land(rland, h = habitats, s = stages, totgen = 
runlength)
rland <- new.switchparam.land(rland, mp = 1)
rland <- new.floatparam.land(rland)

#life history matrices at zero population density
SZ <- matrix (c(0.730, 0, 0, 0, 0,
   0.210, 0, 0, 0, 0,
   0, 0.470, 0, 0.946, 0,   
   0, 0, 0.946, 0, 0,
   0, 0.470, 0, 0, 0.954), nrow=5, byrow = T)

RZ <- matrix (c(0, 0, 0, .94, 0,
   0, 0, 0, 0, 0,
   0, 0, 0, 0, 0,
   0, 0, 0, 0, 0,
   0, 0, 0, 0, 0), nrow = 5, byrow = T)

M <- matrix (c(0, 0, 0, 0, 0,
   0, 0, 0, 0, 0,
   0, 0, 0, 0, 0,
   0, 0, 0, 0, 1,
   0, 0, 0, 0, 0), nrow = 5, byrow = T)

rland <- new.local.demo(rland,SZ,RZ,M)

rland <- 
new.epoch.island(rland,0,c(0,0,0,0,0),c(0,0,0,0,0),0,c(0,0,0,0,0),c(0,0,0,0,0),
0,c(0,0,0,0,0),c(0,0,0,0,0), carry = rep(carrycap,habitats))

rland <- new.locus(rland, type = 1, ploidy = 2, transmission = 0, 
numalleles = 1, mutationrate = 0.001)
rland <- new.locus(rland, type = 1, ploidy = 2, transmission = 0, 
numalleles = 1, mutationrate = 0.001)
rland <- new.locus(rland, type = 1, ploidy = 2, transm

Re: [R] Optim and likelihood computations

2006-03-29 Thread Spencer Graves
  For general maxiimum likelihood estimation, have you considered the 
function "mle" in library(stats4)?  I've learned some things (a) reading 
the documentation for "mle" and for other topics listed under "See Also" 
and (b) working the "Examples" in the documentation.

  Regarding AR structures, there are many capabilities for time series 
in R scattered in numerous packages.  Since you are new to R, have you 
read Venables and Ripley (2002) Modern Applied Statists with S 
(Springer)?  Ch. 14 deals with time series.  I highly recommend this 
book for R in general, and this chapter provides a reasonable 
introduction to a few of the time series capabilities in the base R 
distribution.

  Beyond that, have you worked through the vignettes associated with 
the "zoo" package? If no, you might find that quite useful. [Are you 
aware that edit(vignette(...)) will provide a script file with the R 
code discussed in the vignette, which can be viewed in Adobe Acrobat 
while you are working throught the examples line by line, modifying 
them, etc.? I've found this to be very useful. If you use XEmacs, 
"edit(vignette(...))" may not work. Instead, try 
Stangle(vignette(...)$file). This will copy the R code to a file in the 
working directory, which you can then open.]

  I've also found the dse bundle and its vignettes very interesting and 
usefulfor time series.  Beyond that, you might try the Rmetrics project 
(www.rmetrics.org).

  I expect that other questions will occur to you in the process of 
reviewing or trying to apply some of the material I just suggested. 
Please feel free to post other questions to this list -- but please 
first also review the posting guide! 
"www.R-project.org/posting-guide.html";  doing so might increase your 
chances of getting useful answers quicker.

  hope this helps.
  spencer graves

[EMAIL PROTECTED] wrote:

> Hello everyone.
> 
> I want to  write some likelihood functions to use with optim. For example 
> AR-structures, I have written a couple of functions that appear to get the 
> job done. But, since I am new to R, I wanted to ask if there are any 
> references in this topic. 
> 
> Thanks in advance,
> 
> ***
> Antonio Paredes
> USDA- Center for Veterinary Biologics
> Biometrics Unit
> 510 South 17th Street, Suite 104
> Ames, IA 50010
> (515) 232-5785
> 
> 
>   [[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


[R] Recall for parent

2006-03-29 Thread Paul Roebuck
What's the best way to simulate Recall for parent function?
Consider this one-time recursive code:

alwaysEven <- function(x) {
handleOdd <- function(x) {
alwaysEven(x-1)# use Recall-like here
}

return(if (x %% 2) handleOdd(x) else x)
}
any2even <- alwaysEven
rm(alwaysEven)
any2even(3)

--
SIGSIG -- signature too long (core dumped)

__
R-help@stat.math.ethz.ch 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] Message to R-help

2006-03-29 Thread Gina Buzzelle
From: [EMAIL PROTECTED]
Reply-to: [EMAIL PROTECTED]
Subject: S-PLUS 8 Beta Program
Time to go out: As soon as possible

Dear R-help readers, 

As Insightful announced at the DSC2005 meeting in Seattle, the next
release of S-PLUS will introduce a new package system. Our goal is to provide
package authors the means to create cutting-edge statistical methods
currently available either as R packages or as S-PLUS library sections and
deliver them to the entire community of S-PLUS and R users.

In this release of S-PLUS, we plan to implement many low-level
utility functions with the same API as R. Just as many R functions originated
in S-PLUS, we plan on re-implementing many R functions in S-PLUS to provide
S-PLUS users the ability to create packages of their work and distribute them
to others as R users have done for many years. In the future, we expect
package authors will be able to create a single package that will run in both
environments. The actual package system would be a port of the R package
system code, which furthers the exchangeability of S-PLUS and R code. The
ported code will be available in a GPL library called Rcompat

To demonstrate that R packages can now be ported to S-PLUS, we have -
with the permissions of the authors - ported several R packages to run as
S-PLUS packages. We are planning to make these packages available for
download from an Insightful-hosted website (called csan.insightful.com for
consistency with the CRAN site of R packages). The license terms of the
source packages will always be respected, and these packages will all be
available under their original open-source license. Any improvements to
open-source packages, whether by Insightful or by others, will remain
open-source. Our intent will be to grow the list of open-source,
cross-system-compatible packages over time. 

While most existing R packages will not run automatically in S-PLUS,
with some effort, a user should be able to port an existing R package to an
S-PLUS package. More important, by using functions and interfaces now
available in both systems, a user should be able to create a single package
that will run in both S-PLUS and R in the future. (The judicious use of some
system-specific if(is.R()) statement will help to this end.) As a proof of
concept, we are developing a package that will run on both systems.  In the
future, we hope to post this package on both CSAN and CRAN sites. We are also
working to provide S-PLUS library sections from our research group as S-PLUS
packages that would also work in R. 

Our work on the S-PLUS package functionality is ongoing. We expect to
begin beta testing in April. We invite R package authors who are interested
in testing their packages in S-PLUS to participate in the beta test. As a
beta participant, you will receive a beta version of S-PLUS that will be
fully functional until the end of the beta period. You will also be able to
send input to the development team regarding the S-PLUS package system. If
you are a package author, and you are interested in participating in the beta
test, see the full details on the S-PLUS 8 beta test and complete the
registration form at the Insightful website:


http://www.insightful.com/support/splus8beta/
 

Best regards from the S-PLUS product management team,

Patrick Aboyoun (S-PLUS Platform)
Michael O'Connell (Life Sciences) 
David Smith (Finance)



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


Re: [R] Recall for parent

2006-03-29 Thread Gabor Grothendieck
Here are two ways:


# method 1. nest an extra alwaysEven
alwaysEven <- function(x) {
 alwaysEven <- function(x) {
   handleOdd <- function(x) {
   alwaysEven(x-1)# use Recall-like here
   }

   return(if (x %% 2) handleOdd(x) else x)
 }
 alwaysEven(x)
}
any2even <- alwaysEven
rm(alwaysEven)
any2even(3)


# method 2.  sys.function

alwaysEven <- function(x) {
   handleOdd <- function(x) {
   sys.function(1)(x-1)# use Recall-like here
   }

   return(if (x %% 2) handleOdd(x) else x)
}
any2even <- alwaysEven
rm(alwaysEven)
any2even(3)



On 3/29/06, Paul Roebuck <[EMAIL PROTECTED]> wrote:
> What's the best way to simulate Recall for parent function?
> Consider this one-time recursive code:
>
> alwaysEven <- function(x) {
>handleOdd <- function(x) {
>alwaysEven(x-1)# use Recall-like here
>}
>
>return(if (x %% 2) handleOdd(x) else x)
> }
> any2even <- alwaysEven
> rm(alwaysEven)
> any2even(3)
>
> --
> SIGSIG -- signature too long (core dumped)
>
> __
> R-help@stat.math.ethz.ch 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] S-PLUS 8 beta program [repost]

2006-03-29 Thread David Smith
[Sorry about the duplicate posting; this one comes from the correct address.
Please respond to me with any questions about this -- David.]

Dear R-help readers, 

As Insightful announced at the DSC2005 meeting in Seattle, the next
release of S-PLUS will introduce a new package system. Our goal is to provide
package authors the means to create cutting-edge statistical methods
currently available either as R packages or as S-PLUS library sections and
deliver them to the entire community of S-PLUS and R users.

In this release of S-PLUS, we plan to implement many low-level
utility functions with the same API as R. Just as many R functions originated
in S-PLUS, we plan on re-implementing many R functions in S-PLUS to provide
S-PLUS users the ability to create packages of their work and distribute them
to others as R users have done for many years. In the future, we expect
package authors will be able to create a single package that will run in both
environments. The actual package system would be a port of the R package
system code, which furthers the exchangeability of S-PLUS and R code. The
ported code will be available in a GPL library called Rcompat

To demonstrate that R packages can now be ported to S-PLUS, we have -
with the permissions of the authors - ported several R packages to run as
S-PLUS packages. We are planning to make these packages available for
download from an Insightful-hosted website (called csan.insightful.com for
consistency with the CRAN site of R packages). The license terms of the
source packages will always be respected, and these packages will all be
available under their original open-source license. Any improvements to
open-source packages, whether by Insightful or by others, will remain
open-source. Our intent will be to grow the list of open-source,
cross-system-compatible packages over time. 

While most existing R packages will not run automatically in S-PLUS,
with some effort, a user should be able to port an existing R package to an
S-PLUS package. More important, by using functions and interfaces now
available in both systems, a user should be able to create a single package
that will run in both S-PLUS and R in the future. (The judicious use of some
system-specific if(is.R()) statement will help to this end.) As a proof of
concept, we are developing a package that will run on both systems.  In the
future, we hope to post this package on both CSAN and CRAN sites. We are also
working to provide S-PLUS library sections from our research group as S-PLUS
packages that would also work in R. 

Our work on the S-PLUS package functionality is ongoing. We expect to
begin beta testing in April. We invite R package authors who are interested
in testing their packages in S-PLUS to participate in the beta test. As a
beta participant, you will receive a beta version of S-PLUS that will be
fully functional until the end of the beta period. You will also be able to
send input to the development team regarding the S-PLUS package system. If
you are a package author, and you are interested in participating in the beta
test, see the full details on the S-PLUS 8 beta test and complete the
registration form at the Insightful website:


http://www.insightful.com/support/splus8beta/
 

Best regards from the S-PLUS product management team,

Patrick Aboyoun (S-PLUS Platform)
Michael O'Connell (Life Sciences) 
David Smith (Finance)

--
David M Smith <[EMAIL PROTECTED]>
Senior Product Manager, Insightful Corp, Seattle WA
Tel: +1 (206) 802 2360
Fax: +1 (206) 283 6310

__
R-help@stat.math.ethz.ch 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] Plotting shapefiles on existing maps

2006-03-29 Thread Ray Brownrigg
> From: [EMAIL PROTECTED]
> 
> I have plotted a map of the Barents Sea and surrounding coastline using:
> 
> map('worldHires',ylim=c(50,85),xlim=c(5,65),fill=T,resolution=0)
> map.axes()
> map.scale(x=30,metric=T)
> 
> Next, I imported a shapefile with depth contours for the sea:
> 
> contours<-read.shape("D://My Documents/BarentsSea.shp",dbf.data=T)
> 
> (This is in mercator projection).
> 
> Despite extensive searches of the help files and R site, I cannot find a
> way to plot the contours onto the map.  Does anyone have any suggestions?
> 
It is not clear to me exactly what you are having difficulty with, but
if you are able to produce a contour plot from that data, then note that
both contour() and map() have an "add" argument, so as long as the axis
limits are conformant (i.e. both longitude/latitude) you can add one
plot to the other.

Perhaps the trick is in converting your contours data into
longitude/latitude form for the x and y components.

Hope this helps,
Ray Brownrigg

__
R-help@stat.math.ethz.ch 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] S-PLUS 8 beta program [repost]

2006-03-29 Thread Philippe Grosjean
This is an excellent initiative! But how can you integrate GPL code in a 
software that is not GPL? As far as I understand it, GPL is a 
contaminant license, imposing to the whole software to be GPL too (or 
providing at least similar freedom). I have no doubt that you solved 
this problem. I am just curious about the solution you found.
Best regards,

Philippe Grosjean

..<°}))><
  ) ) ) ) )
( ( ( ( (Prof. Philippe Grosjean
  ) ) ) ) )
( ( ( ( (Numerical Ecology of Aquatic Systems
  ) ) ) ) )   Mons-Hainaut University, Pentagone (3D08)
( ( ( ( (Academie Universitaire Wallonie-Bruxelles
  ) ) ) ) )   8, av du Champ de Mars, 7000 Mons, Belgium
( ( ( ( (
  ) ) ) ) )   phone: + 32.65.37.34.97, fax: + 32.65.37.30.54
( ( ( ( (email: [EMAIL PROTECTED]
  ) ) ) ) )
( ( ( ( (web:   http://www.umh.ac.be/~econum
  ) ) ) ) )  http://www.sciviews.org
( ( ( ( (
..

David Smith wrote:
> [Sorry about the duplicate posting; this one comes from the correct address.
> Please respond to me with any questions about this -- David.]
> 
> Dear R-help readers, 
> 
>   As Insightful announced at the DSC2005 meeting in Seattle, the next
> release of S-PLUS will introduce a new package system. Our goal is to provide
> package authors the means to create cutting-edge statistical methods
> currently available either as R packages or as S-PLUS library sections and
> deliver them to the entire community of S-PLUS and R users.
> 
>   In this release of S-PLUS, we plan to implement many low-level
> utility functions with the same API as R. Just as many R functions originated
> in S-PLUS, we plan on re-implementing many R functions in S-PLUS to provide
> S-PLUS users the ability to create packages of their work and distribute them
> to others as R users have done for many years. In the future, we expect
> package authors will be able to create a single package that will run in both
> environments. The actual package system would be a port of the R package
> system code, which furthers the exchangeability of S-PLUS and R code. The
> ported code will be available in a GPL library called Rcompat
> 
>   To demonstrate that R packages can now be ported to S-PLUS, we have -
> with the permissions of the authors - ported several R packages to run as
> S-PLUS packages. We are planning to make these packages available for
> download from an Insightful-hosted website (called csan.insightful.com for
> consistency with the CRAN site of R packages). The license terms of the
> source packages will always be respected, and these packages will all be
> available under their original open-source license. Any improvements to
> open-source packages, whether by Insightful or by others, will remain
> open-source. Our intent will be to grow the list of open-source,
> cross-system-compatible packages over time. 
> 
>   While most existing R packages will not run automatically in S-PLUS,
> with some effort, a user should be able to port an existing R package to an
> S-PLUS package. More important, by using functions and interfaces now
> available in both systems, a user should be able to create a single package
> that will run in both S-PLUS and R in the future. (The judicious use of some
> system-specific if(is.R()) statement will help to this end.) As a proof of
> concept, we are developing a package that will run on both systems.  In the
> future, we hope to post this package on both CSAN and CRAN sites. We are also
> working to provide S-PLUS library sections from our research group as S-PLUS
> packages that would also work in R. 
> 
>   Our work on the S-PLUS package functionality is ongoing. We expect to
> begin beta testing in April. We invite R package authors who are interested
> in testing their packages in S-PLUS to participate in the beta test. As a
> beta participant, you will receive a beta version of S-PLUS that will be
> fully functional until the end of the beta period. You will also be able to
> send input to the development team regarding the S-PLUS package system. If
> you are a package author, and you are interested in participating in the beta
> test, see the full details on the S-PLUS 8 beta test and complete the
> registration form at the Insightful website:
> 
> 
>   http://www.insightful.com/support/splus8beta/
>
> 
>   Best regards from the S-PLUS product management team,
> 
>   Patrick Aboyoun (S-PLUS Platform)
>   Michael O'Connell (Life Sciences) 
>   David Smith (Finance)
> 
> --
> David M Smith <[EMAIL PROTECTED]>
> Senior Product Manager, Insightful Corp, Seattle WA
> Tel: +1 (206) 802 2360
> Fax: +1 (206) 283 6310
> 
> __
> R-help@stat.math.ethz.ch 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, RMysql, and MySQL 5 Decimal Type Support

2006-03-29 Thread Jason Trimble
That is interesting to find out since on RMySQL module site
(http://stat.bell-labs.com/RS-DBI/download/) it says the following for
the latest version: "RMySQL 0.5-7 built with R 2.2.1 and MySQL 5.0.18"
which is now obviously not entirely true, seeing as how that is what I
am using. :)

It there any type of release schedule for a new RMySQL?

Also, I tried coercing the vector into a numeric but get the following:
(this is just a simple example)
>grdata = dbGetQuery(connection, "select 2 as age, 2.5 as hours");
>attach(grdata);
>test = as.numeric(grdata["hours"]);
Error in as.double.default(grdata["hours"]) : 
unimplemented type 'character' in 'asReal'

I can run the same command on the age (2) value with no errors. It just
does not like the 2.5 at all!

-Original Message-
From: David James [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, March 28, 2006 11:08 PM
To: Jason Trimble
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] R, RMysql, and MySQL 5 Decimal Type Support

Hi,

MySQL data type 246 is the new (as of version 5.0?) fixed precision
DECIMAL type, which doesn't map to any existing R type.  In most
cases, I believe, it is imported as an R character vector, and you can
just coerce it to numeric, i.e., to floating point precision.

Next version of RMySQL will address this issue, and comments 
regarding what would be a suitable R type for SQL fixed DECIMALs 
are welcome.


--
David

Jason Trimble wrote:
> Hi,
> 
>  
> 
> Whenever I have a MySQL query that returns a Decimal result to R I get
> the following warning in R:
> 
>  
> 
> Warning message:
> 
> RS-DBI driver warning: (unrecognized MySQL field type 246 in column 1)
> 
>  
> 
> I get this for a simple query like "SELECT 2, 2.5" !!
> 
>  
> 
> I am using:
> 
> R ver 2.1.1
> 
> RMySQL ver. 0.5-7
> 
> DBI ver. 0.1-10
> 
> MySQL  Ver 14.12 Distrib 5.0.18. 
> 
>  
> 
> Please Help!
> 
> Jason
> 
>  
> 
>   [[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


[R] conflicts Var names

2006-03-29 Thread Fred J.
  Dear R users
 
 I have read somewhere which I don't remember that some variable names
 are not to be used for conflict avoidance. and those were (c, q, T, F,
 T)
 I ran this
 > conflicts(detail=TRUE)
 $.GlobalEnv
 [1] "ts"
 
 $"package:methods"
 [1] "body<-"
 
 $"package:stats"
 [1] "ts"
 
 $"package:base"
 [1] "body<-"
 
 I don't note ts was in the list of to-avoid "oh I think it was some
 tips and tricks relating to R". at this point, it is recommended to
 rename my ts variable in my code?
 
 thank you
 

-

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


Re: [R] S-PLUS 8 beta program [repost]

2006-03-29 Thread David Smith
The GPL code is available as separately-downloaded packages for S-PLUS, as
has been done for many years. My own Oswald library for S-PLUS was published
under the GPL in 1997, for example, and many other authors produce
open-source libraries for S-PLUS under a variety of licenses.  The only
difference is that they will be packaged as, well, packages rather than
libraries.

# David Smith

-- 
David M Smith <[EMAIL PROTECTED]>
Senior Product Manager, Insightful Corp, Seattle WA
Tel: +1 (206) 802 2360
Fax: +1 (206) 283 6310

Insightful Corporation (www.insightful.com) provides analytical solutions for
text and data using S-PLUS, Insightful Miner, InFact and consulting services.


> -Original Message-
> From: Philippe Grosjean [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, March 29, 2006 1:06 PM
> To: David Smith
> Cc: r-help@stat.math.ethz.ch
> Subject: Re: [R] S-PLUS 8 beta program [repost]
> 
> 
> This is an excellent initiative! But how can you integrate 
> GPL code in a 
> software that is not GPL? As far as I understand it, GPL is a 
> contaminant license, imposing to the whole software to be GPL too (or 
> providing at least similar freedom). I have no doubt that you solved 
> this problem. I am just curious about the solution you found.
> Best regards,
> 
> Philippe Grosjean
> 
> ..<°}))><
>   ) ) ) ) )
> ( ( ( ( (Prof. Philippe Grosjean
>   ) ) ) ) )
> ( ( ( ( (Numerical Ecology of Aquatic Systems
>   ) ) ) ) )   Mons-Hainaut University, Pentagone (3D08)
> ( ( ( ( (Academie Universitaire Wallonie-Bruxelles
>   ) ) ) ) )   8, av du Champ de Mars, 7000 Mons, Belgium
> ( ( ( ( (
>   ) ) ) ) )   phone: + 32.65.37.34.97, fax: + 32.65.37.30.54
> ( ( ( ( (email: [EMAIL PROTECTED]
>   ) ) ) ) )
> ( ( ( ( (web:   http://www.umh.ac.be/~econum
>   ) ) ) ) )  http://www.sciviews.org
> ( ( ( ( (
> ..
> 
> David Smith wrote:
> > [Sorry about the duplicate posting; this one comes from the 
> correct address.
> > Please respond to me with any questions about this -- David.]
> > 
> > Dear R-help readers, 
> > 
> > As Insightful announced at the DSC2005 meeting in 
> Seattle, the next
> > release of S-PLUS will introduce a new package system. Our 
> goal is to provide
> > package authors the means to create cutting-edge statistical methods
> > currently available either as R packages or as S-PLUS 
> library sections and
> > deliver them to the entire community of S-PLUS and R users.
> > 
> > In this release of S-PLUS, we plan to implement many low-level
> > utility functions with the same API as R. Just as many R 
> functions originated
> > in S-PLUS, we plan on re-implementing many R functions in 
> S-PLUS to provide
> > S-PLUS users the ability to create packages of their work 
> and distribute them
> > to others as R users have done for many years. In the 
> future, we expect
> > package authors will be able to create a single package 
> that will run in both
> > environments. The actual package system would be a port of 
> the R package
> > system code, which furthers the exchangeability of S-PLUS 
> and R code. The
> > ported code will be available in a GPL library called Rcompat
> > 
> > To demonstrate that R packages can now be ported to 
> S-PLUS, we have -
> > with the permissions of the authors - ported several R 
> packages to run as
> > S-PLUS packages. We are planning to make these packages 
> available for
> > download from an Insightful-hosted website (called 
> csan.insightful.com for
> > consistency with the CRAN site of R packages). The license 
> terms of the
> > source packages will always be respected, and these 
> packages will all be
> > available under their original open-source license. Any 
> improvements to
> > open-source packages, whether by Insightful or by others, 
> will remain
> > open-source. Our intent will be to grow the list of open-source,
> > cross-system-compatible packages over time. 
> > 
> > While most existing R packages will not run 
> automatically in S-PLUS,
> > with some effort, a user should be able to port an existing 
> R package to an
> > S-PLUS package. More important, by using functions and 
> interfaces now
> > available in both systems, a user should be able to create 
> a single package
> > that will run in both S-PLUS and R in the future. (The 
> judicious use of some
> > system-specific if(is.R()) statement will help to this 
> end.) As a proof of
> > concept, we are developing a package that will run on both 
> systems.  In the
> > future, we hope to post this package on both CSAN and CRAN 
> sites. We are also
> > working to provide S-PLUS library sections from our 
> research group as S-PLUS
> > packages that would also work in R. 
> > 
> > Our work on the S-PLUS package functionality is 
> ongoing. We expect to
> > begin beta testing in April. We invite R package authors 
> who are interested
> 

Re: [R] S-PLUS 8 beta program [repost]

2006-03-29 Thread Philippe Grosjean
David Smith wrote:
> The GPL code is available as separately-downloaded packages for S-PLUS, as
> has been done for many years. My own Oswald library for S-PLUS was published
> under the GPL in 1997, for example, and many other authors produce
> open-source libraries for S-PLUS under a variety of licenses.  The only
> difference is that they will be packaged as, well, packages rather than
> libraries.
> 
> # David Smith

Thank you for the explanation. The fact that GPL code is distributed 
*separately* from S-PLUS is the key point here.

PhG

__
R-help@stat.math.ethz.ch 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] April Course***R/S-plus Fundamentals and Programming Techinques (San Francisco and New York)

2006-03-29 Thread elvis
XLSolutions Corporation (www.xlsolutions-corp.com) is proud to
announce  2-day "R/S-plus Fundamentals and Programming
Techniques" at 2 locations this April
www.xlsolutions-corp.com/Rfund.htm

San Francisco - April 27th-28th, 2006
New York City - April 24th-25th,  2006


Reserve your seat now at the early bird rates! Payment due AFTER
the class

Course Description:

This two-day beginner to intermediate R/S-plus course focuses on a
broad spectrum of topics, from reading raw data to a comparison of R
and S. We will learn the essentials of data manipulation, graphical
visualization and R/S-plus programming. We will explore statistical
data analysis tools,including graphics with data sets. How to enhance
your plots, build your own packages (librairies) and connect via
ODBC,etc.
We will perform some statistical modeling and fit linear regression
models. Participants are encouraged to bring data for interactive
sessions

With the following outline:

- An Overview of R and S
- Data Manipulation and Graphics
- Using Lattice Graphics
- A Comparison of R and S-Plus
- How can R Complement SAS?
- Writing Functions
- Avoiding Loops
- Vectorization
- Statistical Modeling
- Project Management
- Techniques for Effective use of R and S
- Enhancing Plots
- Using High-level Plotting Functions
- Building and Distributing Packages (libraries)
- Connecting; ODBC, Rweb, Orca via sockets and via Rjava

Interested in R/Splus Advanced course? email us.

Email us for group discounts.
Email Sue Turner: [EMAIL PROTECTED]
Phone: 206-686-1578
Visit us: www.xlsolutions-corp.com/training.htm
Please let us know if you and your colleagues are interested in this
classto take advantage of group discount. Register now to secure your
seat!

Interested in R/Splus Advanced course? email us.


Cheers,
Elvis Miller, PhD
Manager Training.
XLSolutions Corporation
206 686 1578
www.xlsolutions-corp.com
[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] calcualtign a trailing 12 column mean in a dataframe?

2006-03-29 Thread r user
I have a dataframe of 25 columns and 100,000 rows
called “testdf”.

I wish to build a new dataframe, with 14 columns and
100,000 rows.

I wish the new dataframe to have the “trailing 12
column” mean.  That is, I want column 1 of the new
dataframe to have soemthing like:

“( mean(testdf[,1:12],na.rm=T)”

What is the best way to accomplish this?

__
R-help@stat.math.ethz.ch 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] S-PLUS 8 beta program [repost]

2006-03-29 Thread Spencer Graves
  Correct:  I'm not an attorney, but I've read the GPL.  It clearly 
says that if you have software that has functionality independent of GPL 
code, the GPL applies to the code you use to connect to GPL code not to 
your original code.  Thus, Insightful would have to make publicly 
available anything special they do to link to GPL code that they can't 
reasonably claim works for other purposes.  However, they are not 
required to reveal other parts of their source code.

  hope this helps,
  spencer graves

Philippe Grosjean wrote:

> David Smith wrote:
> 
>>The GPL code is available as separately-downloaded packages for S-PLUS, as
>>has been done for many years. My own Oswald library for S-PLUS was published
>>under the GPL in 1997, for example, and many other authors produce
>>open-source libraries for S-PLUS under a variety of licenses.  The only
>>difference is that they will be packaged as, well, packages rather than
>>libraries.
>>
>># David Smith
> 
> 
> Thank you for the explanation. The fact that GPL code is distributed 
> *separately* from S-PLUS is the key point here.
> 
> PhG
> 
> __
> R-help@stat.math.ethz.ch 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] Data assimilation / inverse modeling in R

2006-03-29 Thread Lapointe, Pierre
Hello, 

I'm trying to find out if something has been written in R regarding data
assimilation and inverse modeling.

These searches do not return anything that look like Kalman filter
variations (EK, SEEK, ROEK, etc.)

help.search("assimilation")
help.search("inverse model")

Regards,



**
AVIS DE NON-RESPONSABILITE: Ce document transmis par courrie...{{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] Random effects ANOVA?

2006-03-29 Thread Chris Bergstresser
Hi all --

So I have a very simple dataset, which consists of 60 subjects,
who watched one of three videos, drank one of two drinks, and
completed a task.  The response variable is the time to complete the
task.  The ANOVA command is simple enough:  anova(aov(time ~ drink *
video, data = df));

   However, the videos were randomly selected; I need to use the
random effects model for them.  So I tried anova(aov(time ~ drink +
Error(video), data = df));  This gives me a "no applicable method for
'anova'" error.

   The command aov works, but doesn't give me anything I can interpret
effectively.  Is there a simpler command I should be using?  Am I
doing something wrong?

-- Chris

__
R-help@stat.math.ethz.ch 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] which function to use to do classification

2006-03-29 Thread Liaw, Andy
In addition to Brian's comment, Gordon's book, already in 2nd edition, is
all about clustering, but the title is simply `Classification'.

Andy

From: Sean Davis
> 
> We have to be careful here.  Classification (which is the 
> terminology that the original poster used) is NOT the same as 
> clustering, although the two are often confused.  If the 
> original poster wants to do clustering and examine the 
> results for the presence of three clusters, that is fine and 
> there are many methods for clustering that could be used.  
> However, classification will require a different set of 
> tools.  If the clustering tools already pointed out are not 
> doing what is needed (that is, that Cao actually is 
> interested in clustering and not classification), then 
> perhaps a further explanation of what the problem would help clarify.
> 
> Sean
> 
> 
> On 3/29/06 1:46 AM, "Jacques VESLOT" <[EMAIL PROTECTED]> wrote:
> 
> > try this (suppose mat is your matrix):
> > 
> > hc <- hclust(dist(mat,"manhattan"), "ward")
> > plot(hc, hang=-1)
> > (x <- identify(hc)) # rightclick to stop
> > cutree(hc, 3)
> > 
> > km<- kmeans(mat, 3)
> > km$cluster
> > km$centers
> > 
> > pam(daisy(mat, metric = "manhattan"), k=3, diss=T)$clust
> > 
> > 
> > 
> > Baoqiang Cao a écrit :
> > 
> >> Thanks!
> >> I tried kmeans, the results is not very positive. Anyway, thanks 
> >> Jacques! Please let me know if you have any other thoughts!
> >> 
> >> Best regards, 
> >>Baoqiang Cao
> >> 
> >> === At 2006-03-29, 00:08:44 you wrote: ===
> >> 
> >>  
> >> 
> >>> if you want to classify rows or columns, read:
> >>> ?hclust
> >>> ?kmeans
> >>> library(cluster)
> >>> ?pam
> >>> 
> >>> 
> >>> Baoqiang Cao a écrit :
> >>> 
> >>>
> >>> 
>  Dear All,
>  
>  I have a data, suppose it is an N*M matrix data. All I 
> want is to 
>  classify it into, let see, 3 classes. Which method(s) do 
> you think 
>  is(are) appropriate for this purpose? Any reference will be 
>  welcome! Thanks!
>  
>  Best,
>  Baoqiang Cao
>  
>  
>  
>  
> ---
>  -
>  
>  __
>  R-help@stat.math.ethz.ch mailing list 
>  https://stat.ethz.ch/mailman/listinfo/r-help
>  PLEASE do read the posting guide! 
>  http://www.R-project.org/posting-guide.html
>  
>   
>  
> >>> .
> >>>
> >>> 
> >> 
> >> = = = = = = = = = = = = = = = = = = = =
> >> 
> >> Baoqiang Cao
> >> [EMAIL PROTECTED]
> >> 2006-03-29
> >> 
> >> 
> >>  
> >> 
> > 
> > __
> > R-help@stat.math.ethz.ch 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] R for Windows crash on new laptop - corrected script

2006-03-29 Thread Karen Martien
I realized that the script I included in my original post (see below) 
was written for an older version of rmetasim and will not work with the 
current version.  The only change that need be made to get my script to 
run with the latest release of rmetasim is to change the command 
'simulate.landscape()' to 'sim.landscape()'.  My apologies to anyone who 
tried to use my script and ran into problems.
Cheers, Karen


>> -Original Message-
>> From: [EMAIL PROTECTED] [mailto:r-help-
>> [EMAIL PROTECTED] On Behalf Of Karen Martien
>> Sent: Wednesday, March 29, 2006 11:07 AM
>> To: r-help@stat.math.ethz.ch
>> Subject: [R] R for Windows crash on new laptop
>>
>> I'm trying to use a contributed package (rmetasim) to generate simulated
>> genetic datasets.  My scripts work fine when I run them on a Sun
>> workstation running Solaris 7 and when I run them on a ~4 year old
>> laptop PC that I have.  However, when I run them on my new laptop (Dell
>> Latitude D410 purchased in August 2005), the simulation will run for a
>> short (variable) period of time, then R crashes.  When it crashes, I
>> either get an Application Popup that says
>>
>> 'The instruction at "0x5ad71531" referenced memory at "0x0014".  The
>> memory could not be "read".',
>>
>> or I simply get the popup saying that RGUI has experienced a problem,
>> would I like to send a report to Microsoft.  When the latter happens, an
>> event log is generated that says
>>
>> 'Fauling application rgui.exe, version 2.30.37590.0, fauling module
>> ntdll.dll, version 5.1.2600.2180, fault address 0x0001888f.'
>>
>> In both types of errors, the memory addresses listed are different every
>> time a crash occurs.
>>
>> I experience this problem primarily when attempting to simulate large
>> datasets.  My script saves the 'landscape' (the object being simulated)
>> every 100 time steps.  When R crashes, I can start it back up, reload
>> the last landscape saved before the crash, and continue simulating from
>> there.  Thus, there appears to be nothing wrong with the landscapes I'm
>> simulating.
>>
>> I've been in contact with the author of the contributed package I'm
>> using, and he has been unable to find any bugs in the package or
>> reproduce the error.  The bug seems to be platform specific since, as I
>> mentioned, I'm able to run my scripts crash-free on other computers.
>> However, I've tried running my scripts on another computer that is
>> nearly identical to mine (a Dell D610 purchased in August 2005), and
>> experience the same problems on that computer.  I've tried running my
>> scripts from a command window using 'R --vanilla', and experience the
>> same problems.  I've tried using the development version of R
>> (R-2.3.0alpha) and experience the same problems.
>>
>> In reading other bug reports I found that some people have had crashes
>> caused by buggy video drivers.  I've updated my video drivers, but it
>> didn't help.  However, I was only able to upgrade to the newest version
>> of the video driver; I haven't been able to find an alternative driver
>> to work with my display adapter.  The display adapter used by my
>> computer is the mobile Intel 915GM/GMS,910GML Express Chipset.
>>
>> I'm running R 2.2.1 (though I've tried R 2.0.1 and 2.3.0alpha and had
>> the same problem).  The machine on which I've had problems is a Dell
>> Latitude D410 laptop running Windows XP Pro SP2, 2GHz Pentium processor
>> with 1GB of RAM.  The output of the R command 'version' is;
>>
>> platform i386-pc-mingw32
>> arch i386
>> os   mingw32
>> system   i386, mingw32
>> status
>> major2
>> minor2.1
>> year 2005
>> month12
>> day  20
>> svn rev  36812
>> language R
>>
>> The exact sequence of commands I type, after launching the Rgui, is as
>> follows:
>>
>>  >library(rmetasim)
>>  >source("ArchI_burnin_NOdensdep-mod.R")
>>
>> The script I'm running (which obviously requires that the package
>> 'rmetasim' be installed) follows.  Beware that the script takes about 15
>> minutes to run on my old computer (the one on which it doesn't crash.
>> For what it's worth, that computer is a Dell Latitude C400 running
>> Windows XP Pro SP2, 866 MHz Pentium III processor, 512 MB of RAM).  Any
>> suggestions would be greatly appreciated.
>>
>> ##
>> ##
>> #ArchI_burnin_NOdensdep-mod.R#
>>
>> habitats <- 1
>> carrycap <- 7500
>> stages <- 5
>> rland <- NULL
>> numreps <-  2
>> numsteps <- 50
>> stepsize <- 100
>> runlength <- numsteps*stepsize
>>
>> rland <- new.landscape.empty()
>> rland <- new.intparam.land(rland, h = habitats, s = stages, totgen =
>> runlength)
>> rland <- new.switchparam.land(rland, mp = 1)
>> rland <- new.floatparam.land(rland)
>>
>> #life history matrices at zero population density
>> SZ <- matrix (c(0.730, 0, 0, 0, 0,
>>0.210, 0, 0, 0, 0,
>>0, 0.470, 0, 0.946, 0,
>>0, 0, 0.946, 0, 0,
>>0, 0.470, 0, 0, 0.954)

Re: [R] calcualtign a trailing 12 column mean in a dataframe?

2006-03-29 Thread Peter Ehlers
While we wait for others to provide the best way, here's
one way (if I understand your question correctly):

numrows <- 10
x <- rnorm(25 * numrows)
dat <- as.data.frame(matrix(x, nc = 25))
newdat <- as.data.frame(matrix(0, nr = numrows, nc = 14))
for(j in 1:14) newdat[, j] <- rowMeans(dat[, j:(j + 11)], na.rm = TRUE)

Peter Ehlers

r user wrote:

> I have a dataframe of 25 columns and 100,000 rows
> called “testdf”.
> 
> I wish to build a new dataframe, with 14 columns and
> 100,000 rows.
> 
> I wish the new dataframe to have the “trailing 12
> column” mean.  That is, I want column 1 of the new
> dataframe to have soemthing like:
> 
> “( mean(testdf[,1:12],na.rm=T)”
> 
> What is the best way to accomplish this?
> 
> __
> R-help@stat.math.ethz.ch 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] missing value replacement for test data in random forest

2006-03-29 Thread Liaw, Andy
The current randomForest package stores the entire proximity matrix (3 x
3 in your case), which is needed for imputation.  Breiman and Cutler's
Fortran code stores the largest nrnn element of each row.  If you really
want to do it that way, use the Fortran version.

Andy

From: Zhu Ailing
> 
> HI, 
>   I have data set of 3 record with 162 features. when I 
> try to fill out the missing values using rfImpute(), I got 
> kicked out becz:  
> tra.imputed <- rfImpute(tra.na[,-163],tra.na[,163],iter=5,ntree=10)
> Error in matrix(0, n, n) : cannot allocate vector of length 9
>  
> I wonder how to set the parameters(nrnn) for computing the 
> PROXIMITY. thanks iris
> 
>   -Original Message- 
>   From: Zhu Ailing 
>   Sent: Wed 3/29/2006 11:41 AM 
>   To: '[EMAIL PROTECTED]' 
>   Cc: 
>   Subject: missing value replacement for test data in 
> random forest
>   
>   
>   Hi,
>
>   In R, how to do missing value replacement for test data 
> in randome forest in the way Breiman decribed.
>
>   thanks in advance
>
>   iris
> 
> __
> R-help@stat.math.ethz.ch 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] S-PLUS 8 beta program [repost]

2006-03-29 Thread elvis

__
R-help@stat.math.ethz.ch 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] access list component names with lapply

2006-03-29 Thread Thomas Girke
I have a question regarding accessing the names of list
components when applying a function with lapply.

Here is an example that demonstrates what I'd like to do.

I have a list like this one:

mylist <- list(a=letters[1:10], b=letters[10:1], c=letters[1:3])

Now I would like to append the names of the list components to their
corresponding vectors with the c() function. I thought this could
be done like in the following command, but it doesn't:

lapply(mylist, function(x) { c(names(x), x)  } )

I know how to do this in a for loop, but lapply runs so much faster over
large lists.

Any help on this simple problem will be highly appreciated.

Thomas


-- 
Thomas Girke
1008 Noel T. Keen Hall
University of California
Riverside, CA 92521

Ph: 951-827-2469
Fax: 951-827-4437

__
R-help@stat.math.ethz.ch 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] access list component names with lapply

2006-03-29 Thread Gabor Grothendieck
Try this:

lapply(names(mylist), function(nm) c(nm, mylist[[nm]]))

On 3/29/06, Thomas Girke <[EMAIL PROTECTED]> wrote:
> I have a question regarding accessing the names of list
> components when applying a function with lapply.
>
> Here is an example that demonstrates what I'd like to do.
>
> I have a list like this one:
>
>mylist <- list(a=letters[1:10], b=letters[10:1], c=letters[1:3])
>
> Now I would like to append the names of the list components to their
> corresponding vectors with the c() function. I thought this could
> be done like in the following command, but it doesn't:
>
>lapply(mylist, function(x) { c(names(x), x)  } )
>
> I know how to do this in a for loop, but lapply runs so much faster over
> large lists.
>
> Any help on this simple problem will be highly appreciated.
>
> Thomas
>
>
> --
> Thomas Girke
> 1008 Noel T. Keen Hall
> University of California
> Riverside, CA 92521
>
> Ph: 951-827-2469
> Fax: 951-827-4437
>
> __
> R-help@stat.math.ethz.ch 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] predict.glmmPQL Problem

2006-03-29 Thread Spencer Graves
  Please try again after upgrading to the versions of R and MASS.

  If you still have a problem, PLEASE do read the posting guide! 
"www.R-project.org/posting-guide.html" before you submit another post. 
Most of the people who donate their time to answer questions on this 
listserve are more likely to answer a question if it is simple and 
completely self contained -- including a very brief toy example that 
they can copy from an email into R and reproduce the problem.  If they 
can't do that, they are less likely to understand your question and 
therefore less likely to produce a useful answer -- and less likely to 
bother to even read carefully your question.

  hope this helps,
  spencer graves

rsubcriber wrote:

> Dear all,
> 
> for a cross-validation I have to use predict.glmmPQL() , where the 
> formula of
> the corresponding glmmPQL call is not given explicitly, but constructed 
> using as.formula.
> However, this does not work as expected:
> 
> x1<-rnorm(100); x2<-rbinom(100,3,0.5); y<-rpois(100,2)
> mydata<-data.frame(x1,x2,y)
> 
> library(MASS)
> # works as expected
> model1<-glmmPQL(y~x1, ~1 | factor(x2), family=poisson, data=mydata)
> predict(model1, newdata=mydata, type="response")
> 
> f<-as.formula(paste("y", "~","x1"))
> # predict does not work:
> # Error in mCall[["fixed"]][-2] : object is not subsettable
> model2<-glmmPQL(f, ~1 | factor(x2), family=poisson, data=mydata)
> predict(model2, newdata=mydata, type="response")
> 
> Has anyone an idea what goes wrong?
> I am using R 2.0.1 under Windows 2000.
> 
> Thanks,
> Anneke
> 
> __
> R-help@stat.math.ethz.ch 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] How do I report coefficients of categorical fixed effects in a publication?

2006-03-29 Thread Spencer Graves
  Have you read Pinheiro and Bates (2000) Mixed-Effects Models in S and 
S-Plus (Springer)?  The figures and tables in this book should give you 
some ideas that you can adapt to summarizing the results of fits to 
nonnormal data.

  If you've tried this and still have questions for this listserve, 
PLEASE do read the posting guide! "www.R-project.org/posting-guide.html" 
then submit another post after trying some of the things suggested in 
the posting guide.  In particular, if your question includes a 
self-contained example that someone can copy from your email into R and 
try a few things in less than 60 seconds, I believe you will increase 
your chances of getting useful replies quickly.

  hope this helps,
  spencer graves

Tracy Feldman wrote:

> To whom it may concern:
>
>   I recently used lmer (for non-normally distributed data and mixed effects, 
> using the Laplace method).  All 3 of my fixed effects were categorical, 
> including two ordered factors and one unordered factor.  In my tables, I 
> currently report the number of observations for the response variable, and 
> both the degrees of freedom and Chi Square values from tests of reduced 
> models against the full model.
>
>   However, I would also like to include some indication of the magnitude and 
> direction of the change in each fixed effect (and interaction effects) as a 
> function of the response variable.  Is this done with the "estimate +/- SE" 
> of fixed effects in the summary of the fitted model?  Either way, I am 
> confused with how to report these effects succinctly, especially because for 
> categorical variables, each category has its own estimated effect.  What is a 
> reasonable way to do this?  Or should I just avoid it entirely?
>
>   I really appreciate your time and help.  Please reply to [EMAIL PROTECTED] 
> or [EMAIL PROTECTED] 
>
>   Sincerely,
>   Tracy S. Feldman
> 
>   
> -
> 
>   [[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


[R] yaxis for plot(density(...))

2006-03-29 Thread Taka Matzmoto
Hi R users
I have a question for yaxis for plot(density(...)).

plot(density(rnorm(100,.25,0.0701361)),xlim=c(-.5,1),col="red",xlab="",main="")

I expected that yaxis is a probabilty (from 0 to 1) but it wasn't

I got 1 to 5 or 6 on yaxis.

How do I interpret yaxis values ?

Thanks

TM

__
R-help@stat.math.ethz.ch 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] predict.glmmPQL Problem

2006-03-29 Thread Simon Blomberg
I have found a similar problem when constructing formulae and passing 
them to glmmPQL. My solution was to use do.call(glmmPQL,...). See ?do.call.

HTH,

Simon.

pencer Graves wrote:
> Please try again after upgrading to the versions of R and MASS.
>
> If you still have a problem, PLEASE do read the posting guide! 
> "www.R-project.org/posting-guide.html" before you submit another post. 
> Most of the people who donate their time to answer questions on this 
> listserve are more likely to answer a question if it is simple and 
> completely self contained -- including a very brief toy example that 
> they can copy from an email into R and reproduce the problem.  If they 
> can't do that, they are less likely to understand your question and 
> therefore less likely to produce a useful answer -- and less likely to 
> bother to even read carefully your question.
>
> hope this helps,
> spencer graves
>
> rsubcriber wrote:
>
>   
>> Dear all,
>>
>> for a cross-validation I have to use predict.glmmPQL() , where the 
>> formula of
>> the corresponding glmmPQL call is not given explicitly, but constructed 
>> using as.formula.
>> However, this does not work as expected:
>>
>> x1<-rnorm(100); x2<-rbinom(100,3,0.5); y<-rpois(100,2)
>> mydata<-data.frame(x1,x2,y)
>>
>> library(MASS)
>> # works as expected
>> model1<-glmmPQL(y~x1, ~1 | factor(x2), family=poisson, data=mydata)
>> predict(model1, newdata=mydata, type="response")
>>
>> f<-as.formula(paste("y", "~","x1"))
>> # predict does not work:
>> # Error in mCall[["fixed"]][-2] : object is not subsettable
>> model2<-glmmPQL(f, ~1 | factor(x2), family=poisson, data=mydata)
>> predict(model2, newdata=mydata, type="response")
>>
>> Has anyone an idea what goes wrong?
>> I am using R 2.0.1 under Windows 2000.
>>
>> Thanks,
>> Anneke
>>
>> __
>> R-help@stat.math.ethz.ch 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
>
>   


-- 
Simon Blomberg, B.Sc.(Hons.), Ph.D, M.App.Stat.
Centre for Resource and Environmental Studies
The Australian National University
Canberra ACT 0200
Australia
T: +61 2 6125 7800 email: Simon.Blomberg_at_anu.edu.au
F: +61 2 6125 0757
CRICOS Provider # 00120C

__
R-help@stat.math.ethz.ch 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] Can someone please help me understand this? (Was Re: calling R's optimization routines from C)

2006-03-29 Thread Globe Trotter
Dear list,

Can someone please help me here? Is it not possible to use the R library for
optimization and other routines calling from C? 

Thank you!!
AarEm Trotter

--- Globe Trotter <[EMAIL PROTECTED]> wrote:

> Hi,
> 
> I have read R's Writing Extensions manual and am still confused about how to
> use some of the routines there when I call from C. Specifically, I am writing
> a
> little test function which I will optimize using the nmmin function which
> underlies R's optim() with Nelder-Mead. I guess I wonder what library/header
> files I should be using. I was using R_ext/Applic.h and linking with libR but
> I
> can not get it to work. (Btw, I am using RHEL4/FC4 Linux).
> 
> The function is very simple: all it does is calculate the sum of squared
> differences from a parameter, so the minimizer will be the mean.
> 
> Actually, here is my code:
> 
> #include
> #include
> 
> #include 
> 
> typedef struct {
> double *X;
> int n;
> } MyData;
> 
> double myfunc(int m, double *par, void *ex)
> {
> MyData *mydata = ex;
> double *X = mydata->X;
> int n = mydata->n;
> double mu = par[0];
> double sum = 0.0;
> int i;
> 
> for (i=0; i   double t = X[i] - mu;
>  sum += t*t;
> }
> return sum;
> }
> 
> int main(void)
> {
>   int i,n=1, trace=1, maxit=100, fail, fncount;
>   double *par, abstol=0.0001, intol=.0001, alpha=1, beta=.5, gamma=2, *xin,
> *x,
> 
> Fmin; 
> 
>   MyData ex;
> 
>   par=malloc(n*sizeof(double));
>   xin=malloc(n*sizeof(double));
>   x=malloc(n*sizeof(double));
> 
>   par[0]=5;
>   xin[0]=5;
> 
>   ex.n=5;
> 
>   ex.X=malloc(ex.n*sizeof(double));
> 
>   for(i=0;i 
>   nmmin(n,xin,x,&Fmin,myfunc,&fail,abstol,intol,&ex,alpha,
> beta,gamma,trace,&fncount,maxit);
>   free(par);
>   free(x);
>   free(xin);
>   free(ex.X);
>   return 0;
> }
> 
> 
> I compile using the following:
> 
> gcc -o testex testex.c -std=c99 -Wall -pedantic -I/usr/lib/R/include
> -L/usr/lib/R/lib -lm -lR
> 
> Which actually compiles without error, but I get Segmentation fault when I
> run
> it.
> 
> Clearly, I am doing something wrong. Can someone please provide suggestions? 
> 
> Many thanks and best wishes,
> Aaarem
> 
> __
> R-help@stat.math.ethz.ch 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] yaxis for plot(density(...))

2006-03-29 Thread Gabor Grothendieck
Probabilities can't be greater than 1 but densities can.

On 3/29/06, Taka Matzmoto <[EMAIL PROTECTED]> wrote:
> Hi R users
> I have a question for yaxis for plot(density(...)).
>
> plot(density(rnorm(100,.25,0.0701361)),xlim=c(-.5,1),col="red",xlab="",main="")
>
> I expected that yaxis is a probabilty (from 0 to 1) but it wasn't
>
> I got 1 to 5 or 6 on yaxis.
>
> How do I interpret yaxis values ?
>
> Thanks
>
> TM
>
> __
> R-help@stat.math.ethz.ch 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] new to the list - problems with non-solid lines in eps export - problem fixed!

2006-03-29 Thread Gregor Volberg
Hi Uwe,

thanks for the reply! I used postscript() instead of dev.copy2eps(), but the 
problem remained; furthermore, its the same on the screen and in a physical 
print. 
After some more testing, I figured out that I can produce the desired output 
if I do not use the pre-defined  line type "dotted", as in 

lines(LL[1:251], type="l", lwd=1, lty="dotted"),

but rather define an own line type as in 

lines(LL[1:251], type="l", lwd=1, lty="11").

With this, dotted lines in the eps output look nice. 
So, thanks again for your help,
Gregor


Am Sonntag, 26. März 2006 15:16 schrieb Uwe Ligges:
> Gregor Volberg wrote:
> > Dear all,
> > I am new to this list and, unfortunately, could not provide help to
> > anyone as yet. I hope I can do so in the future, though! Until then, I am
> > grateful for helpful hints from you more experienced users.
> >
> > For use in an upcoming publication, I generated an eps figure from  my
> > x11 window under Debian Linux with dev.copy2eps. It contains 28 line
> > plots with 2 lines each, one solid and one dotted (they show
> > event-related brain potentials in two different conditions, if this is of
> > interest for someone). The plots are arranged in a window with width=5
> > inch and height = 6 inch, so single plots are quite small.
> > Now the problem: When I include the file in Latex or other word
> > processing programs, the dotted line is almost unreadable. The whole
> > waveform consists of, say, 20 dots, which hardly form a curve. The same
> > problem occurs under MS Windows with dev.copy2eps(). However, when I
> > directly plot the device under Windows, the dotted lines are nice. Thus,
> > the problem is presumably special to eps "export".
> > I know that I could do an easy workaround by using thick/thin lines or
> > black/grey ones, but publication offices say that such lines are hard to
> > distinguish for the reader in the final print version. Also, I searched
> > this list for  something like "high resolution plots", but I learend that
> > eps as a vector format does not have a fixed resolution (and thus no
> > option to make ist "higher"). Plotting the figure to another device (png,
> > bmp) reveals  the expected curves, but bitmaps are often not accepted.
> > Does anyone have a hint, or does anyone have the same problem? Thank you
> > in advance for your help!
>
> 1. Use postscript() directly rather than the way through dev.copy2eps()
> (which should work as well, but let us exclude it for further reference).
>
> 2. Print the resulting postscript physically rather than looking at it
> on the screen. Omitting some points might be caused by some settings of
> your postscript viewer.
>
> Uwe Ligges
>
> > Gregor
> >
> >
> > P.S.: The dotted lines are not fuzzy, but "stretched" in the way that the
> > point are to far away from each other to appear continuos. The same is
> > with other non-solid lines (dashed etc).

-- 
Dr. rer. nat. Gregor Volberg <[EMAIL PROTECTED]>
Institute for Experimental Psychology
University of Regensburg
Universitätsstraße 31
D-93053 Regensburg
Germany
Tel: +49 941 943 3862 
Fax: +49 941 943 3233
http://www.psychologie.uni-regensburg.de/Greenlee/team/volberg/volberg.html


pgpWlIkKOMOWG.pgp
Description: PGP signature
__
R-help@stat.math.ethz.ch 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] Question about for loop?

2006-03-29 Thread Andris Jankevics
Hello useRs,

I can't figure out how can I store a data frame of values of X and D  from 
this loop:

Z <- c(1:10)

for (i in 1:(length(Z)-2)) 
{D <- x[1:(2+i)]; 
X <- paste("x",sep="",i)
print (X)
print (D)
}


Thank You,

Andris Jankevics

__
R-help@stat.math.ethz.ch 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] Plotting a segmented function

2006-03-29 Thread Jacob van Wyk
This might be a trivial question, but I would appreciate if anybody
could suggest an elegant way of plotting a function such as the
following (a simple distribution function):
F(x) = 0 if x<=0
   =(x^2)/2 if 02
This is just an example. In this case it is a continuous function. But
how to do it in general in an elegant way.
I've done the following:
x1 <- seq(-1,0,.01)
f1 <- rep(0,101)
x2 <- seq(0,1,.01)
f2 <- 0.5*(x2^2)
x3 <- seq(1,2,.01)
f3 <- (2*x3)-(0.5*(x3^2))-1
x4 <- seq(2,3,.01)
f4 <- rep(1,101)
x <- c(x1,x2,x3,x4)
F <- c(f1,f2,f3,f4)
plot(x,F,type='l')

But this seems very cumbersome.
Any help is much appreciated.

Thanks
Jacob


Jacob L van Wyk
Department of Statistics
University of Johannesburg APK
P O Box 524
Auckland Park 2006
South Africa
Tel: +27-11-489-3080
Fax: +27-11-489-2832

__
R-help@stat.math.ethz.ch 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] Plotting a segmented function

2006-03-29 Thread Uwe Ligges
Jacob van Wyk wrote:

> This might be a trivial question, but I would appreciate if anybody
> could suggest an elegant way of plotting a function such as the
> following (a simple distribution function):
> F(x) = 0 if x<=0
>=(x^2)/2 if 0=2x-((x^2)/2)-1 if 1=1 if x>2
> This is just an example. In this case it is a continuous function. But
> how to do it in general in an elegant way.
> I've done the following:
> x1 <- seq(-1,0,.01)
> f1 <- rep(0,101)
> x2 <- seq(0,1,.01)
> f2 <- 0.5*(x2^2)
> x3 <- seq(1,2,.01)
> f3 <- (2*x3)-(0.5*(x3^2))-1
> x4 <- seq(2,3,.01)
> f4 <- rep(1,101)
> x <- c(x1,x2,x3,x4)
> F <- c(f1,f2,f3,f4)
> plot(x,F,type='l')
> 
> But this seems very cumbersome.
> Any help is much appreciated.


Define a function such as

f <- function(x){

 (x>2) +
 (2*x-((x^2)/2)-1) * ((1 < x) & (x <= 2)) +
 ((x^2)/2) *  ((0 < x) & (x <= 1))
}

curve(f, from = -1, to = 3)


> Thanks
> Jacob
> 
> 
> Jacob L van Wyk
> Department of Statistics
> University of Johannesburg APK
> P O Box 524
> Auckland Park 2006
> South Africa
> Tel: +27-11-489-3080
> Fax: +27-11-489-2832
> 
> __
> R-help@stat.math.ethz.ch 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] conflicts Var names

2006-03-29 Thread Uwe Ligges
Fred J. wrote:

>   Dear R users
>  
>  I have read somewhere which I don't remember that some variable names
>  are not to be used for conflict avoidance. and those were (c, q, T, F,
>  T)
>  I ran this
>  > conflicts(detail=TRUE)
>  $.GlobalEnv
>  [1] "ts"
>  
>  $"package:methods"
>  [1] "body<-"
>  
>  $"package:stats"
>  [1] "ts"
>  
>  $"package:base"
>  [1] "body<-"
>  
>  I don't note ts was in the list of to-avoid "oh I think it was some
>  tips and tricks relating to R". at this point, it is recommended to
>  rename my ts variable in my code?


Well, it is nice to avoid such names, but since R distinguishes 
functions vs. data, you can live with it if you are aware of the problem.

Uwe Ligges



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


[R] Plotting a segmented function

2006-03-29 Thread Ken Knoblauch
You could try nested ifelse statements,

something like (untested)

x <- seq(-1, 3, 0.1)
 y <- ifelse( x <= 3,
ifelse( x <= 2,
ifelse( x <= 1,
ifelse( x <= 0, 0, x^2/2), 2 * x - (x^2/2) -1),  1) )
plot(x, y)

**
This might be a trivial question, but I would appreciate if anybody
could suggest an elegant way of plotting a function such as the
following (a simple distribution function):
F(x) = 0 if x<=0
   =(x^2)/2 if 02
This is just an example. In this case it is a continuous function. But
how to do it in general in an elegant way.
I've done the following:
x1 <- seq(-1,0,.01)
f1 <- rep(0,101)
x2 <- seq(0,1,.01)
f2 <- 0.5*(x2^2)
x3 <- seq(1,2,.01)
f3 <- (2*x3)-(0.5*(x3^2))-1
x4 <- seq(2,3,.01)
f4 <- rep(1,101)
x <- c(x1,x2,x3,x4)
F <- c(f1,f2,f3,f4)
plot(x,F,type='l')

But this seems very cumbersome.
Any help is much appreciated.

Thanks
Jacob


-- 
Ken Knoblauch
Inserm U371
Cerveau et Vision
Dept. of Cognitive Neuroscience
18 avenue du Doyen Lépine
69500 Bron
France
tel: +33 (0)4 72 91 34 77
fax: +33 (0)4 72 91 34 61
portable: +33 (0)6 84 10 64 10
http://www.lyon.inserm.fr/371/

__
R-help@stat.math.ethz.ch 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 for loop?

2006-03-29 Thread Uwe Ligges
Andris Jankevics wrote:

> Hello useRs,
> 
> I can't figure out how can I store a data frame of values of X and D  from 
> this loop:
> 
> Z <- c(1:10)
> 
> for (i in 1:(length(Z)-2)) 
>   {D <- x[1:(2+i)]; 
>   X <- paste("x",sep="",i)
>   print (X)
>   print (D)
>   }


Assign them as elements of a list, for example.
For further reference what a list is:

 > PLEASE do read the posting guide! 
http://www.R-project.org/posting-guide.html


Uwe Ligges


> 
> Thank You,
> 
> Andris Jankevics
> 
> __
> R-help@stat.math.ethz.ch 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] Random effects ANOVA?

2006-03-29 Thread Prof Brian Ripley
I think you want print or summary rather than anova.  anova() is not very 
useful for aov() models even without error strata.  The point of the aov 
classes is that they present the results of lm() fits in ways which are 
more conventional for designed experiments, including giving conventional 
ANOVA tables without recourse to anova().

I didn't follow how the videos were chosen.  Random effects apply when the 
'treatments' were chosen from a large population (which might apply if 
each subject watched (on separate occasions) three videos chosen randomly 
from a larger pool), and if the interest is in the variability of the 
response over videos in the pool.  If subjects were observed more than 
once then I suspect you most likely want a random effect for subjects.

What I guess is more likely is that you have 60 measurements on 60 
subjects, each of whom was assigned one video and one drink.  Then there 
appear to be no random effects, and the problem caused by randomly 
selecting videos is that the experiment is likely to be unbalanced (since 
each video is not going to be selected 20 times by chance).  aov() is 
primarily intended for balanced designs, and interpretation is tricky 
without balance (see the warnings on its help page).

There are many loose ends hindering offering help by email, and the best 
advice is to consult a statistician face-to-face about an appropriate 
analysis.


On Wed, 29 Mar 2006, Chris Bergstresser wrote:

> Hi all --
>
>So I have a very simple dataset, which consists of 60 subjects,
> who watched one of three videos, drank one of two drinks, and
> completed a task.  The response variable is the time to complete the
> task.  The ANOVA command is simple enough:  anova(aov(time ~ drink *
> video, data = df));
>
>   However, the videos were randomly selected; I need to use the
> random effects model for them.  So I tried anova(aov(time ~ drink +
> Error(video), data = df));  This gives me a "no applicable method for
> 'anova'" error.
>
>   The command aov works, but doesn't give me anything I can interpret
> effectively.  Is there a simpler command I should be using?  Am I
> doing something wrong?
>
> -- Chris

-- 
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] symbols plot

2006-03-29 Thread Joerg van den Hoff
before getting scolded for submitting a (non-)bug report:

when using the 'symbols' function for plotting boxplot data (i.e. using 
'boxplots' symbols), I noted that the x/y-position of the symbols is 
associated with the center of the box.

while this is obviously natural for a usual plotting symbol (say a 
circle or a rectangle), it is probably not desired if one uses the 
'boxplots' symbols: looking at such a plot, probably everyone will 
assume that y-position is that of the median within the box (in other 
words: that one can read off the values of the medians from the y-axis).

the current behaviour is counter-intuitive, I believe, if the 
distributions are asymmetrical (and the median is not centered in it's 
box). (I even think, that such plots are misinterpreted easily: think 
what happens if the median lies very near one of the hinges in one box 
and is centered in another one within the same plot and the medians are 
actually the same)

in short: I think the 'boxplots' should not be centered at the specified 
y-coordinates but rather drawn with a y-coordinate of

y + bxh * (0.5 - bxm)

where bxh and bxm are the second and fifths column of the 'boxplots' 
matrix. in this way, the median position is identical to the specified 
y-coordinate.

at the very least, I think, the manpage should explicitely state that 
all symbols (including boxplots) are positioned with their geometrical 
center at the specified coordinates.

right or wrong?

regards,

joerg

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