Re: [R] How to unload a package or undo library(package)

2006-01-09 Thread Prof Brian Ripley
See the rw-FAQ, Q4.8

On Mon, 9 Jan 2006, Ales Ziberna wrote:

 If I do  detach(package:blockmodeling)

 My package blockmodeling does not appear in (.packages())
 [1] methods   stats graphics  grDevices utils datasets
 [7] base

 However, if I want to install a newer version from a local zip file, I get:
 utils:::menuInstallLocal()
 package 'blockmodeling' successfully unpacked and MD5 sums checked
 Error: cannot remove prior installation of package 'blockmodeling'


 Is there any way around that?

 Best,
 Ales Ziberna

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of Gabor Grothendieck
 Sent: Sunday, January 08, 2006 10:42 PM
 To: Alea }iberna
 Cc: r-help@stat.math.ethz.ch
 Subject: Re: [R] How to unload a package or undo library(package)

 Here are some things to try:

 detach() - detach most recent attached package
 detach(2) - detach package which is in position 2 on search list.
 Same as detach()
 detach(package:mypackage) - mypackage from search list
 search() - display search list

 On 1/8/06, Alea }iberna [EMAIL PROTECTED] wrote:
 Hello!

 I would like to unload a package form a current R session. I tried
 datach(package:packagename), however it does not work. The reason I
 want to unload it is that I want to correct some files in the package
 and reinstall it without closing an R session.

 Best,
 Ales Ziberna

 PS: I am using R 2.1.1 on Windows XP

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


-- 
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] paste tab and print

2006-01-09 Thread Prof Brian Ripley
On Mon, 9 Jan 2006 [EMAIL PROTECTED] wrote:

 Dear all,

 info = paste('a', 'b', sep='\t')
 print(info , quote=F)

 doesn't produce the same result with R201 and R220
 (under Windows2000)

(There are no such versions of R, and neither is current.)

 R 2.0.1 : [1] a   b
 R 2.2.0 : [1] a\tb

 I did read the CHANGESR220 file

Did you mean CHANGES?  That is for Windows-specific changes.  You 
meed to look in the NEWS file.

 and tried also the search engine but couldn't find an answer. I 
 certainly missed the point, and apologize about that.

 So if somebody could tell me how to insert a tab inside
 strings under R.2.2.0., it would be very kind.

You have.  A tab inside a string is printed as \t (see ?print.default).
However,  cat will show you the effect

 info = paste('a', 'b', sep='\t')
 print(info)
[1] a\tb
 cat(info, \n)
a   b

(if this survives emailing, or try it yourself).


-- 
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] Missing value representation in Excel before extraction to R with RODBC

2006-01-09 Thread Prof Brian Ripley
On Mon, 9 Jan 2006, Petr Pikal wrote:

 Hi

 I believe it has something to do with the column identification
 decision. When R decides what is in a column it uses only some values
 from the beginning of a file.

Not R, Excel.  Excel tells ODBC what the column types are.

 I do not use RODBC as read.delim(clipboard, ...) is usually more
 convenient but probably there is a way how to tell RODBC what is in
 the column instead of let R decide from the top of the file.

Using as.is=TRUE stops RODBC doing any conversion.

 But I may be completely mistaken.

 HTH
 Petr


 On 6 Jan 2006 at 20:47, Fredrik Lundgren wrote:

 From: Fredrik Lundgren [EMAIL PROTECTED]
 To:   R-help r-help@stat.math.ethz.ch
 Date sent:Fri, 6 Jan 2006 20:47:29 +0100
 Subject:  [R] Missing value representation in Excel before 
 extraction to R
   with RODBC

 Dear list,

 How should missing values be expressed in Excel before extraction to R
 via RODBC. I'm bewildered. Sometimes the representation with NA in
 Excel appears to work and shows up in R as NA but sometimes the use
 of NA in Excel changes the whole vector to NA's. Blank or nothing or
 NA as representation for missing values in Excel with dateformat gives
 NA's of the whole vector in R but with  general format in Excel gives
 blanks for missing values in R. How should I represent missing values
 in Excel?


 Best wishes and thanks for any help
 Fredrik Lundgren

-- 
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] [R-pkgs] sudoku

2006-01-09 Thread Martin Maechler
First, thanks a lot! to David Brahms for finally tackling this
important problem, and keeping the R language major league ! 
;-) :-)  {but the thanks! is meant seriously!}

 Detlef == Detlef Steuer [EMAIL PROTECTED]
 on Sun, 8 Jan 2006 12:21:52 +0100 writes:

Detlef Hey, you spoiled my course!  :-)

Detlef I planned using this as an excersise.  Alternative
Detlef ideas anyone ...

Well, you could *add* to it:

1) When I have been thinking about doing this myself (occasionally
  in the past weeks), I had always thought that finding *ALL*
  solutions was a very important property of the algorithm I would
  want to design.
  (since this is slightly more general and useful than proofing
  uniqueness which the current algorithm does not yet do anyway).

2) The current sudoku() prints the result itself and returns a
   matrix; improved, it should return an object of class sudoku,
   with a print() and a plot() method;
3) The plot() method should of course also work for unfinished
   sudoku objects, and in fact, the *input* to sudoku() should
   also be allowed to be a (typically unfinished) sudoku object.

4) Then you could have your students use grid and
   grid.locator() for GUI *input* of a sudoku; i.e. you'd have
   another function which returns a (typically unfinished)
   sudoku object.

5) You could start looking at *solving* the more general sudokus
   where the blocks are not 3x3 squares anymore, but more
   general rectangular polygons of 9 squares each.

6) Now you need to refine the GUI from 4) because your users
   need to be able to *draw* the block shapes for the
   generalized sudokus.

7) Given 1) is solved, the problem of *generating* sudokus,
   that David already mentioned in his announcement, becomes
   more relevant: You want to be sure that the sudokus you
   generate have exactly one solution.  And your generating
   algorithm could start with a very full sudoku (that has
   exactly 1 solution) and erases squares as much as possible,
   always checking that no other solution becomes possible.

You see, there's lot of interesting exercises left for your
course. (;-)

Martin

Detlef On Fri, 6 Jan 2006 11:43:44 -0500 Brahm, David
Detlef [EMAIL PROTECTED] wrote:

 Any doubts about R's big-league status should be put to
 rest, now that we have a Sudoku Puzzle Solver.  Take
 that, SAS!  See package sudoku on CRAN.
 
 The package could really use a puzzle generator --
 contributors are welcome!
 
 -- David Brahm ([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] How to unload a package or undo library(package)

2006-01-09 Thread Ales Ziberna
Thank you!

I guess it can not be done!


Best,
Ales Ziberna

-Original Message-
From: Prof Brian Ripley [mailto:[EMAIL PROTECTED] 
Sent: Monday, January 09, 2006 9:19 AM
To: Ales Ziberna
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] How to unload a package or undo library(package)

See the rw-FAQ, Q4.8

On Mon, 9 Jan 2006, Ales Ziberna wrote:

 If I do  detach(package:blockmodeling)

 My package blockmodeling does not appear in (.packages())
 [1] methods   stats graphics  grDevices utils datasets
 [7] base

 However, if I want to install a newer version from a local zip file, I
get:
 utils:::menuInstallLocal()
 package 'blockmodeling' successfully unpacked and MD5 sums checked
 Error: cannot remove prior installation of package 'blockmodeling'


 Is there any way around that?

 Best,
 Ales Ziberna

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Gabor 
 Grothendieck
 Sent: Sunday, January 08, 2006 10:42 PM
 To: Alea }iberna
 Cc: r-help@stat.math.ethz.ch
 Subject: Re: [R] How to unload a package or undo library(package)

 Here are some things to try:

 detach() - detach most recent attached package
 detach(2) - detach package which is in position 2 on search list.
 Same as detach()
 detach(package:mypackage) - mypackage from search list
 search() - display search list

 On 1/8/06, Alea }iberna [EMAIL PROTECTED] wrote:
 Hello!

 I would like to unload a package form a current R session. I tried 
 datach(package:packagename), however it does not work. The reason I 
 want to unload it is that I want to correct some files in the package 
 and reinstall it without closing an R session.

 Best,
 Ales Ziberna

 PS: I am using R 2.1.1 on Windows XP

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


-- 
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] How to restore workspace from .RDataTmp?

2006-01-09 Thread Helene Wagner
Can I restore a workspace from .RDataTmp (under Windows), and how should I 
do this? Whenever I try, I get the messages Error in load(name, envir = 
.GlobalEnv) : error reading from connection (in the R command window) 
and/or Fatal error: unable to restore saved data in .RData (Windows). I 
was not able to find any documentation of this.

Any help is appreciated.
Helene




PD Dr. Helene Wagner
Senior scientist
Swiss Federal Research Institute WSL
Zuercherstrasse 111
CH-8903 Birmensdorf

Phone:  +41-44-739 25 87
Fax:+41-44-739 22 15
Email:  [EMAIL PROTECTED]
http://www.wsl.ch/staff/helene.wagner/

__
R-help@stat.math.ethz.ch 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] need palette of topographic colors similar to topo.colors()

2006-01-09 Thread David Ruau
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

have a look at http://colorbrewer.org/
and install the package RColorBrewer

David

On Jan 7, 2006, at 20:34, bogdan romocea wrote:

 Dear useRs,

 I got stuck trying to generate a palette of topographic colors that
 would satisfy these two requirements:
- the pallete must be 'anchored' at 0 (just like on a map), with
 light blue/lawn green corresponding to data values close to 0 (dark
 blue to light blue for negative values, green-yellow-brown for
 positive values)
- the brown must get darker for higher positive values.

 topo.colors() fails both requirements and AFAICS lacks any options to
 control its behavior.
   #---unsatisfactory topo.colors() behavior
   topoclr - function(tgt)
   {
   clr - topo.colors(length(tgt))
   clr - clr[round(rank(tgt),0)]
   plot(tgt,pch=15,col=clr)
   }
   par(mfrow=c(2,1)) ; topoclr(-50:50) ; topoclr(-20:80)

 An acceptable solution would be something like this
   grayclr - function(tgt)
   {
   tgt - sort(tgt) ; neg - which(tgt  0)
   clrneg - gray(0:length(tgt[neg])/length(tgt[neg]))
   clrpos - gray(length(tgt[-neg]):0/length(tgt[-neg]))
   clr - c(clrneg,clrpos)
   plot(tgt,pch=15,col=clr)
   }
   par(mfrow=c(2,1)) ; grayclr(-50:50) ; grayclr(-20:80)
 if only I could make gray() use blue/brown instead of black (I tried a
 couple of things but got stuck again).

 Any suggestions?

 Thank you,
 b.

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

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (Darwin)

iD8DBQFDwjXx7EoGVUIQyhERAq/0AKCPKQjlqtVl+RxVlOVlGXf2WxnvSwCfdZcD
mEpL3eSW8KI+eYFSSQZJvzM=
=/5Ix
-END 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


Re: [R] How to restore workspace from .RDataTmp?

2006-01-09 Thread Petr Pikal
Hi

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

There is not much to do in such a case. Maybe only to use some binary 
editor.

Recommendation: do not use .Rdata file for storing data

Cheers
Petr

On 9 Jan 2006 at 10:26, Helene Wagner wrote:

Date sent:  Mon, 09 Jan 2006 10:26:50 +0100
To: r-help@stat.math.ethz.ch
From:   Helene Wagner [EMAIL PROTECTED]
Subject:[R] How to restore workspace from .RDataTmp?

 Can I restore a workspace from .RDataTmp (under Windows), and how
 should I do this? Whenever I try, I get the messages Error in
 load(name, envir = .GlobalEnv) : error reading from connection (in
 the R command window) and/or Fatal error: unable to restore saved
 data in .RData (Windows). I was not able to find any documentation of
 this.
 
 Any help is appreciated.
 Helene
 
 
 
 
 PD Dr. Helene Wagner
 Senior scientist
 Swiss Federal Research Institute WSL
 Zuercherstrasse 111
 CH-8903 Birmensdorf
 
 Phone:  +41-44-739 25 87
 Fax:+41-44-739 22 15
 Email:  [EMAIL PROTECTED]
 http://www.wsl.ch/staff/helene.wagner/
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide!
 http://www.R-project.org/posting-guide.html

Petr Pikal
[EMAIL PROTECTED]

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


Re: [R] repeat { readline() }

2006-01-09 Thread justin bem

--- Henrik Bengtsson [EMAIL PROTECTED] a écrit :

 Hi.
 
 Using Rterm v2.2.1 on WinXP, is there a way to
 interrupt a call like
 
   repeat { readline() }
 
 without killing the Command window?  Ctrl+C is not
 interrupting the loop:

To interupt the loop add and condition for a break
like this :
if () break



 
 R : Copyright 2006, The R Foundation for Statistical
 Computing
 Version 2.2.1 Patched (2006-01-01 r36947)
 snip/snip
 
   repeat { readline() }
 ^C
 ^C
 ^C
 ^C
 
 On Unix it works.  The problem seems to get the
 interrupt signal to 
 occur outside the readline() call so that repeat
 is interrupted. Doing
 
 repeat { readline(); Sys.sleep(3) }
 
 and it is likely that can generate an interrupt
 signal outside readline().
 
 It seem like readline()/readLines(n=1) or an
 underlying method catches 
 the interrupt signal quietly and just waits for a
 symbol to come 
 through.  Try readline() by itself and press Ctrl+C.
  Maybe this is a 
 property of the Windows Command terminal, I don't
 know, but is it a 
 wanted feature and are R core aware of it?  Note
 that, in Rgui it is 
 possible to interrupting such a loop by pressing
 ESC.
 
 Cheers
 
 Henrik
 
 __
 R-help@stat.math.ethz.ch 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] Wikis for R

2006-01-09 Thread Drew
Frank uses the term hierarchical keyword
organization which I agree is a good way to organize
a system designed to help users. In fact, this is one
reason why I like the R graphics gallery which allows
one to quickly find a particular type of plot based on
keyword, examine the plot to see if it's close to
what's desired, and then get the detailed code to
examine or modify for one's own specific purpose. It's
an example of going from general concept to specific
details. 

R's HTML help pages already have a keyword system but
it takes you to the specifics too quickly. I'd
recommend revising the current keyword system in the
help pages (or adding to it) to create what Frank
calls data manipulation examples gallery. In other
words a code gallery that users could browse quickly
and simply copy and paste code from it to their
application. Think of the keywords as different How
to topics (e.g. how to create a data frame, how to
reshape data, etc.). 

** I think this sort of thing would save time for
users of all levels.**  New users could find code
quickly WITHOUT submitting a request to R-HELP email
list. Advanced, experts, and gurus would no longer
have to respond to such requests for the umpteenth
time. Think of this as the examples that did not make
it to the help files. Because it's a wiki folks could
add to it the examples that are truly helpful.

Creating such a system requires 3 steps (at a very
high level):

1) ** Develop a hierarchical keyword system **
Combine the current keyword system
(http://finzi.psych.upenn.edu/R/doc/html/search/SearchEngine.html)
with something more like the left-hand frame of the
function finder
(http://biostat.mc.vanderbilt.edu/s/finder/finder.html).
Essentially a list of keywords organized by how to do
X in R. Users could browse this list and click on a
how to topic to get to more specific keyworks or see
the code gallery for that particular keyword. Once
this list of keywords gets generated then it would
would remain mostly static over time. If changes are
required then have the site maintainer add the word,
but the keyword list is not open to public revision.


2)  ** Add code as content for each keyword. **
Without quality and quantity of content, this proposed
system is not worth much. No one will use it without
content -- I don't care what fancy tool we use to
create or manage such a thing. I suspect that much of
the code to start this gallery could come from R tips
(http://www.ku.edu/~pauljohn/R/Rtips.html). After
amassing a good size collection of code, allow the
public to start adding to the code (but not the
keywords identified in #1 above.)


3)  ** Link 1 and 2 above, which are on the wiki, with
the existing help files that get installed with R **. 
So when a user chooses HTML Help from the Help menu
(in the windows version of R, for example) he/she
would see an additional clickable link that says
something like How To. Clicking on this would take
the user to the list of keywords for the code gallery
on the online wiki. This is their starting point. From
here the user would click on appropriate keywords to
browse the code gallery. The code itself could be
clickable to bring up the very detailed help pages
much like the R Graphics Gallery does (for example
clicking on the green color rnorm in the first graph
in the Graphics Gallery takes me to the following
hyperlinked help page:
http://addictedtor.free.fr/graphiques/help/index.html?pack=statsalias=rnormfun=Normal.html).


I'm wondering how much of the above could be done
without requiring much work from the R CORE team? I'd
recommend a small group of individuals (10 - 20 or so)
to start getting the content together since that may
be the most time intensive part. (You can't expect 1
person to do it all, and 1000's of people won't make
much progress.) I can lend a few hours per month if
there was a cadre of dedicated individuals who are
passionate about making this happen. However, I have
very few programming skills, almost none outside of R,
of which I'm a relative beginner.

This is the vision I have for the wiki. What do others
think?

~Nick


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of
Frank E Harrell Jr
Sent: Saturday, January 07, 2006 6:05 AM
To: Detlef Steuer
Cc: r-help@stat.math.ethz.ch; [EMAIL PROTECTED];
[EMAIL PROTECTED]
Subject: Re: [R] Wikis for R


Detlef Steuer wrote:
 On Thu, 5 Jan 2006 11:23:04 -0200
 Fernando Henrique Ferraz P. da Rosa
[EMAIL PROTECTED] wrote:
 
 
Martin Maechler writes:

 If you go to the bottom of that wikipedia page,
 you see that there is an R Wiki -- and has been
for several
 years now (!) at a Hamburg (De) university.

http://fawn.unibw-hamburg.de/cgi-bin/Rwiki.pl?RwikiHome

(...) 
So, are you sure that another R Wiki is desirable,
rather than
have people who believe in Wiki's for R use the
existing
one(s)?   I believe the main challenge will
(similar as for
an R-beginners mailing list) to have
well-qualified editors
to be willing to 

[R] (no subject)

2006-01-09 Thread Erin Hodgess
Dear R People:

I am trying to build a package (yet again!)

I have both PCTex and WinEdt.  I want the *.tex files to use WinEdt.  How
should I set that, please?  Just in the path?

Also, where would I get Rd.sty, please?

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

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


Re: [R] Suggestion for big files [was: Re: A comment about R:]

2006-01-09 Thread François Pinard
[hadley wickham]

[François Pinard]

 Selecting a sample is easy.  Yet, I'm not aware of any SQL device for
 easily selecting a _random_ sample of the records of a given table.
 On the other hand, I'm no SQL specialist, others might know better.

There are a number of such devices, which tend to be rather SQL variant
specific.  Try googling for select random rows mysql, select random
rows pgsql, etc.

Thanks as well for these hints.  Googling around as your suggested (yet 
keeping my eyes in the MySQL direction, because this is what we use), 
getting MySQL itself to do the selection is a bit discouraging, as 
according to comments I've read, MySQL does not seem to scale well with 
the database size according to the comments I've read, especially when 
records have to be decorated with random numbers and later sorted.

Yet, I did not drive any benchmark myself, and would not blindly take 
everything I read for granted, given that MySQL developers have speed in 
mind, and there are ways to interrupt a sort before running it to full 
completion, when only a few sorted records are wanted.

Another possibility is to generate a large table of randomly
distributed ids and then use that (with randomly generated limits) to
select the appropriate number of records.

I'm not sure I understand your idea (what mixes me in the randomly 
generated limits part).  If the large table is much larger than the 
size of the wanted sample, we might not be gaining much.

Just for fun: here, sample(1, 10) in R is slowish already :-).

All in all, if I ever have such a problem, a practical solution probably 
has to be outside of R, and maybe outside SQL as well.

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

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


[R] two y-axis in xy-plot

2006-01-09 Thread Antje Schüle
Hi there,

 

I am wondering if it is possible to do an xyplot with two y-axes. I'd like to 
print two parameters in a time series but they both have different scales.

 

Which parameter in xyplot can I add to achieve this result? 

 

Thanks a lot for any help. 

 

Antje


[[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] A comment about R:

2006-01-09 Thread Uwe Ligges
François Pinard wrote:

 [Uwe Ligges]
 
François Pinard wrote:

[David Forrest]
 
 
[...] A few end-to-end tutorials on some interesting analyses would
be helpful.
 
 
I'm in the process of learning R.  While tutorials are undoubtedly
very useful, and understanding that working and studying methods vary
between individuals, what I (for one) would like to have is a fairly
complete reference manual to the library [...] organised by topics.
 
 
Have a look at  help.start() -- Search Engine  Keywords -- Section 
Keywords by Topic.
 
 
 Yes, thanks.  This is quite in the spirit, or direction, of what I was 
 proposing.  Is that resource exhaustive?  (I'm asking out of laziness, 
 as it might take me several months to really check.)

It is exhaustive in the following sense:
- the help page has the appropriate keyword
- the package is installed


 One serious drawback (for me) is that it requires an heavy weight
 browser to be used, with Javascript enabled.  I do not find this very
 practical.  Another point is that the presentation, while useful, is a
 rather dry.  In another message, I suggested the Emacs Lisp Reference 
 Manual as a good example of a fluid presentation of a voluminous 
 library.  There might be some workable compromise between the current 
 situation with R, even through the Keywords by Topic, and that 
 fluidity.  (Wikis also have the drawback of requiring heavy machinery,
 and the editor they force us into if usually unbearable.)
 
 I may be back with this subject, but only in a good while.  I'm slowly 
 building a kind of documentation plan I want (yet in French), as I learn 
 R, and guess I may complete my base learning in one or two years from 
 now (hoping I'll stay courageous enough).  If I then get something 
 usable or shareable enough, I'll offer it -- because I like returning 
 a little something for the nice tools given to me!  :-)


So we are looking forward to see the better system.

Uwe Ligges


 In any case, thanks for listening!


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

2006-01-09 Thread Michael Dewey
At 20:12 08/01/06, Jack Tanner wrote:
Philippe's idea to start a wiki that grows out of the content on 
http://zoonek2.free.fr/UNIX/48_R/all.html is really great. Here's why.

My hypothesis is that the basic reason that people ask questions on R-help 
rather than first looking elsewhere is that looking elsewhere doesn't get 
them the info they need.

People think in terms of the tasks they have to do. The documentation for 
R, which can be very good, is organized in terms of the structure of R, 
its functions. This mismatch -- people think of tasks, the documentation 
thinks in functions -- causes people to turn to the mailing list.

Further to that I feel that (perhaps because they do not like to blow their 
own trumpet too much) the authors of books on R do not stress how much most 
questioners could gain by buying and reading at least one of the many books 
on R. When I started I found the free documents useful but I made most 
progress when I bought MASS. I do realise that liking books is a bit last 
millennium.




Michael Dewey
http://www.aghmed.fsnet.co.uk

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


Re: [R] wicked wikis for R

2006-01-09 Thread Jean-Christophe BOUETTE
 From: Arin Basu [EMAIL PROTECTED]
 To: r-help@stat.math.ethz.ch
 Date: 8 Jan 2006 19:18:17 -
 Subject: [R] wicked wikis for R
 Message: 41
 Date: Sun, 08 Jan 2006 13:52:33 +1100
  From: paul sorenson [EMAIL PROTECTED]
 Subject: Re: [R] Wikis etc.
 To: Frank E Harrell Jr [EMAIL PROTECTED], r-help
r-help@stat.math.ethz.ch

-snip-

 Among others, here's one long-term benefit for the newbies. Instead of people 
 getting admonished/thrashed with harsh expressions/advices like go see the 
 mailing list publishing etiquettes, or you should search the archives and 
 help files, and read all manuals, and ask others first before posting 
 here... (which can turn away many a newcomer from posting or using the 
 mailing list or using R for that matter), wiki could make life a little easy 
 for newbies/less experienced who could then receive more polite one liners 
 like, please check the wikipages..., or solution #xyz in the wikipages for 
 the solution.

Sorry, I don't get the point here. Some people will keep feeling
offensed when they're just told to read the man/wiki pages, and others
will simply change their answers from RTFM to RTFW.
Nobody can force people into reading the manuals, or reading the
posting guide. This is definitely one problem that the wiki will not
solve.

I like the idea of the wiki, but we have to consider pragmatically,
not as a panacea from problems beyond its scope.

Regards,
Jean-Christophe Bouëtté.

__
R-help@stat.math.ethz.ch 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] Suggestion for big files [was: Re: A comment about R:]

2006-01-09 Thread r . ghezzo
I found Reservoir-Sampling algorithms of time complexity O(n(1+log(N/n))) by
Kim-Hung Li , ACM Transactions on Mathematical Software Vol 20 No 4 Dec 94
p481-492.
He mentions algorithm Z and K and proposed 2 improved versions alg L and M.
Algorith L is really easy to implement but relatively slow, M doesn't look very
difficult and is the fastest.
Heberto Ghezzo
McGill University
Montreal - Canada

Quoting François Pinard [EMAIL PROTECTED]:

 [Martin Maechler]

 FrPi Suppose the file (or tape) holds N records (N is not known
 FrPi in advance), from which we want a sample of M records at
 FrPi most. [...] If the algorithm is carefully designed, when
 FrPi the last (N'th) record of the file will have been processed
 FrPi this way, we may then have M records randomly selected from
 FrPi N records, in such a a way that each of the N records had an
 FrPi equal probability to end up in the selection of M records.  I
 FrPi may seek out for details if needed.

 [...] I'm also intrigued about the details of the algorithm you
 outline above.

 I went into my old SPSS books and related references to find it for you,
 to no avail (yet I confess I did not try very hard).  I vaguely remember
 it was related to Spearman's correlation computation: I did find notes
 about the severe memory limitation of this computation, but nothing
 about the implemented workaround.  I did find other sampling devices,
 but not the very one I remember having read about, many years ago.

 On the other hand, Googling tells that this topic has been much studied,
 and that Vitter's algorithm Z seems to be popular nowadays (even if not
 the simplest) because it is more efficient than others.  Google found
 a copy of the paper:

http://www.cs.duke.edu/~jsv/Papers/Vit85.Reservoir.pdf

 Here is an implementation for Postgres:

http://svr5.postgresql.org/pgsql-patches/2004-05/msg00319.php

 yet I do not find it very readable -- but this is only an opinion: I'm
 rather demanding in the area of legibility, while many or most people
 are more courageous than me! :-).

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

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


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

2006-01-09 Thread roger bos
As far as generating a sudoku, it can't be too hard because I have a program
on my cell phone that does it with a size less than 325K.  I don't know the
best way to generate these, but one way I was thinking of was starting with
a filled up one then randomize the columns and rows. Then make some of them
blank.  The cell-phone version often generates puzzles that have non-unique
solutions.  Though I admit this is sometimes annoying, it also can make the
puzzle harder.

Thanks,

Roger



On 1/9/06, Martin Maechler [EMAIL PROTECTED] wrote:

 First, thanks a lot! to David Brahms for finally tackling this
 important problem, and keeping the R language major league !
 ;-) :-)  {but the thanks! is meant seriously!}

  Detlef == Detlef Steuer [EMAIL PROTECTED]
  on Sun, 8 Jan 2006 12:21:52 +0100 writes:

Detlef Hey, you spoiled my course!  :-)

Detlef I planned using this as an excersise.  Alternative
Detlef ideas anyone ...

 Well, you could *add* to it:

 1) When I have been thinking about doing this myself (occasionally
 in the past weeks), I had always thought that finding *ALL*
 solutions was a very important property of the algorithm I would
 want to design.
 (since this is slightly more general and useful than proofing
 uniqueness which the current algorithm does not yet do anyway).

 2) The current sudoku() prints the result itself and returns a
   matrix; improved, it should return an object of class sudoku,
   with a print() and a plot() method;
 3) The plot() method should of course also work for unfinished
   sudoku objects, and in fact, the *input* to sudoku() should
   also be allowed to be a (typically unfinished) sudoku object.

 4) Then you could have your students use grid and
   grid.locator() for GUI *input* of a sudoku; i.e. you'd have
   another function which returns a (typically unfinished)
   sudoku object.

 5) You could start looking at *solving* the more general sudokus
   where the blocks are not 3x3 squares anymore, but more
   general rectangular polygons of 9 squares each.

 6) Now you need to refine the GUI from 4) because your users
   need to be able to *draw* the block shapes for the
   generalized sudokus.

 7) Given 1) is solved, the problem of *generating* sudokus,
   that David already mentioned in his announcement, becomes
   more relevant: You want to be sure that the sudokus you
   generate have exactly one solution.  And your generating
   algorithm could start with a very full sudoku (that has
   exactly 1 solution) and erases squares as much as possible,
   always checking that no other solution becomes possible.

 You see, there's lot of interesting exercises left for your
 course. (;-)

 Martin

Detlef On Fri, 6 Jan 2006 11:43:44 -0500 Brahm, David
Detlef [EMAIL PROTECTED] wrote:

 Any doubts about R's big-league status should be put to
 rest, now that we have a Sudoku Puzzle Solver.  Take
 that, SAS!  See package sudoku on CRAN.

 The package could really use a puzzle generator --
 contributors are welcome!

 -- David Brahm ([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


[[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] wicked wikis for R

2006-01-09 Thread Frank E Harrell Jr
Jean-Christophe BOUETTE wrote:
From: Arin Basu [EMAIL PROTECTED]
To: r-help@stat.math.ethz.ch
Date: 8 Jan 2006 19:18:17 -
Subject: [R] wicked wikis for R

Message: 41
Date: Sun, 08 Jan 2006 13:52:33 +1100
From: paul sorenson [EMAIL PROTECTED]
Subject: Re: [R] Wikis etc.
To: Frank E Harrell Jr [EMAIL PROTECTED], r-help
  r-help@stat.math.ethz.ch
 
 
 -snip-
 
 
Among others, here's one long-term benefit for the newbies. Instead of people 
getting admonished/thrashed with harsh expressions/advices like go see the 
mailing list publishing etiquettes, or you should search the archives and 
help files, and read all manuals, and ask others first before posting 
here... (which can turn away many a newcomer from posting or using the 
mailing list or using R for that matter), wiki could make life a little easy 
for newbies/less experienced who could then receive more polite one liners 
like, please check the wikipages..., or solution #xyz in the wikipages for 
the solution.
 
 
 Sorry, I don't get the point here. Some people will keep feeling
 offensed when they're just told to read the man/wiki pages, and others
 will simply change their answers from RTFM to RTFW.
 Nobody can force people into reading the manuals, or reading the
 posting guide. This is definitely one problem that the wiki will not
 solve.
 
 I like the idea of the wiki, but we have to consider pragmatically,
 not as a panacea from problems beyond its scope.

That would be an excellent comment if people seeking help were paying 
for a service.  But they are not.

Frank

 
 Regards,
 Jean-Christophe Bouëtté.


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

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


[R] decide between polynomial vs ordered factor model (lme)

2006-01-09 Thread Leo Gürtler
Dear alltogether,

two lme's, the data are available at:

http://www.anicca-vijja.de/lg/hlm3_nachw.Rdata

explanations of the data:

nachw = post hox knowledge tests over 6 measure time points (= equally 
spaced)
zeitn = time points (n = 6)
subgr = small learning groups (n = 28)
gru = 4 different groups = treatment factor

levels: time (=zeitn) (n=6) within subject (n=4) within smallgroups 
(=gru) (n = 28), i.e. n = 4 * 28 = 112 persons and 112 * 6 = 672 data points

library(nlme)
fitlme7 - lme(nachw ~ I(zeitn-3.5) + I((zeitn-3.5)^2) +
I((zeitn-3.5)^3) + I((zeitn-3.5)^4)*gru, random = list(subgr = ~ 1,
subject = ~ zeitn), data = hlm3)

fit5 - lme(nachw ~ ordered(I(zeitn-3.5))*gru, random = list(subgr =
~ 1, subject = ~ zeitn), data = hlm3)

anova( update(fit5, method=ML), update(fitlme7, method=ML) )

  anova( update(fit5, method=ML), update(fitlme7, method=ML) )
Model df  AIC  BIClogLik   Test
update(fit5, method = ML)1 29 2535.821 2666.619 -1238.911
update(fitlme7, method = ML) 2 16 2529.719 2601.883 -1248.860 1 vs 2
 L.Ratio p-value
update(fit5, method = ML)
update(fitlme7, method = ML) 19.89766  0.0978
 

shows that both are ~ equal, although I know about the uncertainty of ML 
tests with lme(). Both models show that the ^2 and the ^4 terms are 
important parts of the model.

My question is:

- Is it legitim to choose a model based on these outputs according to 
theoretical considerations instead of statistical tests that not really 
show a superiority of one model over the other one?

- Is there another criterium I've overseen to decide which model can be 
clearly prefered?

- The idea behind that is that in the one model (fit5) the second 
contrast of the factor (gru) is statistically significant, although not 
the whole factor in the anova output.
In the other model, this is not the case.
Theoretically interesting is of course the significance of the second 
contrast of gru, as it shows a tendency of one treatment being slightly 
superior. I want to choose this model but I am not sure whether this is 
proper action. Both models shows this trend, but only one model clearly 
indicates that this trend bears some empirical meaning.

Thanks for any suggestions,

leo


here are the outputs for each model:

 fitlme7 - lme(nachw ~ I(zeitn-3.5) + I((zeitn-3.5)^2) + 
I((zeitn-3.5)^3) + I((zeitn-3.5)^4)*gru, random = list(subgr = ~ 1,
subject = ~ zeitn), data = hlm3)
 plot(augPred(fitlme7), layout=c(14,8))
 summary(fitlme7); anova(fitlme7); intervals(fitlme7)
Linear mixed-effects model fit by REML
Data: hlm3
   AIC  BIClogLik
  2582.934 2654.834 -1275.467

Random effects:
Formula: ~1 | subgr
(Intercept)
StdDev:   0.5833797

Formula: ~zeitn | subject %in% subgr
Structure: General positive-definite, Log-Cholesky parametrization
StdDevCorr
(Intercept) 0.6881908 (Intr)
zeitn   0.1936087 -0.055
Residual1.3495785

Fixed effects: nachw ~ I(zeitn - 3.5) + I((zeitn - 3.5)^2) + I((zeitn -
3.5)^3) +  I((zeitn - 3.5)^4) * gru
Value  Std.Error  DF   t-value p-value
(Intercept)  4.528757 0.17749012 553 25.515542  0.
I(zeitn - 3.5)   0.010602 0.08754449 553  0.121100  0.9037
I((zeitn - 3.5)^2)   0.815693 0.09765075 553  8.353171  0.
I((zeitn - 3.5)^3)   0.001336 0.01584169 553  0.084329  0.9328
I((zeitn - 3.5)^4)  -0.089655 0.01405811 553 -6.377486  0.
gru1 0.187181 0.30805090  24  0.607630  0.5491
gru2 0.532665 0.30805090  24  1.729147  0.0966
gru3-0.046305 0.30805090  24 -0.150317  0.8818
I((zeitn - 3.5)^4):gru1 -0.007860 0.00600928 553 -1.307993  0.1914
I((zeitn - 3.5)^4):gru2 -0.001259 0.00600928 553 -0.209516  0.8341
I((zeitn - 3.5)^4):gru3 -0.000224 0.00600928 553 -0.037225  0.9703
Correlation:
(Intr) I(-3.5 I((-3.5)^2 I((-3.5)^3 I((z-3.5)^4)
I(zeitn - 3.5)   0.071
I((zeitn - 3.5)^2)  -0.465  0.000
I((zeitn - 3.5)^3)   0.000 -0.914  0.000
I((zeitn - 3.5)^4)   0.401  0.000 -0.977  0.000
gru1 0.000  0.000  0.000  0.000  0.000
gru2 0.000  0.000  0.000  0.000  0.000
gru3 0.000  0.000  0.000  0.000  0.000
I((zeitn - 3.5)^4):gru1  0.000  0.000  0.000  0.000  0.000
I((zeitn - 3.5)^4):gru2  0.000  0.000  0.000  0.000  0.000
I((zeitn - 3.5)^4):gru3  0.000  0.000  0.000  0.000  0.000
gru1   gru2   gru3   I((-3.5)^4):1 I((-3.5)^4):2
I(zeitn - 3.5)
I((zeitn - 3.5)^2)
I((zeitn - 3.5)^3)
I((zeitn - 3.5)^4)
gru1
gru2 0.000
gru3 0.000  0.000
I((zeitn - 3.5)^4):gru1 -0.287  0.000  0.000
I((zeitn - 3.5)^4):gru2  0.000 -0.287  0.000  0.000
I((zeitn - 3.5)^4):gru3  0.000  0.000 -0.287  0.000 0.000

Standardized Within-Group Residuals:
   Min   

[R] how to run the data editor by command?Thanks!

2006-01-09 Thread 刘加成
Thanks!

--
Liu jcheng

[[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] how to run the data editor by command?Thanks!

2006-01-09 Thread ronggui
?fix
?edit

2006/1/9, 刘加成 [EMAIL PROTECTED]:
 Thanks!

 --
 Liu jcheng

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



--
黄荣贵
Deparment of Sociology
Fudan University

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

[R] How to use filled.contour(x,y,z) data for levelplot(z)?

2006-01-09 Thread Jan Verbesselt
Dear all,

We used the following function to create a spatial plot of a raster image:

filled.contour(xx,yy,zz, color = terrain.colors, nlevels=10,
main=naamjaar, plot.axes = { contour(Xcoord/1000,Ycoord/1000,lim.data,
nlevels = 4, col=4,drawlabels = T, axes = FALSE, frame.plot = FFALSE,
add = TRUE);axis(1); axis(2);
points(fire[,2:3]/1000,col=red,pch=*,cex=2,lwd=3)
})

we however would like to create 5 maps with only one legend. This seems
not to be possible with filled.contour follow the help().

We therefore started looking at levelplot(zz) to create a multipanel view.  

*However how could we use x and y coordinates in levelplot without using
a formula (since x,y are only the coordinates of the matrix z)?

libary(lattice)
rownames(zz) - xx
colnames(zz) - yy
levelplot(zz)

like this the all the row and col names are displayed in x and y axis
without summarizing data similar to filled.contour function?

* or can this be done with an upgrade of filled.contour?

Thanks,
Jan

windows R 2.2


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

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


Re: [R] decide between polynomial vs ordered factor model (lme)

2006-01-09 Thread Dimitris Rizopoulos
I think that these models are not nested and thus the LRT produced by 
anova.lme() will not be valid; AIC and BIC could be more relevant. In 
terms of interpretability, I'd say that a model treating 'zeitn' as a 
factor is much easier to explain than a model with 4th order 
polynomial.

I hope it helps.

Best,
Dimitris


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

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



- Original Message - 
From: Leo Gürtler [EMAIL PROTECTED]
To: r-help@stat.math.ethz.ch
Sent: Monday, January 09, 2006 2:59 PM
Subject: [R] decide between polynomial vs ordered factor model (lme)


 Dear alltogether,

 two lme's, the data are available at:

 http://www.anicca-vijja.de/lg/hlm3_nachw.Rdata

 explanations of the data:

 nachw = post hox knowledge tests over 6 measure time points (= 
 equally
 spaced)
 zeitn = time points (n = 6)
 subgr = small learning groups (n = 28)
 gru = 4 different groups = treatment factor

 levels: time (=zeitn) (n=6) within subject (n=4) within smallgroups
 (=gru) (n = 28), i.e. n = 4 * 28 = 112 persons and 112 * 6 = 672 
 data points

 library(nlme)
 fitlme7 - lme(nachw ~ I(zeitn-3.5) + I((zeitn-3.5)^2) +
 I((zeitn-3.5)^3) + I((zeitn-3.5)^4)*gru, random = list(subgr = ~ 1,
 subject = ~ zeitn), data = hlm3)

 fit5 - lme(nachw ~ ordered(I(zeitn-3.5))*gru, random = list(subgr =
 ~ 1, subject = ~ zeitn), data = hlm3)

 anova( update(fit5, method=ML), update(fitlme7, method=ML) )

  anova( update(fit5, method=ML), update(fitlme7, method=ML) )
Model df  AIC  BIClogLik 
 Test
 update(fit5, method = ML)1 29 2535.821 2666.619 -1238.911
 update(fitlme7, method = ML) 2 16 2529.719 2601.883 -1248.860 
 1 vs 2
 L.Ratio p-value
 update(fit5, method = ML)
 update(fitlme7, method = ML) 19.89766  0.0978
 

 shows that both are ~ equal, although I know about the uncertainty 
 of ML
 tests with lme(). Both models show that the ^2 and the ^4 terms are
 important parts of the model.

 My question is:

 - Is it legitim to choose a model based on these outputs according 
 to
 theoretical considerations instead of statistical tests that not 
 really
 show a superiority of one model over the other one?

 - Is there another criterium I've overseen to decide which model can 
 be
 clearly prefered?

 - The idea behind that is that in the one model (fit5) the second
 contrast of the factor (gru) is statistically significant, although 
 not
 the whole factor in the anova output.
 In the other model, this is not the case.
 Theoretically interesting is of course the significance of the 
 second
 contrast of gru, as it shows a tendency of one treatment being 
 slightly
 superior. I want to choose this model but I am not sure whether this 
 is
 proper action. Both models shows this trend, but only one model 
 clearly
 indicates that this trend bears some empirical meaning.

 Thanks for any suggestions,

 leo


 here are the outputs for each model:

 fitlme7 - lme(nachw ~ I(zeitn-3.5) + I((zeitn-3.5)^2) +
 I((zeitn-3.5)^3) + I((zeitn-3.5)^4)*gru, random = list(subgr = ~ 1,
 subject = ~ zeitn), data = hlm3)
 plot(augPred(fitlme7), layout=c(14,8))
 summary(fitlme7); anova(fitlme7); intervals(fitlme7)
 Linear mixed-effects model fit by REML
 Data: hlm3
   AIC  BIClogLik
  2582.934 2654.834 -1275.467

 Random effects:
 Formula: ~1 | subgr
(Intercept)
 StdDev:   0.5833797

 Formula: ~zeitn | subject %in% subgr
 Structure: General positive-definite, Log-Cholesky parametrization
StdDevCorr
 (Intercept) 0.6881908 (Intr)
 zeitn   0.1936087 -0.055
 Residual1.3495785

 Fixed effects: nachw ~ I(zeitn - 3.5) + I((zeitn - 3.5)^2) + 
 I((zeitn -
 3.5)^3) +  I((zeitn - 3.5)^4) * gru
Value  Std.Error  DF   t-value p-value
 (Intercept)  4.528757 0.17749012 553 25.515542  0.
 I(zeitn - 3.5)   0.010602 0.08754449 553  0.121100  0.9037
 I((zeitn - 3.5)^2)   0.815693 0.09765075 553  8.353171  0.
 I((zeitn - 3.5)^3)   0.001336 0.01584169 553  0.084329  0.9328
 I((zeitn - 3.5)^4)  -0.089655 0.01405811 553 -6.377486  0.
 gru1 0.187181 0.30805090  24  0.607630  0.5491
 gru2 0.532665 0.30805090  24  1.729147  0.0966
 gru3-0.046305 0.30805090  24 -0.150317  0.8818
 I((zeitn - 3.5)^4):gru1 -0.007860 0.00600928 553 -1.307993  0.1914
 I((zeitn - 3.5)^4):gru2 -0.001259 0.00600928 553 -0.209516  0.8341
 I((zeitn - 3.5)^4):gru3 -0.000224 0.00600928 553 -0.037225  0.9703
 Correlation:
(Intr) I(-3.5 I((-3.5)^2 I((-3.5)^3 
 I((z-3.5)^4)
 I(zeitn - 3.5)   0.071
 I((zeitn - 3.5)^2)  -0.465  0.000
 I((zeitn - 3.5)^3)  

Re: [R] need palette of topographic colors similar to topo.colors ()

2006-01-09 Thread Tuszynski, Jaroslaw W.


I will second Roger's suggestion, colorRampPalette is a great function for
creating your own palettes. For example, Matlab's jet palette (also
available in fields package under peculiar name 'tim.colors') can be defined
by:

jet.colors = colorRampPalette(c(#7F, blue, #007FFF, cyan,
#7FFF7F, yellow, #FF7F00, red, #7F)) 

Other predefined functions for creating and managing color palettes that I
know of, are:
* R provides functions for creating palettes of continuous colors:
rainbow, topo.colors, heat.colors, terrain.colors.colors, gray
* tim.colors in package fields contains palette similar to Matlab's jet
palette (see examples for simpler implementation)
* rich.colors in package gplots contains two palettes of continuous
colors.
* Functions brewer.pal from RColorBrewer package and colorbrewer.palette
from epitools package contain tools for generating palettes
* rgb and hsv creates palette from RGB or HSV 3-vectors.

Maybe one of those will work for you.

Jarek

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] 
Sent: Saturday, January 07, 2006 3:10 PM
To: bogdan romocea
Cc: r-help
Subject: Re: [R] need palette of topographic colors similar to topo.colors()

On Sat, 7 Jan 2006, bogdan romocea wrote:

 Dear useRs,
 
 I got stuck trying to generate a palette of topographic colors that
 would satisfy these two requirements:
- the pallete must be 'anchored' at 0 (just like on a map), with
 light blue/lawn green corresponding to data values close to 0 (dark
 blue to light blue for negative values, green-yellow-brown for
 positive values)
- the brown must get darker for higher positive values.
 
 topo.colors() fails both requirements and AFAICS lacks any options to
 control its behavior.
   #---unsatisfactory topo.colors() behavior
   topoclr - function(tgt)
   {
   clr - topo.colors(length(tgt))
   clr - clr[round(rank(tgt),0)]
   plot(tgt,pch=15,col=clr)
   }
   par(mfrow=c(2,1)) ; topoclr(-50:50) ; topoclr(-20:80)
 
 An acceptable solution would be something like this
   grayclr - function(tgt)
   {
   tgt - sort(tgt) ; neg - which(tgt  0)
   clrneg - gray(0:length(tgt[neg])/length(tgt[neg]))
   clrpos - gray(length(tgt[-neg]):0/length(tgt[-neg]))
   clr - c(clrneg,clrpos)
   plot(tgt,pch=15,col=clr)
   }
   par(mfrow=c(2,1)) ; grayclr(-50:50) ; grayclr(-20:80)
 if only I could make gray() use blue/brown instead of black (I tried a
 couple of things but got stuck again).
 
 Any suggestions?

Use colorRampPalette() to roll your own, or something better tuned, 
perhaps catenating two ramps together.

 
 Thank you,
 b.
 
 __
 R-help@stat.math.ethz.ch 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-help@stat.math.ethz.ch 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] Looking for packages to do Feature Selection and Classifi cation

2006-01-09 Thread Tuszynski, Jaroslaw W.
Hi,

You should also check my msc.features.select from caMassClass package. It
has feature selection algorithm that I found useful in case of mass-spectra
data. It performs individual feature selection and/or removes highly
correlated neighbor features. 

Jarek

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] 
Sent: Friday, January 06, 2006 3:12 PM
To: Weiwei Shi
Cc: Diaz.Ramon; r-help
Subject: Re: [R] Looking for packages to do Feature Selection and
Classification

Thanks. It's indeed an interesting paper. Besides RF (using Ramon's varSelRF
package), I am also testing Guyon et al's (2002) Recursive Feature
Elimination for my feature-selection part.

On 1/5/06, Weiwei Shi [EMAIL PROTECTED] wrote:

 FYI:

 check the following paper on svm (using libsvm) as well as random
 forest in the context of feature selection.

 http://www.csie.ntu.edu.tw/~cjlin/papers/features.pdf

 HTH

 On 1/4/06, Diaz.Ramon [EMAIL PROTECTED] wrote:
  Dear Frank,
  I expect you'll get many different answers since a wide variety of
 approaches have been suggested. So I'll stick to self-advertisment: I've
 written an R package, varSelRF (available from R), that uses random forest
 together with a simple variable selection approach, and provides also
 bootstrap estimates of the error rate of the procedure. Andy Liaw and
 collaborators previously developed and published a somewhat similar
 procedure. You probably also want to take a look at several packages
 available from BioConductor.
 
  Best,
 
  R.
 
 
  -Original Message-
  From:   [EMAIL PROTECTED] on behalf of Frank Duan
  Sent:   Wed 1/4/2006 4:23 AM
  To: r-help
  Cc:
  Subject:[R] Looking for packages to do Feature Selection and
 Classification
 
  Hi All,
 
  Sorry if this is a repost (a quick browse didn't give me the answer).
 
  I wonder if there are packages that can do the feature selection and
  classification at the same time. For instance, I am using SVM to
 classify my
  samples, but it's easy to get overfitted if using all of the features.
 Thus,
  it is necessary to select good features to build an optimum hyperplane
  (?). Here is a simple example: Suppose I have 100 useful features and
 100
  useless features (or noise features), I want the SVM to give me the
  same results when 1) using only 100 useful features or 2) using all 200
  features.
 
  Any suggestions or point me to a reference?
 
  Thanks in advance!
 
  Frank
 
  [[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
 
  --
  Ramón Díaz-Uriarte
  Bioinformatics Unit
  Centro Nacional de Investigaciones Oncológicas (CNIO)
  (Spanish National Cancer Center)
  Melchor Fernández Almagro, 3
  28029 Madrid (Spain)
  Fax: +-34-91-224-6972
  Phone: +-34-91-224-6900
 
  http://ligarto.org/rdiaz
  PGP KeyID: 0xE89B3462
  (http://ligarto.org/rdiaz/0xE89B3462.asc)
 
 
 
  **NOTA DE CONFIDENCIALIDAD** Este correo electrónico, y en
 s...{{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
 


 --
 Weiwei Shi, Ph.D

 Did you always know?
 No, I did not. But I believed...
 ---Matrix III


[[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] trouble with extraction/interpretation of variance structure para meters from a model built using gnls and varConstPower

2006-01-09 Thread Rand, Hugh
I have been using gnls with the weights argument (and varConstPower) to
specify a variance structure for curve fits. In attempting to extract the
parameters for the variance model I am seeing results I don't understand.
When I simply display the model (or use summary on the model), I get what
seem like reasonable values for both power and const. When I actually
try to extract the values, I get the same number for the power, but a
different (and less sensible) value for const.

The simplest example I can come up with that shows the problem is as
follows: 


#Set up data

x= c(0,0,0,1,1,1,2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,7,7,7);
y0   = c(.1,.1,.1, .5,.5,.5, 1,1,1, 2,2,2, 4,4,4, 7,7,7, 9,9,9, 10,10,10);
yp   = c(0,.03,.05, 0,.05,.01, 0,.07,.03, .1,0,.2, .2,.1,0, .3,0,.1,
0,.3,.4, .3,.5,0);
y= y0 + 4*yp;
data = data.frame(x=x,y=y);

#Run model

library(nlme)
model3 = try(gnls(y ~
SSfpl(x,A,B,xmid,scal),data=data,weights=varConstPower(const=1,power=0,form=
~fitted(.;

#Examine results

model3; #const = .6551298,   power =
.8913665
summary(model3);#const = .6551298,   power =
.8913665   

coef(model3$modelStruct$varStruct)[power];#power =
.8913665
coef(model3$modelStruct$varStruct)[const];#const = -0.4229219 
coef.varFunc(model3$modelStruct$varStruct); #R can't seem to find this
function, Splus can


Any advice on what I am doing wrong would be appreciated.

Hugh Rand
Senior Scientist
Amgen
[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] Wikis etc.

2006-01-09 Thread Thomas Lumley
On Mon, 9 Jan 2006, Michael Dewey wrote:

 Further to that I feel that (perhaps because they do not like to blow their
 own trumpet too much) the authors of books on R do not stress how much most
 questioners could gain by buying and reading at least one of the many books
 on R. When I started I found the free documents useful but I made most
 progress when I bought MASS. I do realise that liking books is a bit last
 millennium.


Very late last millenium, though.
When I were young[er] we didn't have all these fancy yellow books.

More seriously, yes, reading books about R and S is very effective and is 
how most of the R experts learned.  In my case it was the Blue Book, the 
White Book, and the Ripley/Venables/Smith notes on S-plus (which have 
evolved to the Introduction to R).

-thomas

Ptolemy once asked [Euclid] if there was in geometry any shorter way that 
that of the Elements, and he replied that there was no royal road to 
geometry. Proclus (410-485 CE)

__
R-help@stat.math.ethz.ch 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] decide between polynomial vs ordered factor model (lme)

2006-01-09 Thread Douglas Bates
On 1/9/06, Leo Gürtler [EMAIL PROTECTED] wrote:
 Dear alltogether,

 two lme's, the data are available at:

 http://www.anicca-vijja.de/lg/hlm3_nachw.Rdata

 explanations of the data:

 nachw = post hox knowledge tests over 6 measure time points (= equally
 spaced)
 zeitn = time points (n = 6)
 subgr = small learning groups (n = 28)
 gru = 4 different groups = treatment factor

 levels: time (=zeitn) (n=6) within subject (n=4) within smallgroups
 (=gru) (n = 28), i.e. n = 4 * 28 = 112 persons and 112 * 6 = 672 data points

 library(nlme)
 fitlme7 - lme(nachw ~ I(zeitn-3.5) + I((zeitn-3.5)^2) +
 I((zeitn-3.5)^3) + I((zeitn-3.5)^4)*gru, random = list(subgr = ~ 1,
 subject = ~ zeitn), data = hlm3)

 fit5 - lme(nachw ~ ordered(I(zeitn-3.5))*gru, random = list(subgr =
 ~ 1, subject = ~ zeitn), data = hlm3)

 anova( update(fit5, method=ML), update(fitlme7, method=ML) )

   anova( update(fit5, method=ML), update(fitlme7, method=ML) )
 Model df  AIC  BIClogLik   Test
 update(fit5, method = ML)1 29 2535.821 2666.619 -1238.911
 update(fitlme7, method = ML) 2 16 2529.719 2601.883 -1248.860 1 vs 2
  L.Ratio p-value
 update(fit5, method = ML)
 update(fitlme7, method = ML) 19.89766  0.0978
  

 shows that both are ~ equal, although I know about the uncertainty of ML
 tests with lme(). Both models show that the ^2 and the ^4 terms are
 important parts of the model.

 My question is:

 - Is it legitimate to choose a model based on these outputs according to
 theoretical considerations instead of statistical tests that not really
 show a superiority of one model over the other one?

 - Is there another criterium I've overlooked to decide which model can be
 clearly preferred?

 - The idea behind that is that in the one model (fit5) the second
 contrast of the factor (gru) is statistically significant, although not
 the whole factor in the anova output.
 In the other model, this is not the case.
 Theoretically interesting is of course the significance of the second
 contrast of gru, as it shows a tendency of one treatment being slightly
 superior. I want to choose this model but I am not sure whether this is
 proper action. Both models shows this trend, but only one model clearly
 indicates that this trend bears some empirical meaning.

 Thanks for any suggestions,

The comparisons may be more clearly shown if you create the ordered
factor and a second version of the ordered factor what has the
contrasts set so it produces a 4th order polynomial.  That is, set

hlm3$ozeit - ordered(hlm3$zeitn)
hlm3$ozeit4 - C(hlm3$ozeit, contr.poly, 4)

then define one model in terms of ozeit and a second model in terms of ozeit4.

I would go further and create a new binary factor from gru that
contrasted level 2 against the other three levels and use that instead
of gru.

For a model fit by lme I would use the one-argument form of anova to
assess the significance of terms in the fixed effects.  (That advice
doesn't hold for models fit by lmer - at least at present.)

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


[R] How to use filled.contour(x,y,z) data for levelplot(z)?

2006-01-09 Thread Edzer J. Pebesma
Jan, 

libary(lattice)
rownames(zz) - xx
colnames(zz) - yy
levelplot(zz)

will not work -- levelplot needs a data frame with
zz, xx and yy values next to each other, so read
about data.frame(), rep() and as.vector(zz); you
will need the each= argument for one of xx or yy.

Sounds like you'd be helped by using package sp, 
see also http://r-spatial.sourceforge.net/ and look
for the graph gallery, function spplot.
--
Edzer

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

2006-01-09 Thread Gabor Grothendieck
On 1/9/06, Thomas Lumley [EMAIL PROTECTED] wrote:
 On Mon, 9 Jan 2006, Michael Dewey wrote:
 
  Further to that I feel that (perhaps because they do not like to blow their
  own trumpet too much) the authors of books on R do not stress how much most
  questioners could gain by buying and reading at least one of the many books
  on R. When I started I found the free documents useful but I made most
  progress when I bought MASS. I do realise that liking books is a bit last
  millennium.
 

 Very late last millenium, though.
 When I were young[er] we didn't have all these fancy yellow books.

 More seriously, yes, reading books about R and S is very effective and is
 how most of the R experts learned.  In my case it was the Blue Book, the
 White Book, and the Ripley/Venables/Smith notes on S-plus (which have
 evolved to the Introduction to R).

In addition to books, the various manuals, contributed documents and
mailing list archives, all of which one should review,
the key thing to do if you want to really learn R is to read source code
and lots of it.  I think there is no other way.  Furthermore, the fact that
you can do this is really a key advantage of open source.

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

2006-01-09 Thread Henrik Bengtsson
I replied all to the original message, but since that was to 
[EMAIL PROTECTED] it might not have gone out there, did it? 
   If not, below is my reply again. [You have restrict the 
randomization so that you permute within and between block rows/columns.]


/Henrik

 Original Message 
Subject: Re: [R] [R-pkgs] sudoku
Date: Sat, 07 Jan 2006 09:36:54 +1100
From: Henrik Bengtsson [EMAIL PROTECTED]
To: Brahm, David [EMAIL PROTECTED]
CC: [EMAIL PROTECTED]
References: 
[EMAIL PROTECTED]


Brahm, David wrote:
 Any doubts about R's big-league status should be put to rest, now that
 we have a
 Sudoku Puzzle Solver.  Take that, SAS!  See package sudoku on CRAN.

 The package could really use a puzzle generator -- contributors are
 welcome!

Last summer I put a quick generator together after discussing with some
friends how these games a generate (and enumerated).  I don't know if it
is a correct/complete generator, but consider an empty game with 3x3
grids each with 3x3 cells.  Create the initial board  by adding 1:9 in
the first row, the c(2:9,1), in the second and so on, to make sure you
have one correct board.  From this you can now generate all(?) other
possible boards by permuting rows and columns.  You can for instance use
a random seed enumerate all such boards.  Finally, you want to remove
some of cells, which you also can by sampling using known random seeds.

See attached code.  Example:

  source(Sudoku.R)
  Sudoku$generate()
   [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9]
  [1,]1   NA34   NA   NA   NA8   NA
  [2,]4   NA   NA   NA8   NA   NA   NA   NA
  [3,]   NA8   NA1   NA3456
  [4,]2   NA   NA   NA   NA   NA   NA   NA1
  [5,]   NA67   NA   NA   NA2   NA4
  [6,]8   NA   NA   NA   NA   NA   NA6   NA
  [7,]   NA   NA5   NA   NA89   NA   NA
  [8,]6   NA891   NA3   NA   NA
  [9,]   NA1   NA3   NA   NA   NA78
  Sudoku$generate(1)
   [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9]
  [1,]3   NA25   NA   NA   NA9   NA
  [2,]9   NA   NA   NA3   NA   NA   NA   NA
  [3,]   NA4   NA8   NA7231
  [4,]2   NA   NA   NA   NA   NA   NA   NA6
  [5,]   NA34   NA   NA   NA1   NA9
  [6,]8   NA   NA   NA   NA   NA   NA5   NA
  [7,]   NA   NA9   NA   NA26   NA   NA
  [8,]7   NA691   NA3   NA   NA
  [9,]   NA2   NA6   NA   NA   NA18
  Sudoku$generate(2)
   [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9]
  [1,]7   NA61   NA   NA   NA2   NA
  [2,]1   NA   NA   NA3   NA   NA   NA   NA
  [3,]   NA2   NA7   NA5981
  [4,]8   NA   NA   NA   NA   NA   NA   NA5
  [5,]   NA91   NA   NA   NA7   NA8
  [6,]5   NA   NA   NA   NA   NA   NA9   NA
  [7,]   NA   NA5   NA   NA72   NA   NA
  [8,]9   NA832   NA5   NA   NA
  [9,]   NA1   NA6   NA   NA   NA79

/Henrik

 -- David Brahm ([EMAIL PROTECTED])


[[alternative HTML version deleted]]

 ___
 R-packages mailing list
 [EMAIL PROTECTED]
 https://stat.ethz.ch/mailman/listinfo/r-packages

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

As far as generating a sudoku, it can't be too hard because I have a program
on my cell phone that does it with a size less than 325K.  I don't know the
best way to generate these, but one way I was thinking of was starting with
a filled up one then randomize the columns and rows. Then make some of them
blank.  The cell-phone version often generates puzzles that have non-unique
solutions.  Though I admit this is sometimes annoying, it also can make the
puzzle harder.

Thanks,

Roger



On 1/9/06, Martin Maechler [EMAIL PROTECTED] wrote:


First, thanks a lot! to David Brahms for finally tackling this
important problem, and keeping the R language major league !
;-) :-)  {but the thanks! is meant seriously!}



Detlef == Detlef Steuer [EMAIL PROTECTED]
   on Sun, 8 Jan 2006 12:21:52 +0100 writes:


  Detlef Hey, you spoiled my course!  :-)

  Detlef I planned using this as an excersise.  Alternative
  Detlef ideas anyone ...

Well, you could *add* to it:

1) When I have been thinking about doing this myself (occasionally
in the past weeks), I had always thought that finding *ALL*
solutions was a very important property of the algorithm I would
want to design.
(since this is slightly more general and useful than proofing
uniqueness which the current algorithm does not yet do anyway).

2) The current sudoku() prints the result itself and returns a
 matrix; improved, it should return an object of class sudoku,
 with a print() and a plot() 

Re: [R] Missing value representation in Excel before extraction to R with RODBC

2006-01-09 Thread Fredrik Lundgren
Dear list,

Well, those columns in Excel that starts with NA (actually 8 NA's in my 
case) is imported as all NA in R but if the columns starts with at least 
3 cells with values (i.e not NA) the are imported correctly to R. When 
as.is=TRUE is used a simular conversion takes place but now as all NA 
and dates are represented as date-and-time.
Is there any way to get this correct even when the Excel columns start 
with several NA's?

Sincerely
Fredrik


- Original Message - 
From: Prof Brian Ripley [EMAIL PROTECTED]
To: Petr Pikal [EMAIL PROTECTED]
Cc: Fredrik Lundgren [EMAIL PROTECTED]; R-help 
r-help@stat.math.ethz.ch
Sent: Monday, January 09, 2006 9:36 AM
Subject: Re: [R] Missing value representation in Excel before 
extraction to R with RODBC


 On Mon, 9 Jan 2006, Petr Pikal wrote:

 Hi

 I believe it has something to do with the column identification
 decision. When R decides what is in a column it uses only some values
 from the beginning of a file.

 Not R, Excel.  Excel tells ODBC what the column types are.

 I do not use RODBC as read.delim(clipboard, ...) is usually more
 convenient but probably there is a way how to tell RODBC what is in
 the column instead of let R decide from the top of the file.

 Using as.is=TRUE stops RODBC doing any conversion.

 But I may be completely mistaken.

 HTH
 Petr


 On 6 Jan 2006 at 20:47, Fredrik Lundgren wrote:

 From:   Fredrik Lundgren [EMAIL PROTECTED]
 To: R-help r-help@stat.math.ethz.ch
 Date sent:  Fri, 6 Jan 2006 20:47:29 +0100
 Subject:[R] Missing value representation in Excel before 
 extraction to R
 with RODBC

 Dear list,

 How should missing values be expressed in Excel before extraction to 
 R
 via RODBC. I'm bewildered. Sometimes the representation with NA in
 Excel appears to work and shows up in R as NA but sometimes the 
 use
 of NA in Excel changes the whole vector to NA's. Blank or nothing or
 NA as representation for missing values in Excel with dateformat 
 gives
 NA's of the whole vector in R but with  general format in Excel 
 gives
 blanks for missing values in R. How should I represent missing 
 values
 in Excel?


 Best wishes and thanks for any help
 Fredrik Lundgren

 -- 
 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] two y-axis in xy-plot

2006-01-09 Thread Deepayan Sarkar
On 1/9/06, Antje Schüle [EMAIL PROTECTED] wrote:
 Hi there,



 I am wondering if it is possible to do an xyplot with two y-axes. I'd like
 to print two parameters in a time series but they both have different
 scales.



 Which parameter in xyplot can I add to achieve this result?

The answer depends on the details of what you are doing, so please
provide us with a reproducible example.

Deepayan

__
R-help@stat.math.ethz.ch 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] warning message from nlme

2006-01-09 Thread Chia, Yen Lin
Hi all,

 

I tried to do a variance components using nlme, but I got the following
warning mesage

 

#

not meaningful for factors in: Ops.factor(y[revOrder], Fitted)

##

 

Can someone point out what is the meaning of this warning message? I
tried to look at Ops.factor, but I don't understand it since I'm
relatively new to R.  Thanks.

 

Yen Lin


[[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] warning message from nlme

2006-01-09 Thread Chia, Yen Lin
Hi all,

Sorry for the sloppy description of problem.  

I have a dataset called dense.  I want to decompose the
variability/variation into different components such as wafer, axis,
orientation and data.  These variables are all categorical data.  I
converted axis, orientation and location into factors before I ran the
analysis:

lme(Data~1,random=~1|Wafer/axi/ori/loc,data=Dense)

The algorithm returns the standard deviation of each random effect, but
also gives the warning message:

Warning message:
- not meaningful for factors in: Ops.factor(y[revOrder], Fitted)


I wonder what does this warning message mean?  If the factors are not
meaningful, how can I find out which factors the warning message is
referring to?  Thanks.

Yen Lin





-Original Message-
From: Berton Gunter [mailto:[EMAIL PROTECTED] 
Sent: Monday, January 09, 2006 9:34 AM
To: Chia, Yen Lin
Subject: RE: [R] warning message from nlme

 
 Can someone point out what is the meaning of this warning message? I
 tried to look at Ops.factor, but I don't understand it since I'm
 relatively new to R.  Thanks.
 

No. **Read the posting guide**  and provide sufficient details in your
post
so that an answer can be given.

-- Bert

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

2006-01-09 Thread Leif Kirschenbaum
To avoid spam on the R wikis pages:
  If we assume that anyone who we would want to be empowered to modify the R 
wiki pages is an R-user, would it be possible to somehow incorporate a function 
into the next R release which provides a user with a key/password?
  A new R function would generate a day-of-the year dependent key: if you want 
to modify an R wiki page you need to enter the key for that day (This is not a 
proposal to make keys user specific: every R user worldwide would have the same 
key each day). Then only a person who has installed R would be able to run the 
function to get a key to modify R wiki pages. Of course anyone could read the 
wikis.

I supposed that if we wanted, that the key provided could somehow encode the 
O/S and R version being run, and then the wiki page modified would note which 
O/S and version the annotator is running, however for ease of use I suggest 
that the key generated each day be short for simplicy in typing it in.

I suppose a more complex solution would be for an R function to make a call to 
open a web-browser with a cookie or something set which thus allows the user to 
modify R wiki pages.

Leif Kirschenbaum
Senior Yield Engineer
Reflectivity, Inc.
(408) 737-8100 x307
[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] Wikis etc.

2006-01-09 Thread David Forrest
On Mon, 9 Jan 2006, Gabor Grothendieck wrote:

 On 1/9/06, Thomas Lumley [EMAIL PROTECTED] wrote:
  On Mon, 9 Jan 2006, Michael Dewey wrote:
  
   Further to that I feel that (perhaps because they do not like to blow 
   their
   own trumpet too much) the authors of books on R do not stress how much 
   most
   questioners could gain by buying and reading at least one of the many 
   books
   on R. When I started I found the free documents useful but I made most
   progress when I bought MASS. I do realise that liking books is a bit last
   millennium.
  
 
  Very late last millenium, though.
  When I were young[er] we didn't have all these fancy yellow books.
 
  More seriously, yes, reading books about R and S is very effective and is
  how most of the R experts learned.  In my case it was the Blue Book, the
  White Book, and the Ripley/Venables/Smith notes on S-plus (which have
  evolved to the Introduction to R).

 In addition to books, the various manuals, contributed documents and
 mailing list archives, all of which one should review,
 the key thing to do if you want to really learn R is to read source code
 and lots of it.  I think there is no other way.  Furthermore, the fact that
 you can do this is really a key advantage of open source.

There has to be some reason to dig into the source code.  Just starting at
line 1 and reading until you are enlightened would be frustrating,
repetetive, and nearly pointless.  The great benefits of the R books is
that they have interesting results (a fancy graph, analysis, or report)
that you can trace back to the constituent parts and (with open source
code) learn everything you want to and be confident that the rest is there
if you need it.  Books using R do an excellent job of showing what is
possible and, through recursive study of the open source code, how to do
it.  Books connect high-level tasks to low-level functions.

R has plenty of documentation, but if the measure of excellence is simply
number of pages or weight, SAS's documentation might still win even if we
include the pages of R source code.  Both packages have lots of detailed
documentation, where if you understood everything that was written, you'd
know how to do what you want.  The authors of neither R nor SAS have
failed to document their functions.

Where I think the R (and SAS) documentation is lacking is in the
connections between the documentation elements.  RTFM isn't helpful if you
can't find TFM.  For instance, there is more than one way to make a graph,
(see http://addictedtor.free.fr/graphiques/thumbs.php?sort=package for 135
of them) how does a novice know which function to use?  How do you find
out the alternate ways to do things?  The hateful MS Excel solves this by
registering the alternate graphic capabilities under a hierarchical GUI
menu.  We solve it with an email list and several fuzzy searches.

Since R has such an extensive set of extensions, maybe we need a section
in the R-intro documentation near
http://cran.r-project.org/doc/manuals/R-intro.html#Writing-your-own-functions
titled Finding existing functions.  It could explain the difference
between base and recommended, installed, CRAN, and how someone can find
and use things in these areas using help(), '?', help.search(),
help.start(), RSiteSearch(), and the mailing lists.

Dave
-- 
 Dr. David Forrest
 [EMAIL PROTECTED](804)684-7900w
 [EMAIL PROTECTED] (804)642-0662h
   http://maplepark.com/~drf5n/

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

2006-01-09 Thread Mark Leeds
Sometimes I print out a package
and read about it and there
are sometimes nice examples
that I would like to run myself.
 
Is there a way to bring them
into R from the package or
are they only meant to be typed
in manually ? If manual is the
only way, that's fine. I was
just checking whether there was
a quicker way. Thanks.
 
   Mark


**
This email and any files transmitted with it are confidentia...{{dropped}}

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


Re: [R] Wikis etc.

2006-01-09 Thread Jack Tanner
Michael Dewey wrote:
At 20:12 08/01/06, Jack Tanner wrote:
My hypothesis is that the basic reason that people ask questions on R-help 
rather than first looking elsewhere is that looking elsewhere doesn't get 
them the info they need.

People think in terms of the tasks they have to do. The documentation for 
R, which can be very good, is organized in terms of the structure of R, 
its functions. This mismatch -- people think of tasks, the documentation 
thinks in functions -- causes people to turn to the mailing list.

Further to that I feel that (perhaps because they do not like to blow their 
own trumpet too much) the authors of books on R do not stress how much most 
questioners could gain by buying and reading at least one of the many books 
on R. When I started I found the free documents useful but I made most 
progress when I bought MASS. I do realise that liking books is a bit last 
millennium.

I certainly agree about the value of books. After struggling with 
lme/glmmPQL documentation for a while, I found a copy of MASS, and it's been 
nothing short of illuminating.

Gabor Grothendieck ggrothendieck at gmail.com wrote:
In addition to books, the various manuals, contributed documents and
mailing list archives, all of which one should review,

I do not wish to disparage all these valuable resources. But it is apparent 
that they do not answer the (real or perceived) needs of those who ask the 
same more or less basic questions over and over on R-help. It doesn't help 
if one, or ten, or hundreds of newbies are told -- go thee and RTFM, 
because, by definition, there will be other newbies (presumably, until the 
entire human race consists of R experts).

the key thing to do if you want to really learn R is to read source code
and lots of it.  I think there is no other way.  Furthermore, the fact that
you can do this is really a key advantage of open source.

Absolutely, the R sources are the highest fidelity representation of the 
knowledge on R. But there's also knowledge about the sources, e.g., why a 
particular function was coded that way, and why one would want to use that 
function over others that seem similar.

The wiki proposal is thus twofold: first, to take the key advantage of open 
source, and apply it not only to the code, but to the knowledge about the 
code as well. Second, to structure the experience of learning and using R 
such that the wiki is very prominent.

Unfortunately, the site is down at the moment, but there's a really good 
example of how wikified, task-oriented documentation can help an open source 
project: http://codex.wordpress.org/Main_Page .

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

2006-01-09 Thread Uwe Ligges
Mark Leeds wrote:

 Sometimes I print out a package
 and read about it and there
 are sometimes nice examples
 that I would like to run myself.
  
 Is there a way to bring them
 into R from the package or
 are they only meant to be typed
 in manually ? If manual is the
 only way, that's fine. I was
 just checking whether there was
 a quicker way. Thanks.

See (you won't believe it): ?example

Uwe Ligges




Mark
 
 
 **
 This email and any files transmitted with it are confidentia...{{dropped}}
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

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


Re: [R] R newbie example code question

2006-01-09 Thread Mark Leeds
wow. example() was exactly what
I wanted.  you all have made all these
incredible facilities 
for a new person.  thanks.

mark


-Original Message-
From: Uwe Ligges [mailto:[EMAIL PROTECTED] 
Sent: Monday, January 09, 2006 1:30 PM
To: Mark Leeds
Cc: R-Stat Help
Subject: Re: [R] R newbie example code question

Mark Leeds wrote:

 Sometimes I print out a package
 and read about it and there
 are sometimes nice examples
 that I would like to run myself.
  
 Is there a way to bring them
 into R from the package or
 are they only meant to be typed
 in manually ? If manual is the
 only way, that's fine. I was
 just checking whether there was
 a quicker way. Thanks.

See (you won't believe it): ?example

Uwe Ligges




Mark
 
 
 **
 This email and any files transmitted with it are
confidentia...{{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



**
This email and any files transmitted with it are confidentia...{{dropped}}

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


Re: [R] R newbie example code question

2006-01-09 Thread John Sorkin
Mark,
I am not user where you find your reading material, but if it is online, 
perhaps you can copy and paste it into an R session.
John

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

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

410-605-7119 
- NOTE NEW EMAIL ADDRESS:
[EMAIL PROTECTED]

 Mark Leeds [EMAIL PROTECTED] 1/9/2006 1:20 PM 
Sometimes I print out a package
and read about it and there
are sometimes nice examples
that I would like to run myself.
 
Is there a way to bring them
into R from the package or
are they only meant to be typed
in manually ? If manual is the
only way, that's fine. I was
just checking whether there was
a quicker way. Thanks.
 
   Mark


**
This email and any files transmitted with it are confidentia...{{dropped}}

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

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


Re: [R] repeat { readline() }

2006-01-09 Thread Luke Tierney
Use tryCatch; try behaves the way it does with respect to interrupts
for historical compatibility.

luke

On Sun, 8 Jan 2006, hadley wickham wrote:

 On a related note, does anyone know how to exit:

 repeat { try( readline() ) }

 The try block captures Ctrl-C.

 Hadley

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


-- 
Luke Tierney
Chair, Statistics and Actuarial Science
Ralph E. Wareham Professor of Mathematical Sciences
University of Iowa  Phone: 319-335-3386
Department of Statistics andFax:   319-335-3017
Actuarial Science
241 Schaeffer Hall  email:  [EMAIL PROTECTED]
Iowa City, IA 52242 WWW:  http://www.stat.uiowa.edu

__
R-help@stat.math.ethz.ch 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] warning message from nlme

2006-01-09 Thread Doran, Harold
Yen Lin:

I'd like to try and offer a little help, but I'm still unclear on your
data structure and problem. You say, they are all categorical variables.
But, does this apply also to your dependent variable? If so, lme is the
wrong function to use.

You also say you want to decompose tha variation into wafer, axis,
orientation and data. But then, what is loc. Do you mean you want to
decompose the variation in data, your DV, into multiple components
including wafer, axis, orientation and loc?

Maybe if you can take some time to clarify your data structure in more
detail and why your lme call is structured as it is it might be easier
to help.

Harold


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Chia, Yen Lin
Sent: Monday, January 09, 2006 12:42 PM
To: Berton Gunter
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] warning message from nlme

Hi all,

Sorry for the sloppy description of problem.  

I have a dataset called dense.  I want to decompose the
variability/variation into different components such as wafer, axis,
orientation and data.  These variables are all categorical data.  I
converted axis, orientation and location into factors before I ran the
analysis:

lme(Data~1,random=~1|Wafer/axi/ori/loc,data=Dense)

The algorithm returns the standard deviation of each random effect, but
also gives the warning message:

Warning message:
- not meaningful for factors in: Ops.factor(y[revOrder], Fitted)


I wonder what does this warning message mean?  If the factors are not
meaningful, how can I find out which factors the warning message is
referring to?  Thanks.

Yen Lin





-Original Message-
From: Berton Gunter [mailto:[EMAIL PROTECTED]
Sent: Monday, January 09, 2006 9:34 AM
To: Chia, Yen Lin
Subject: RE: [R] warning message from nlme

 
 Can someone point out what is the meaning of this warning message? I 
 tried to look at Ops.factor, but I don't understand it since I'm 
 relatively new to R.  Thanks.
 

No. **Read the posting guide**  and provide sufficient details in your
post so that an answer can be given.

-- Bert

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

2006-01-09 Thread Gabor Grothendieck
On 1/9/06, Jack Tanner [EMAIL PROTECTED] wrote:
 Michael Dewey wrote:
 At 20:12 08/01/06, Jack Tanner wrote:
 My hypothesis is that the basic reason that people ask questions on R-help
 rather than first looking elsewhere is that looking elsewhere doesn't get
 them the info they need.
 
 People think in terms of the tasks they have to do. The documentation for
 R, which can be very good, is organized in terms of the structure of R,
 its functions. This mismatch -- people think of tasks, the documentation
 thinks in functions -- causes people to turn to the mailing list.
 
 Further to that I feel that (perhaps because they do not like to blow their
 own trumpet too much) the authors of books on R do not stress how much most
 questioners could gain by buying and reading at least one of the many books
 on R. When I started I found the free documents useful but I made most
 progress when I bought MASS. I do realise that liking books is a bit last
 millennium.

 I certainly agree about the value of books. After struggling with
 lme/glmmPQL documentation for a while, I found a copy of MASS, and it's been
 nothing short of illuminating.

 Gabor Grothendieck ggrothendieck at gmail.com wrote:
 In addition to books, the various manuals, contributed documents and
 mailing list archives, all of which one should review,

 I do not wish to disparage all these valuable resources. But it is apparent
 that they do not answer the (real or perceived) needs of those who ask the
 same more or less basic questions over and over on R-help. It doesn't help
 if one, or ten, or hundreds of newbies are told -- go thee and RTFM,
 because, by definition, there will be other newbies (presumably, until the
 entire human race consists of R experts).

I certainly was not disparaging books.  I said _in addition to_ books,
not _insted of_.  The reason I pointed this out is that I think
most people already read the books.  What many people don't
do as far as can tell is read the code.  Obviously if you are just
starting out you are going to be relying on the documentation,
books, etc. but once you get past the intro stage you need to get
into code.  One repeatedly sees questions on this list where just
a minute or two spent with the code would have answered the
question.

__
R-help@stat.math.ethz.ch 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] product of multidimensional tables

2006-01-09 Thread Nachiketa Sahoo
Hi,

I am trying to carry out the product between two multi dimensional tables,
e.g. A with dim = c(2,2,3,4) and B with dim = c(2,3,4). So, I want to outer
multiply each 3x4 table in A[i,j,,] with B[k,,] to get a table C of dim =
c(2,2,3,4,3,4).

This arises in scenario of conditional probability tables. A could be a
table taking probability values for different values of variables s,t,u,v
and B taking values for different values of variables t,p,q. I want to get a
table of factor (different from the factor in R) got by multiplying these
two CPTs. The new table C will have dimensions (variables) s,t,u,v,p,q as a
result of product of these two.

I am looking at the apply() method as an aid to get this done. But, it seems
that I can't get a multidimensional output by applying any FUN funtion in
apply(X, MARGIN, FUN, ...). for instance a outer product of two vectors
gives back another vector and not a 2 dimensional array.

So, any thoughts on this? Any other place I should be looking at?

Thanks,
Nachi

[[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] kein Betreff

2006-01-09 Thread stefan semmelring
Hallo,



I´m trying to find out how I can start WinEdt always directly when R is started.

Does anybody know how to do so? I tried to find it out by myself but had no 
fortune.

Maybe you have to compile (?) a certain file. (I am usind R in the latest 
version on Win XP)

Thank You



Stefan

__
R-help@stat.math.ethz.ch 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] automatic start of RWinEdt

2006-01-09 Thread stefan semmelring

stefan semmelring [EMAIL PROTECTED] schrieb am 09.01.06 21:31:01:
 
 Hallo,
 
 
 
 I´m trying to find out how I can start WinEdt always directly when R is 
 started.
 
 Does anybody know how to do so? I tried to find it out by myself but had no 
 fortune.
 
 Maybe you have to compile (?) a certain file. (I am usind R in the latest 
 version on Win XP)
 
 Thank You
 
 
 
 Stefan
  


__
R-help@stat.math.ethz.ch 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] brown, durbin , evans ( 1975 )

2006-01-09 Thread Mark Leeds
Does anyone know where
I can get  R code for plotting
the Brown , Durbin
and Evans cumsum
procedure ( 1975 ) ?
 
I wrote my own code but
I am a little worried
that my confiodence bands
may not be correct ( I find the formula
in the original paper confusing and S+Finmetrics
has a formula but that formula implies that
there should be 4 lines as far as I can tell ) so
I would like to see someone
else's code also if it's out
there ? Thanks.
 
  Mark
 
P.S : Strucchange looks like a great package but
it would take me way longer than I
have to only partially understand the theory behind
what is going on there.
 
 
 
 
 
 


**
This email and any files transmitted with it are confidentia...{{dropped}}

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


Re: [R] paste tab and print

2006-01-09 Thread vincent
Prof Brian Ripley a écrit :

 cat(info, \n)

Thank you very much. It works.

__
R-help@stat.math.ethz.ch 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 either glmmPQL or lme/lmer

2006-01-09 Thread Jack Tanner
I know it's conventional to report bugs to the maintainer, but I'm not sure 
which package actually contains this bug(s), so I apologize for sending this 
to the list at large. I see the bug under both R 2.1.1, and R 2.2.1. (I sent 
a related message a while ago, but this one has more detail.)

library(MASS)
library(nlme)

fit.model - function(il, model.family) {
  cs - Initialize(corSymm(form=~1|id), data=il)
  glmmPQL(score~test+coder, random=~1|id, family=model.family, data=il, 
correlation=cs)
}

score - 
c(1,8,1,3,4,4,2,5,3,6,0,3,1,5,0,5,1,11,1,2,4,5,2,4,1,6,1,2,8,16,5,16,3,15,3,12,4,9,2,4,1,8,2,6,4,11,2,9,3,17,2,6)
id - rep(1:13, rep(4, 13))
test - gl(2, 1, length(score), labels=c(pre, post))
coder - gl(2, 2, length(score), labels=c(two, three))

original - data.frame(id, score, test, coder)

sorted.ok - original[order(original$id, original$score, original$test, 
original$coder),]
sorted2.ok - original[order(original$id, original$test, original$score, 
original$coder),]
sorted3.not.ok - original[order(original$score, original$id, original$test, 
original$coder),]

print(summary(fit.model(original, poisson)))
print(summary(fit.model(sorted.ok, poisson)))
print(summary(fit.model(sorted2.ok, poisson)))
print(summary(fit.model(sorted3.not.ok, poisson)))

That last line produces, under R version 2.1.1, 2005-06-20, i386-pc-mingw32

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

other attached packages:
MASS nlme
7.2-20 3.1-65

iteration 1
Error in logLik.reStruct(object, conLin) :
NA/NaN/Inf in foreign function call (arg 3)

That same last line produces, under R version 2.2.1, 2005-12-20, 
i386-pc-mingw32

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

other attached packages:
  MASS   nlme
  7.2-24 3.1-68.1

iteration 1
Error in lme.formula(fixed = zz ~ test + coder, random = ~1 | id, data = 
list( :
false convergence (8)

Moreover, summary(fit.model(original, poisson)) produces a different output 
than either
summary(fit.model(sorted.ok, poisson)) or summary(fit.model(sorted2.ok, 
poisson)), but the latter two do equal each other.

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

2006-01-09 Thread J Dougherty
On Monday 09 January 2006 11:31, Gabor Grothendieck wrote:
 . . .

 I certainly was not disparaging books.  I said _in addition to_ books,
 not _insted of_.  The reason I pointed this out is that I think
 most people already read the books.  What many people don't
 do as far as can tell is read the code.  Obviously if you are just
 starting out you are going to be relying on the documentation,
 books, etc. but once you get past the intro stage you need to get
 into code.  One repeatedly sees questions on this list where just
 a minute or two spent with the code would have answered the
 question.

Gabor,  

The issue IS the INTRO stage though, in fact well beyond the intro stage.  
Reading the code is well and good for a programmer, but many are not and 
never will be coders, and this group is going to continue to expand.  Even an 
advanced statistician migrating from a proprietary system like SPSS to R is 
going to need documentation.  They would not even know where in the code to 
look!  Code is cool, but it really isn't expository.

John

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


Re: [R] wicked wikis for R

2006-01-09 Thread J Dougherty
On Monday 09 January 2006 05:16, Jean-Christophe BOUETTE wrote:
  From: Arin Basu [EMAIL PROTECTED]
  To: r-help@stat.math.ethz.ch
  Date: 8 Jan 2006 19:18:17 -
  Subject: [R] wicked wikis for R
 
  Message: 41
  Date: Sun, 08 Jan 2006 13:52:33 +1100
   From: paul sorenson [EMAIL PROTECTED]
  Subject: Re: [R] Wikis etc.
  To: Frank E Harrell Jr [EMAIL PROTECTED], r-help
 r-help@stat.math.ethz.ch

 -snip-

  Among others, here's one long-term benefit for the newbies. Instead of
  people getting admonished/thrashed with harsh expressions/advices like
  go see the mailing list publishing etiquettes, or you should search
  the archives and help files, and read all manuals, and ask others first
  before posting here... (which can turn away many a newcomer from posting
  or using the mailing list or using R for that matter), wiki could make
  life a little easy for newbies/less experienced who could then receive
  more polite one liners like, please check the wikipages..., or
  solution #xyz in the wikipages for the solution.

 Sorry, I don't get the point here. Some people will keep feeling
 offensed when they're just told to read the man/wiki pages, and others
 will simply change their answers from RTFM to RTFW.
 Nobody can force people into reading the manuals, or reading the
 posting guide. This is definitely one problem that the wiki will not
 solve.


The real issue is indexing and cross-referencing.  Quite often requestors HAVE 
tried the manuals, but without a real clue about where to look, that can be 
unproductive.  On the other hand, being pulled up short and Ripleyed can have 
a salutary effect on analyzing the problem first and researching carefully 
before posting a clueless query.  You could see as a useful part of the 
learning process.

JD

__
R-help@stat.math.ethz.ch 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] automatic start of RWinEdt

2006-01-09 Thread ronggui
the readme file tells what you should do:


- In R use something like (for example in your .Rprofile):
   options(editor=\c:/program files/winedt team/winedt/winedt\
-c=\R-WinEdt-edit\ -e=r.ini -V)
   options(pager=\c:/program files/winedt team/winedt/winedt\
-C=\R-WinEdt\ -e=r.ini -V)


Used WinEdt parameters (Remark: There is a difference between -c and -C !):
-c=name: New instance of WinEdt called name will be started.
-C=name: If an instance name of WinEdt is already running,
it will be used.
   So you can run WinEdt as LaTeX and R editor at the same time.
-e=name: Using name as initialization-file.
-V   : Running in virgin-mode

Examples:

## Recommended procedure:
## Open WinEdt with something like:
 c:\program files\winedt team\winedt\winedt -C=R-WinEdt -e=r.ini
## i.e. ideally the shortcut you have already created.
##
## Then create a new document and write an R function.
## Click on the symbol R source or press ALT+S.
## You will be asked to specify a filename (e.g. R-prog1.R).
## If RGui is running, it will be focussed and source(.) will be called.

##
 options(pager=\c:/program files/winedt team/winedt/winedt\
-C=\R-WinEdt\ -e=r.ini -V)
 file.show(.Rhistory)
## Mark some lines, click the R paste button or use Alt+P as shortcut:
## Marked lines will be executed in RGui.

##
## The following way to edit function is possible, but *not* recommended:
 options(editor=\c:/program files/winedt team/winedt/winedt\
-c=\R-WinEdt-edit\ -e=r.ini -V)
 my.legend - legend
 fix(my.legend)

2006/1/10, stefan semmelring [EMAIL PROTECTED]:

 stefan semmelring [EMAIL PROTECTED] schrieb am 09.01.06 21:31:01:
 
  Hallo,
 
 
 
  I´m trying to find out how I can start WinEdt always directly when R is 
  started.
 
  Does anybody know how to do so? I tried to find it out by myself but had no 
  fortune.
 
  Maybe you have to compile (?) a certain file. (I am usind R in the latest 
  version on Win XP)
 
  Thank You
 
 
 
  Stefan
 
 

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



--
黄荣贵
Deparment of Sociology
Fudan University

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

[R] How to plot legend to the margin area of the graph?

2006-01-09 Thread Vincent Deng
Dear R-helpers,


When plotting a graph, what command should I use to mark legend to the
margin area of that graph?

__
R-help@stat.math.ethz.ch 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 with nested/nonnested groupings?

2006-01-09 Thread Andrew Gelman
I'm trying to figure out how to use lmer to fit models with factors that 
have some nesting and some non-nested groupings.  For example, in this 
paper:
http://www.stat.columbia.edu/~gelman/research/published/parkgelmanbafumi.pdf
we have a logistic regression of survey respondents' political 
preferences (1=Republican, 0=Democrat), regressing on sex, ethnicity, 
state (51 states within 5 regions), 4 age categories, and 4 education 
categories.  I'd like to include states (nested within regions), and 
also age, education, and age x education.  (That is, 5 batches of 
varying coefs:  50 states, 5 regions, 4 age categories, 4 education 
categories, and 16 age x education categories.)  The age x education 
factor is kinda tricky because it's connected both to age and to education.

I'm thinking of a model like this:

lmer (y ~ black*female + (1 | state) + (1 | region) + (1 | age) + (1 | 
edu) + (1 | age.edu), family=binomial(link=logit))

(Here, I'm thinking of age.edu as a variable with 16 levels.)

Anyway, it blows up when i try to put in these nested things.  I read 
Doug Bates's article in R-news and there seems to be a  way of doing 
nested groupings (unfortunately, I can't quite figure out how to do it), 
but I don't see any references to situations such as age, edu, and age*edu .

For the article, we used Bugs, which is fine, but I'd like to see how 
far I can take it using lmer.  I could kludge it by, for example, 
including age, edu, and region as unmodeled factors:

lmer (y ~ black*female + (1 | state) + factor(region) + factor(age) + 
factor(edu) + (1 | age.edu), family=binomial(link=logit))

but I'd like to do the full multilevel version.

Thanks!
Andrew

-- 
Andrew Gelman
Professor, Department of Statistics
Professor, Department of Political Science
[EMAIL PROTECTED]
www.stat.columbia.edu/~gelman

Tues, Wed, Thurs:  
  Social Work Bldg (Amsterdam Ave at 122 St), Room 1016
  212-851-2142
Mon, Fri:
  International Affairs Bldg (Amsterdam Ave at 118 St), Room 711
  212-854-7075

Mailing address:
  1255 Amsterdam Ave, Room 1016
  Columbia University
  New York, NY 10027-5904
  212-851-2142
  (fax) 212-851-2164

__
R-help@stat.math.ethz.ch 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] wiki in Hamburg set read-only

2006-01-09 Thread Detlef Steuer
Hi, 

to clear up the situation regarding wikis a bit and
since, whatever happens, Philippe's wiki is superior, I decided to set the old 
wiki read-only. A visitor will be asked to visit the new wiki and add 
contents there. Good luck Philippe! Your plans sound very nice!

The new wiki should get visibly mentioned on the R frontpage, so that 
especially beginners have a good chance to find it. Let's add content!

Detlef

__
R-help@stat.math.ethz.ch 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] brown, durbin , evans ( 1975 )

2006-01-09 Thread Achim Zeileis
Mark:

 Does anyone know where
 I can get  R code for plotting
 the Brown , Durbin
 and Evans cumsum
 procedure ( 1975 ) ?

Via
library(strucchange)

 P.S : Strucchange looks like a great package but
 it would take me way longer than I
 have to only partially understand the theory behind
 what is going on there.

Come on, it's not that difficult, e.g., for detecting the mean shift in
  plot(Nile)
you can apply BDE's Recursive CUSUM test via
  rcus - efp(Nile ~ 1, type = Rec-CUSUM)
  plot(rcus)
which shows quite clearly the structural change that occured in 1898 after
the Ashwan dam was built. You can get test statistic and p-value via
  sctest(rcus)

See the package vignette and the man pages for more examples.

As I already told you privately, a lot of research was done after BDE 1975
and the test is not the most suitable in various situations. For example,
it can perform quite badly in the presence of multiple shifts or shifts
that occur late in the sample period.

Best,
Z

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


Re: [R] How to plot legend to the margin area of the graph?

2006-01-09 Thread Uwe Ligges
Vincent Deng wrote:

 Dear R-helpers,
 
 
 When plotting a graph, what command should I use to mark legend to the
 margin area of that graph?

Example:

plot(1:10)
par(xpd=TRUE)
legend(8,11.5,Hello World)

Uwe Ligges


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