Re: [R] Re: diamond graphs and patents

2003-08-28 Thread Patrick Connolly
On Wed, 27-Aug-2003 at 01:40PM -0400, Alvaro Muñoz wrote:

| Drs. Harrell and O'Keefe,
| 
| 
| 
| Thank you for your suggestions.
| 

| Although it is at odds with your beliefs, University staff working
| on licensing and technology transfer believe that a patent may be a
| vehicle to achieve a wide use.

Wider than if it were public domain?

It's probably fair to say that it is an improvement over 3D bar charts
and that it can be built into point and click software more easily
than, say, contour plots could.  If Microsoft were to pay the
university a licensing fee to incorporate such plots, then 'wide use'
could result and the university would benefit.  But that's a big IF.

best

-- 
Patrick Connolly
HortResearch
Mt Albert
Auckland
New Zealand 
Ph: +64-9 815 4200 x 7188
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~
I have the world`s largest collection of seashells. I keep it on all
the beaches of the world ... Perhaps you`ve seen it.  ---Steven Wright 
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] Using files as connections

2003-08-28 Thread maj
I have been trying to read a random sample of lines from a file into a
data frame using readLines(). The help indicates that readLines() will
start from the current line if the connection is open, but presented with
a closed connection it will open it, start from the beginning, and close
it when finished.

In the code that follows I tried to open the file before reading but
apparently without success, because the result was repeated copies of the
first line:

flines - 107165
slines - 100
selected - sort(sample(flines,slines))
strvec - rep(“”,slines)
file(“c:/data/perry/data.csv”,open=r)
isel - 0
for (iline in 1:slines) {
  isel - isel + 1
  cline - readLines(“c:/data/perry/data.csv”,n=1)
  if (iline == selected[isel]) strvec[isel] - cline else
isel - isel - 1
}
close(“c:/data/perry/data.csv”)
sel.flows - read.table(textConnection(strvec), header=FALSE, sep=,)


There was also an error no applicable method  for close.

Comments gratefully received.

Murray Jorgensen

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] equivalent of SAS's PROC LATTICE

2003-08-28 Thread Dowkiw, Arnaud
Dear R helpers,
 
is there an equivalent of SAS's PROC LATTICE in R ?
I have a partially balanced square lattice design to study and I want to compare 
lattice based analysis with the randomized complete block approach.
Thanks a lot for your help,
 
Arnaud 

DISCLAIMER**...{{dropped}}

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Newbie graphing questions

2003-08-28 Thread Andrew C. Ward
Dear Francisco,

1. Have a look at ?Devices which (under Windows at least)
   lists a range of devices you can open before and
   between plots.
2. Use par(ask=TRUE) before you start your plots
3. Christophe Declercq provided an excellent example on this
   mailing list, under the topic curves with shaded areas.
   Search for that in the archives.


Regards,

Andrew C. Ward

CAPE Centre
Department of Chemical Engineering
The University of Queensland
Brisbane Qld 4072 Australia
[EMAIL PROTECTED]


Quoting Francisco J. Bido [EMAIL PROTECTED]:

 Hi everyone.  R is new to me and I'm very impressed with
 its 
 capabilities but still cannot figure out how to do some
 basic things.  
 There seems to be no lack of documentation but finding
 what I need has 
 proven difficult.  Perhaps you can help.
 
 Here's what I'm after:
 
 1.  How do I create a new plot without erasing the prior
 one i.e., have 
 a new window pop up with the new graph? I'm on MacOSX
 using the Carbon 
 port.
 
 2.  How do I pause between plot renderings i.e., in such
 a way that it 
 will draw the subsequent graph after pressing the space
 bar (or any 
 other key).
 
 3.  Illustrating critical regions.  Say I wanted to
 illustrate the 
 critical region of a standard normal.  I would need to
 draw a vertical 
 line from the critical point to the curve and then shade
 the critical 
 region.  How do I do this in R?
 
 Thanks!
 -Francisco
 
 __
 [EMAIL PROTECTED] mailing list
 https://www.stat.math.ethz.ch/mailman/listinfo/r-help


__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Re: diamond graphs and patents

2003-08-28 Thread David Scott

My reaction when learning of a proposed patent on a new graph was: oh 
well, that's something I can forget about. Without a patent, code would 
have been available in R in a very short period of time, the statistical 
community would have been able to play around with it, see how it worked 
on various problems. If the graph proved useful it would make its way into 
statistical practice. With a patent none of that seems possible. Prof 
Munoz has had fun exploring his creation, but if any of us are to do 
likewise I guess we will either pay up or secretly write code and play 
around with diamond graphs while hidden in the basement.

Getting a graph used is not that simple I think. Boxplots are now an 
extremely useful tool, but lets not forget that Tukey also invented the 
hanging rootogram.

As for Microsoft getting involved, God help us. Excel still doesn't do 
boxplots does it? Not to mention the quality of their implementation of 
most of their statistical routines.

Like others I welcome the contribution of those at Johns Hopkins to the 
debate. And they perhaps shouldn't worry about us here at R-help, who are 
maybe just a fringe element of open source loving anti-M$ weirdos. Then 
again we may be the last bastion of open scientific enquiry.

David Scott

_
David Scott Department of Statistics, Tamaki Campus
The University of Auckland, PB 92019
AucklandNEW ZEALAND
Phone: +64 9 373 7599 ext 86830 Fax: +64 9 373 7000
Email:  [EMAIL PROTECTED] 


Graduate Officer, Department of Statistics

Webmaster, New Zealand Statistical Association:
http://www.stat.auckland.ac.nz/nzsa/

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] trying to produce an array of ranks

2003-08-28 Thread John Christie
OK, I am try to produce an array of ranks.  I have a set of data (s) 
that looks like this

rt  subj
312 dave
467 dave
411 dave
383 kim
398 kim
...
Now I want to make a column that is an array of the ranks of rt by 
subject.  The closest of gotten is using the following.

r - by (s, s$subj, function(d) rank(d[1]))

This gets the data out with ranks but I cannot figure out how to easily 
extract each of the lists and turn the whole thing into a nice straight 
array (it is an array of lists when unclassed).  I couldn't get 
anything working with any of the apply's or ave.  Any suggestions?  
This seems like it should be a common task.

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Using files as connections

2003-08-28 Thread Tony Plate
You need to save the connection object returned by file() and then use that 
object in other functions.

You need to change the appropriate lines to the following (at least):

con - file(c:/data/perry/data.csv,open=r)
  cline - readLines(con,n=1)
close(con)
(I don't know if more changes are needed to get it working.)

Note that using the connection object in other functions can have side 
effects on the connection object (which is how a connection remembers its 
point in the file.) (Perhaps more accurately, the side effect is on the 
internal system data referred to by the R connection object.)

 con - textConnection(letters)
 con
 descriptionclass mode text
   letters textConnection  r   text
  opened can readcan write
openedyes no
 readLines(con, 1)
[1] a
 readLines(con, 1)
[1] b
 con.saved - con
 readLines(con, 1)
[1] c
 readLines(con.saved, 1)
[1] d
 readLines(con, 1)
[1] e
 identical(con, con.saved)
[1] TRUE
 showConnections()
  description classmode text   isopen   can read can write
3 letters   textConnection r  text opened yesno


hope this helps,

Tony Plate

At Thursday 11:19 AM 8/28/2003 +1200, you wrote:
I have been trying to read a random sample of lines from a file into a
data frame using readLines(). The help indicates that readLines() will
start from the current line if the connection is open, but presented with
a closed connection it will open it, start from the beginning, and close
it when finished.
In the code that follows I tried to open the file before reading but
apparently without success, because the result was repeated copies of the
first line:
flines - 107165
slines - 100
selected - sort(sample(flines,slines))
strvec - rep(,slines)
file(c:/data/perry/data.csv,open=r)
isel - 0
for (iline in 1:slines) {
  isel - isel + 1
  cline - readLines(c:/data/perry/data.csv,n=1)
  if (iline == selected[isel]) strvec[isel] - cline else
isel - isel - 1
}
close(c:/data/perry/data.csv)
sel.flows - read.table(textConnection(strvec), header=FALSE, sep=,)
There was also an error no applicable method  for close.

Comments gratefully received.

Murray Jorgensen

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


RE: [R] Using files as connections

2003-08-28 Thread Liaw, Andy
You are using the connection the wrong way.  You need to do something like:

fcon - file(c:/data/perry/data.csv, open=r)
for (iline in 1:slines) {
isel - isel + 1
cline - readLines(fcon, n=1)
...
}
close(fcon)

BTW, here's how I'd do it (not tested!):

strvec - rep(,slines)
selected - sort(sample(flines, slines))
skip - c(0, diff(selected) - 1)
fcon - file(c:/data/[erry/data.csv, open=r)
for (i in 1:length(skip)) {
## skip to the selected line
readLines(fcon, n=skip[i])
strvec[i] - readLines(fcon, n=1)
}
close(fcon)

HTH,
Andy


 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
 Sent: Wednesday, August 27, 2003 7:19 PM
 To: [EMAIL PROTECTED]
 Subject: [R] Using files as connections
 
 
 I have been trying to read a random sample of lines from a 
 file into a data frame using readLines(). The help indicates 
 that readLines() will start from the current line if the 
 connection is open, but presented with a closed connection it 
 will open it, start from the beginning, and close it when finished.
 
 In the code that follows I tried to open the file before 
 reading but apparently without success, because the result 
 was repeated copies of the first line:
 
 flines - 107165
 slines - 100
 selected - sort(sample(flines,slines))
 strvec - rep(,slines)
 file(c:/data/perry/data.csv,open=r)
 isel - 0
 for (iline in 1:slines) {
   isel - isel + 1
   cline - readLines(c:/data/perry/data.csv,n=1)
   if (iline == selected[isel]) strvec[isel] - cline else
 isel - isel - 1
 }
 close(c:/data/perry/data.csv)
 sel.flows - read.table(textConnection(strvec), header=FALSE, sep=,)
 
 
 There was also an error no applicable method  for close.
 
 Comments gratefully received.
 
 Murray Jorgensen
 
 __
 [EMAIL PROTECTED] mailing list 
 https://www.stat.math.ethz.ch/mailman/listinfo /r-help
 

--
Notice:  This e-mail message, together with any attachments,...{{dropped}}

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] R workshop in Australia

2003-08-28 Thread Peter Dunn
Need some help with R? 

An R workshop, led by John Maindonald, is planned for the 1st October 
at the University of Southern Queensland, Toowoomba, Australia. The 
workshop is being organised by the Queensland branch of the 
Statistical Society of Australia as part of their conference. 

The workshop consists of a morning session with John Maindonald, 
the author of the forthcoming book  Data Analysis and Graphics 
Using R: An Example-Based Approach (with John Braun) 

This will be followed by a closer look at some other R packages 
in the afternoon (Bioconductor, nlme, etc).  

The cost for the one-day workshop is only $50 for the whole day 
(includes notes, morning and afternoon tea,  but not lunch). 

Anyone interested in attending can find out more by looking at 
http://www.sci.usq.edu.au/staff/dunn/qstatconf/workshops.html
Registration forms are available from 
http://www.sci.usq.edu.au/staff/dunn/qstatconf/registration.html

Anyone is, of course, welcome to attend the conference also, 
but it is not necessary if you just wish to attend the 
R workshop. 

-- 
Ross Darnell 
Organising committee 
Email: [EMAIL PROTECTED] 

-- 
Dr Peter Dunn  (USQ CRICOS No. 00244B)
  Web:http://www.sci.usq.edu.au/staff/dunn
  Email:  dunn @ usq.edu.au
Opinions expressed are mine, not those of USQ.  Obviously...

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] R workshop in Australia

2003-08-28 Thread Peter Dunn
Need some help with R?

An R workshop, led by John Maindonald, is planned for the 1st October
at the University of Southern Queensland, Toowoomba, Australia. The
workshop is being organised by the Queensland branch of the
Statistical Society of Australia as part of their conference.

The workshop consists of a morning session with John Maindonald,
the author of the forthcoming book  Data Analysis and Graphics 
Using R: An Example-Based Approach (with John Braun)

This will be followed by a closer look at some other R packages
in the afternoon (Bioconductor, nlme, etc).  

The cost for the one-day workshop is only $50 for the whole day
(includes notes, morning and afternoon tea,  but not lunch).

Anyone interested in attending can find out more by looking at 
http://www.sci.usq.edu.au/staff/dunn/qstatconf/workshops.html
Registration forms are available from 
http://www.sci.usq.edu.au/staff/dunn/qstatconf/registration.html

Anyone is, of course, welcome to attend the conference also,
but it is not necessary if you just wish to attend the
R workshop.

-- 
Peter Dunn
Organising committee
Email: [EMAIL PROTECTED]

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] R tools for large files

2003-08-28 Thread Richard A. O'Keefe
Duncan Murdoch [EMAIL PROTECTED] wrote:
One complication with reading a block at a time is what to do when you
read too far.

It's called buffering.

Not all connections can use seek() to reposition to the
beginning, so you'd need to read them one character at a time, (or
attach a buffer somehow, but then what about rw connections?)

You don't need seek() to do buffered block-at-a-time reading.
For example, you can't lseek() on a UNIX terminal, but UNIX C stdio
*does* read a block at a time from a terminal.

I don't see what the problem with read-write connections is supposed
to be.  When you want to read from such a connection, you first force
out any buffered output, and then you read a buffer's worth (if
available) of input.  Of course the read buffer and the write buffer
are separate (C stdio has traditionally got this wrong, with the perverse
consequence that you have to fseek() when switching from reading to writing
or vice versa, but that doesn't mean it can't be got right).


To put all this in context though, remember that S was designed in a UNIX
environment to work in a UNIX environment and it was always intended to
exploit UNIX tools.  Even on a Windows box, if you get R, you get a
bunch of the usual UNIX tools with it.  Amongst other things, Perl is
freely available for Windows, a Perl program to read a couple of
hundred thousand records and spit them out in platform binary would
only be a few lines long, and R _is_ pretty good at reading binary data.
It really is important that R users should be allowed to use it the way
that the language was designed to be used.

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Re: diamond graphs and patents

2003-08-28 Thread Ko-Kang Kevin Wang
I have been reading this discussion (or debate, depends on your point of 
view) with great interest in the last few days.

On Thu, 28 Aug 2003, David Scott wrote:

 My reaction when learning of a proposed patent on a new graph was: oh 
 well, that's something I can forget about. Without a patent, code would 
 have been available in R in a very short period of time, the statistical 
 community would have been able to play around with it, see how it worked 
 on various problems. If the graph proved useful it would make its way into 
 statistical practice. With a patent none of that seems possible. Prof 
 Munoz has had fun exploring his creation, but if any of us are to do 
 likewise I guess we will either pay up or secretly write code and play 
 around with diamond graphs while hidden in the basement.

I agree.  The question, IMHO, is not whether the diamond graph is a good 
visualising tool or not -- because it still remains to be seen, but on the 
idea of having it patented.

I completely agree with Dr. Ihaka that the only reason that makes R so 
popular and widely used across the academia, research institutes and even 
many large commercial companies, is that it is free and open-sourced.

It is certainly going to be interesting to write up some functions in R 
that draws diamond graphs, and then test them on some simulated and real 
world data.  But as Associate Professor Scott pointed out, with a patent 
on diamond graph (should the application be accepted), I am not sure if 
this is possible.

With patenting in mind, I have been think what would the world like if 
histograms, bargraphs, boxplots...etc. were patented by the original 
inventors!  The idea of patenting a graph seems to me like patenting a 
mathematical/statistical theorem.  Again, if for example the Central 
Limit theorem is patented, does it mean we have to pay whenever we want to 
make inference from it?

There are many software that offers educational institution an academic 
license, and offers students a student license.  But the thought of the 
possibility of having to pay for using a graph (or writing codes to draw 
the graph) is.

 Getting a graph used is not that simple I think. Boxplots are now an 
 extremely useful tool, but lets not forget that Tukey also invented the 
 hanging rootogram.

What is a hanging rootogram? ;-D

 As for Microsoft getting involved, God help us. Excel still doesn't do 
 boxplots does it? Not to mention the quality of their implementation of 
 most of their statistical routines.

Even those graphs that Excel does do, e.g. histograms, it does not do a 
very good job in them.  It has been, what, over a decade now since the 
first version of Excel was released?  I cannot keep myself from wondering 
why Excel still produces ugly graphs.


-- 
Cheers,

Kevin

--
On two occasions, I have been asked [by members of Parliament],
'Pray, Mr. Babbage, if you put into the machine wrong figures, will
the right answers come out?' I am not able to rightly apprehend the
kind of confusion of ideas that could provoke such a question.

-- Charles Babbage (1791-1871) 
 From Computer Stupidities: http://rinkworks.com/stupid/

--
Ko-Kang Kevin Wang
Master of Science (MSc) Student
SLC Tutor and Lab Demonstrator
Department of Statistics
University of Auckland
New Zealand
Homepage: http://www.stat.auckland.ac.nz/~kwan022
Ph: 373-7599
x88475 (City)
x88480 (Tamaki)

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] Packages

2003-08-28 Thread Emilio A. Laca

I need to install some geostatistics packages that are not in the binaries,
for example gstat. I downloaded rm171 and installed, and I even added
precomplied packages successfully. Unfortunately, I do not know how to add
packages available as gstat. If you can spare a minute, could you give me a
lead on this?
Any other pointers on using R in mac os x will be greatly appreciated.

Thank you so much for your time on this question, and for everything you put
into rmac!

EAL


==
Emilio A. Laca 
One Shields Avenue, 2306 PES Building
Agronomy and Range Science[EMAIL PROTECTED]
University of California  fax: (530) 752-4361
Davis, California  95616(530) 754-4083

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Newbie graphing questions

2003-08-28 Thread Francisco J. Bido
Thanks Hedderik, Andrew, David and of course, you Mark.  You have all 
been very helpful.  I got good answers two 1. and 2. and arsenal of 
ideas for 3.  Mark's solution for 3. is exactly what I was thinking 
about.  I'm indeed very grateful.

Best,
-Francisco




On Wednesday, August 27, 2003, at 09:36 PM, Marc Schwartz wrote:

On Wed, 2003-08-27 at 17:28, Francisco J. Bido wrote:
Hi everyone.  R is new to me and I'm very impressed with its
capabilities but still cannot figure out how to do some basic things.
There seems to be no lack of documentation but finding what I need has
proven difficult.  Perhaps you can help.
Here's what I'm after:

1.  How do I create a new plot without erasing the prior one i.e., 
have
a new window pop up with the new graph? I'm on MacOSX using the Carbon
port.
In general, if you want to leave the existing device open and have a 
new
device open for a new plot, you simply call the device name that you
want to open (ie. under Linux you would use X11() ) to open a new
plotting device on the display.  See ?Devices for more details.

2.  How do I pause between plot renderings i.e., in such a way that it
will draw the subsequent graph after pressing the space bar (or any
other key).
Set 'par(ask = TRUE)' before plotting. See ?par

3.  Illustrating critical regions.  Say I wanted to illustrate the
critical region of a standard normal.  I would need to draw a vertical
line from the critical point to the curve and then shade the critical
region.  How do I do this in R?
# Generate a sequence of x values
x - seq(-3, 3, by = 0.001)
# Plot normal curve over x
plot(x, dnorm(x), type = l)
# Define left side boundary using min(x)
# and CritVal using alpha = 0.05
alpha - 0.05
CritVal - qnorm(alpha / 2)
x.l - seq(min(x), CritVal, length = 100)
y.l - c(dnorm(x.l), 0, 0)
# add CritVal, min(x) to complete polygon
x.l - c(x.l, CritVal, min(x))
# draw and fill left region
polygon(x.l, y.l, density = 50)
# Do the same for right side boundary using max(x)
# and Crit Val
CritVal - qnorm(1 - (alpha / 2))

x.r - seq(CritVal, max(x), length = 100)
y.r - c(dnorm(x.r), 0, 0)
# add max(x) and CritVal to complete polygon
x.r - c(x.r, max(x) , CritVal)
# draw and fill left region
polygon(x.r, y.r, density = 50)


HTH,

Marc Schwartz


__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] Plotting asymptote possible with plot?

2003-08-28 Thread Tom Kennedy
I am calculating LOD scores in genetic epidemiology where the number of 
non recombinants is 11 and recombinants is 1. I created a function to 
calculate the z scores for the following thetas.

theta - c(0,0.01,0.05,0.10,0.20,0.45,0.5)

The z scores for the respective thetas in this cases are:

-Inf,1.56,2.07,2.11,1.85,0.410,0.0

I attempt to plot these values using the following commands.

plot(theta, zscore, xlab = theta, ylab = LOD Score, type = l, ylim 
= c(-5,5), panel.first = grid(5,16), panel.last = abline(h=0),axes=F)

axis(side = 1,at = c(0,.1,.2,.3,.4,.5))

axis(side = 2,at = c(-5,-4,-3,-2,-1,0,1,2,3,4,5))

The plot works but does not plot from the points (0,-Inf) to 
(0.01,1.56). As this is an asymptotic value, I'm unsure that the plot 
function can plot to -Inf.

I am using R 1.7.1. on WinXP sp1.

Is there a way to plot the asymptote?

Regards Tom

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Packages

2003-08-28 Thread Prof Brian Ripley
Could you clarify that you want to do this on the Carbon MacOS port, and 
not the Darwin MacOS X port?

Since gstat uses Unix-like configure tools, I think this would need a
_lot_ of expertise, something not worth doing for the last release of the 
Carbon port.

If you are running MacOS X, why don't you try to do it under the Darwin
port (with the right tools installed, just use install.packages(gstat)).  
Or you might like to wait a few days for the RAqua port of R (the Darwin
port with an Aqua GUI) to go into alpha test (it will be the MacOS X port
for R 1.8.0).

Alternatively, could you use R on an OS that does have easy support for 
gstat, e.g. Windows or Linux?


On Wed, 27 Aug 2003, Emilio A. Laca wrote:

 I need to install some geostatistics packages that are not in the binaries,
 for example gstat. I downloaded rm171 and installed, and I even added
 precomplied packages successfully. Unfortunately, I do not know how to add
 packages available as gstat. If you can spare a minute, could you give me a
 lead on this?
 Any other pointers on using R in mac os x will be greatly appreciated.
 
 Thank you so much for your time on this question, and for everything you put
 into rmac!

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

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] testing if two multivariate samples are from the samedistribution

2003-08-28 Thread Ludwig Baringhaus
Am Mittwoch, 27. August 2003 22:22 schrieb Jason Liao:
 Hello, everyone! I wonder if any R package can do the multivariate
 Smirnov test. Specifically, let x_1,..,x_n and y_1,...,y_m be
 multivariate vectors. I would like to test if the two samples are from
 the same underlying multivariate distribution. Thanks in advance.

 Jason

See cramer.test in package cramer.

L. Baringhaus

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


RE: [R] Re: diamond graphs, patents and rootograms

2003-08-28 Thread Mulholland, Tom
Talking about Excel, you can produce excellent graphs in Excel. Yes you
have to work at it, but you can get there. The problem is that they are
not the default. My gut feeling is that R will make more of an impact in
the presentation of graphics than any implementation in Excel. 

So even if a patent were granted and it made itself into a mainstream
package, would it change the world or would the people who currently use
three dee (3D) graphs think that they looked a bit square. Or would the
implementation allow us to change the colour of each diamond or maybe we
could put a picture of our daughter as a background. Does change happen
from the tool or the user.

So I guess my reason for saying R will make more of an impact is because
the average R user cares about what they are doing when compared to the
average Excel user.

also

On Thu, 28 Aug 2003, David Scott wrote:

 What is a hanging rootogram? ;-D

Now I can't work out what the wink means, but they're implemented in the
VCD package 

Also http://www.math.yorku.ca/SCS/vcd/vcdstory.pdf for more info

_
 
Tom Mulholland
Senior Policy Officer
WA Country Health Service
Tel: (08) 9222 4062
 
The contents of this e-mail transmission are confidential an...{{dropped}}

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] trying to produce an array of ranks

2003-08-28 Thread Petr Pikal
Hi

On 27 Aug 2003 at 20:32, John Christie wrote:

 OK, I am try to produce an array of ranks.  I have a set of data (s)
 that looks like this
 
 rtsubj
 312   dave
 467   dave
 411   dave
 383   kim
 398   kim
 ...
 
 Now I want to make a column that is an array of the ranks of rt by
 subject.  The closest of gotten is using the following.
 
 r - by (s, s$subj, function(d) rank(d[1]))
 
 This gets the data out with ranks but I cannot figure out how to
 easily extract each of the lists and turn the whole thing into a nice
 straight array (it is an array of lists when unclassed).  I couldn't
 get anything working with any of the apply's or ave.  Any suggestions?
  This seems like it should be a common task.

I am not sure you want to your output to look like.

r[n] will give you ranks for nth person

unlist(r) vill give you one vector of ranks

If you want a table of ranks let say with names in the first row and ranks for each 
name below it it will probably need adding some NA to shorter vectors of ranks 
and cbinding them together, probably using for loop. 

something like 
cbind(as.vector(unlist(r[1])),c(as.vector(unlist(r[2])),NA))

Not an easy task :(

Maybe sombody will come with better answer

 
 __
 [EMAIL PROTECTED] mailing list
 https://www.stat.math.ethz.ch/mailman/listinfo/r-help

Cheers
Petr Pikal
[EMAIL PROTECTED]

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Re: diamond graphs and patents

2003-08-28 Thread Barry Rowlingson
David Scott wrote:
 but if any of us are to do 
likewise I guess we will either pay up or secretly write code and play 
around with diamond graphs while hidden in the basement.
Okay, lets stand up and be counted: who has been writing diamond graph 
code? Mine's 60 lines.

Like others I welcome the contribution of those at Johns Hopkins to the 
debate. And they perhaps shouldn't worry about us here at R-help, who are 
maybe just a fringe element of open source loving anti-M$ weirdos. Then 
again we may be the last bastion of open scientific enquiry.
 Is that an M$-Windows port of R I see? Or is it still anti-M$ because 
it isn't written in C# and .NET?

Baz

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] read.spss (package foreign) and character columns

2003-08-28 Thread Thomas Petzoldt
RINNER Heinrich wrote:

In R:

library(foreign)
test - read.spss(test.sav, to.data.frame=T)
test
  XCHAR
1 a
2 ab   
3 abcde

levels(test$XCHAR)
[1] a ababcde

Shouldn't it rather be a ab abcde (no blanks)?
I think, that should be no problem since the blanks in XCHAR may be 
easily removed with gsub()

If you have
 s-c(a,ab   ,ab cd )
then
 gsub( ,,s)
[1] aab   abcd
removes all spaces or

 gsub( *$,,s)
[1] a abab cd
removes all trailing spaces.

Hope this helps!

Thomas P.

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Newbie graphing questions

2003-08-28 Thread Thomas Petzoldt
Marc Schwartz wrote:
In general, if you want to leave the existing device open and have a new
device open for a new plot, you simply call the device name that you
want to open (ie. under Linux you would use X11() ) to open a new
plotting device on the display.  See ?Devices for more details.
X11() works on Windows too.

Thomas

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] ks.test()

2003-08-28 Thread franck allaire
Dear All

I am trying to replicate a numerical application (not computed on R) from an 
article. Using, ks.test() I computed the exact D value shown in the article 
but the p-values I obtain are quite different from the one shown in the 
article.

The tests are performed on a sample of 37 values (please see [0] DATA 
below) for truncated Exponential, Pareto and truncated LogNormal (please see 
[1] FUNCTIONS below). You can find below the commands I use to compute the 
tests ([2] COMMANDS) and the p-values presented in the article.

Can anyone explain the difference between these two set of p-values? Maybe 
the explanation is linked to my second question: Can anyone confirm me that 
p-values calculated in the Kolmogrov-Smirnov g-o-f are independent from the 
family of the distribution assumed in H0?

Anderson-Darling test is also performed in the article. would anyone have 
functions to calculate pvalues for exponential, lognormal, weibull, etc?

Many thanks for your help,

Franck Allaire
R 1.6.2
###
# [0] DATA # truncation point is 30 i.e. all values are above 30
###
39.7
582
439.9
47.1
83.9
41.2
893.1
192
106.2
216.7
1243.4
52.8
351.6
36.2
431.5
57.3
1602.1
822.2
260.1
58.7
6299.9
814.9
137.2
203.8
1263.5
53.7
1313
118.4
167.8
70.1
503.7
64.8
529.9
87.8
2465.4
317.9
2753.9
###
# [1] FUNCTIONS
###
#EXP
exptfit_function(x,b, plot.it = F, lty = 1){
 if (mode(x) != numeric)
   stop(need numeric data)
 x - x[!is.na(x)]
 x - sort(x)
 lambda - length(x)/sum(x-b)
 if(plot.it) { lines(x, dexpt(x, lambda = lambda, b = b), lty = 
lty,col=red)}
 result - list(lambda = lambda, b = b)
 class(result) - expt
 result}

dexpt-function(x,lambda,b) dexp(x-b,rate=lambda)
pexpt-function(x,lambda,b) pexp(x-b,rate=lambda)
qexpt-function(p,lambda,b) qexp(p,rate=lambda)+b
rexpt-function(n,lambda,b) rexp(n,rate=lambda)+b
#PARETO
paretofit-function(x,b, plot.it = F, lty = 1){
 x - sort(x)
 alpha - length(x)/sum(log(x/b))
 if(plot.it) { lines(x, dpareto(x, alpha = alpha, b = b), lty = 
lty,col=red)}
 result - list(alpha = alpha, b = b)
 class(result) - pareto
 result}

dpareto-function(x, alpha,b) ifelse(xb,0,alpha*(b^alpha)/(x^(alpha+1)))
ppareto-function(x, alpha,b) ifelse(xb,0,1-(b/x)^alpha)
qpareto-function(p, alpha,b) b*exp(-log(1-p)/alpha)
rpareto-function(n, alpha,b) qpareto(runif(n),alpha=alpha,b=b)
#LN
lnormtfit_function(x,b, plot.it = F, lty = 1){
 if (mode(x) != numeric)
   stop(need numeric data)
 x - x[!is.na(x)]
 x - sort(x)
 y - log(x-b)
 n - length(y)
 mu - mean(y)
 sigma - sd(y)
 if(plot.it) { lines(x, dlnormt(x, meanlog=mu,sdlog=sigma,b=b), lty 
= lty,col=red)}
 result - list(mu=mu,sigma=sigma,b=b)
 class(result) - lnormt
 result}

dlnormt-function(x,mu,sigma,b) dlnorm(x-b,meanlog=mu,sdlog=sigma)
plnormt-function(x,mu,sigma,b) plnorm(x-b,meanlog=mu,sdlog=sigma)
qlnormt-function(p,mu,sigma,b) qlnorm(p,meanlog=mu,sdlog=sigma)+b
rlnormt-function(n,mu,sigma,b) rlnorm(n,meanlog=mu,sdlog=sigma)+b
###
# [2] COMMANDS
###
# EXP
tmp - exptfit(data,b=30)
ks.test(data,pexpt,lambda=tmp$lambda,b=tmp$b)
# Article: D= 0.2599 pvalue0.005
# PARETO
tmp - paretofit(data,b=30)
ks.test(data, ppareto, alpha=tmp$alpha,b=tmp$b)
# Article: D=0.14586 pvalue=0.16
# LN
tmp - lnormtfit(data,b=30)
ks.test(data,plnormt,mu=tmp$mu,sigma=tmp$sigma,b=tmp$b)
# Article: D=0.07939 pvalue0.15
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Newbie graphing questions

2003-08-28 Thread Peter Dalgaard BSA
Thomas Petzoldt [EMAIL PROTECTED] writes:

 Marc Schwartz wrote:
  In general, if you want to leave the existing device open and have a new
  device open for a new plot, you simply call the device name that you
  want to open (ie. under Linux you would use X11() ) to open a new
  plotting device on the display.  See ?Devices for more details.
 
 X11() works on Windows too.

..but the orig. poster was using a Mac.

-- 
   O__   Peter Dalgaard Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics 2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark  Ph: (+45) 35327918
~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] ks.test()

2003-08-28 Thread Prof Brian Ripley
You appear to be applying the KS test after estimating parameters.  The 
distribution theory is for an iid sample from a known continuous 
distribution (and does not otherwise depend on the distribution).  Since 
your H_0 is not pre-specified, that distribution theory is not correct.
(Some corrections have been worked out for say ML fitting of exponential 
and normal distributions -- by Michael Stephens as I recall.)

Also, your `truncated LogNormal' does not appear to be truncated, rather
to be shifted.  That's the same thing for an exponential (for a positive
shift), but not for any other distribution.

On Thu, 28 Aug 2003, franck allaire wrote:

 Dear All
 
 I am trying to replicate a numerical application (not computed on R) from an 
 article. Using, ks.test() I computed the exact D value shown in the article 
 but the p-values I obtain are quite different from the one shown in the 
 article.

And what is the H_0 and H_1 used in the article?

 The tests are performed on a sample of 37 values (please see [0] DATA 
 below) for truncated Exponential, Pareto and truncated LogNormal (please see 
 [1] FUNCTIONS below). You can find below the commands I use to compute the 
 tests ([2] COMMANDS) and the p-values presented in the article.
 
 Can anyone explain the difference between these two set of p-values? Maybe 
 the explanation is linked to my second question: Can anyone confirm me that 
 p-values calculated in the Kolmogrov-Smirnov g-o-f are independent from the 
 family of the distribution assumed in H0?
 
 Anderson-Darling test is also performed in the article. would anyone have 
 functions to calculate pvalues for exponential, lognormal, weibull, etc?
 
 Many thanks for your help,
 
 Franck Allaire
 R 1.6.2
 
 ###
 # [0] DATA # truncation point is 30 i.e. all values are above 30
 ###
 39.7
 582
 439.9
 47.1
 83.9
 41.2
 893.1
 192
 106.2
 216.7
 1243.4
 52.8
 351.6
 36.2
 431.5
 57.3
 1602.1
 822.2
 260.1
 58.7
 6299.9
 814.9
 137.2
 203.8
 1263.5
 53.7
 1313
 118.4
 167.8
 70.1
 503.7
 64.8
 529.9
 87.8
 2465.4
 317.9
 2753.9
 
 ###
 # [1] FUNCTIONS
 ###
 
 #EXP
 exptfit_function(x,b, plot.it = F, lty = 1){
 
   if (mode(x) != numeric)
 stop(need numeric data)
   x - x[!is.na(x)]
   x - sort(x)
   lambda - length(x)/sum(x-b)
   if(plot.it) { lines(x, dexpt(x, lambda = lambda, b = b), lty = 
 lty,col=red)}
   result - list(lambda = lambda, b = b)
   class(result) - expt
   result}
 
 dexpt-function(x,lambda,b) dexp(x-b,rate=lambda)
 pexpt-function(x,lambda,b) pexp(x-b,rate=lambda)
 qexpt-function(p,lambda,b) qexp(p,rate=lambda)+b
 rexpt-function(n,lambda,b) rexp(n,rate=lambda)+b
 
 #PARETO
 paretofit-function(x,b, plot.it = F, lty = 1){
 
   x - sort(x)
   alpha - length(x)/sum(log(x/b))
   if(plot.it) { lines(x, dpareto(x, alpha = alpha, b = b), lty = 
 lty,col=red)}
   result - list(alpha = alpha, b = b)
   class(result) - pareto
   result}
 
 dpareto-function(x, alpha,b) ifelse(xb,0,alpha*(b^alpha)/(x^(alpha+1)))
 ppareto-function(x, alpha,b) ifelse(xb,0,1-(b/x)^alpha)
 qpareto-function(p, alpha,b) b*exp(-log(1-p)/alpha)
 rpareto-function(n, alpha,b) qpareto(runif(n),alpha=alpha,b=b)
 
 #LN
 lnormtfit_function(x,b, plot.it = F, lty = 1){
 
   if (mode(x) != numeric)
 stop(need numeric data)
   x - x[!is.na(x)]
   x - sort(x)
   y - log(x-b)
   n - length(y)
   mu - mean(y)
   sigma - sd(y)
   if(plot.it) { lines(x, dlnormt(x, meanlog=mu,sdlog=sigma,b=b), lty 
 = lty,col=red)}
   result - list(mu=mu,sigma=sigma,b=b)
   class(result) - lnormt
   result}
 
 dlnormt-function(x,mu,sigma,b) dlnorm(x-b,meanlog=mu,sdlog=sigma)
 plnormt-function(x,mu,sigma,b) plnorm(x-b,meanlog=mu,sdlog=sigma)
 qlnormt-function(p,mu,sigma,b) qlnorm(p,meanlog=mu,sdlog=sigma)+b
 rlnormt-function(n,mu,sigma,b) rlnorm(n,meanlog=mu,sdlog=sigma)+b
 
 ###
 # [2] COMMANDS
 ###
 
 # EXP
 tmp - exptfit(data,b=30)
 ks.test(data,pexpt,lambda=tmp$lambda,b=tmp$b)
 # Article: D= 0.2599 pvalue0.005
 
 # PARETO
 tmp - paretofit(data,b=30)
 ks.test(data, ppareto, alpha=tmp$alpha,b=tmp$b)
 # Article: D=0.14586 pvalue=0.16
 
 # LN
 tmp - lnormtfit(data,b=30)
 ks.test(data,plnormt,mu=tmp$mu,sigma=tmp$sigma,b=tmp$b)
 # Article: D=0.07939 pvalue0.15
 
 __
 [EMAIL PROTECTED] mailing list
 https://www.stat.math.ethz.ch/mailman/listinfo/r-help
 
 

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

__
[EMAIL 

RE: [R] read.spss (package foreign) and character columns

2003-08-28 Thread RINNER Heinrich
Thanks to Brian Ripley, Douglas Bates and Thomas Petzoldt for their
comments.

I agree that it is not really a problem, as you can easily use sub() after
read.spss() to get rid of the blanks (I had already done that).

On the other hand, it might be important to _know_ about the fact that
characters are filled with blanks here.
[I noticed it because I used a character variable as the common column in a
merge(tab1,tab2,by=XCHAR), where tab1 came into R from an SPSS file using
read.spss(), and tab2 came into R from an Excel file via odbc using
odbcConnectExcel(). The merge failed on some cases, because some values of
XCHAR from tab1 had trailing blanks, the values of tab2 had none.]

I know now, so I know what to do in future cases.
But as not everybody else might be aware of this, my suggestion would be
that it could be worth adding a short comment about this in help(read.spss),
so noone will be surprised.

Regards,
Heinrich.

 -Ursprüngliche Nachricht-
 Von: RINNER Heinrich [mailto:[EMAIL PROTECTED] 
 Gesendet: Mittwoch, 27. August 2003 18:06
 An: '[EMAIL PROTECTED]'
 Betreff: [R] read.spss (package foreign) and character columns
 
 
 Dear R users!
 
 I am using R Version 1.7.1, Windows XP, package foreign 
 (Version: 0.6-1),
 SPSS 11.5.1.
 
 There is one thing I noticed with read.spss, and I'd like 
 to ask if this
 is considered to be a feature, or possibly a bug:
 When reading character columns, character strings seem to get 
 filled with
 blanks at the end.
 
 Simple example:
 In SPSS, create a file with one variable called xchar of type A5
 (character of length 5), and  3 values (a, ab, abcde), 
 save it as
 test.sav.
 
 In R:
  library(foreign)
  test - read.spss(test.sav, to.data.frame=T)
  test
   XCHAR
 1 a
 2 ab   
 3 abcde
  levels(test$XCHAR)
 [1] a ababcde
 
 Shouldn't it rather be a ab abcde (no blanks)?
 
 -Heinrich.
 
 __
 [EMAIL PROTECTED] mailing list
 https://www.stat.math.ethz.ch/mailman/listinfo/r-help


__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] ks.test()

2003-08-28 Thread Roger Koenker

On Thu, 28 Aug 2003, Prof Brian Ripley wrote:

 You appear to be applying the KS test after estimating parameters.  The
 distribution theory is for an iid sample from a known continuous
 distribution (and does not otherwise depend on the distribution).  Since
 your H_0 is not pre-specified, that distribution theory is not correct.
 (Some corrections have been worked out for say ML fitting of exponential
 and normal distributions -- by Michael Stephens as I recall.)

Just to amplify this comment a bit, I'm a little worried that the
current documentation of of ks.test may make it appear that estimated
parameters are ok, or that somehow the p-values computed are
corrected in some way for their existence -- which I very much
doubt.  The standard reference on this sort of thing was Durbin's (1973)
SIAM monograph.  There is a very nice approach due to Khmaladze (1981)
based on the Doob-Meyer decomposition - this is the closest thing
that I'm aware of for handling KS type tests with estimated parameters
in a general context.

url:www.econ.uiuc.edu/~roger/my.htmlRoger Koenker
email   [EMAIL PROTECTED]   Department of Economics
vox:217-333-4558University of Illinois
fax:217-244-6678Champaign, IL 61820

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] ks.test()

2003-08-28 Thread franck allaire
With the Shifted Exponential test, H_0 is data is a sample coming from a 
Shifted Exponential distribution with shift=30 and lambda = 0.001566907

You appear to be applying the KS test after estimating parameters.
I do in order to define H_0 as explained above

The distribution theory is for an iid sample from a known continuous
distribution (and does not otherwise depend on the distribution).
That's what I thougth but this is not what I understand reading:
http://www.isi.edu/~kclan/paper/ramp/node11.html
Since your H_0 is not pre-specified, that distribution theory is not 
correct.
please see above

(Some corrections have been worked out for say ML fitting of exponential
and normal distributions -- by Michael Stephens as I recall.)
Also, your `truncated LogNormal' does not appear to be truncated, rather
to be shifted.  That's the same thing for an exponential (for a positive
shift), but not for any other distribution.
Thanks for this clarification

And what is the H_0 and H_1 used in the article?
H_1 is that the sample is not coming from the specified distribution in H_0

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] ks.test()

2003-08-28 Thread Prof Brian D Ripley
On Thu, 28 Aug 2003, franck allaire wrote:

 With the Shifted Exponential test, H_0 is data is a sample coming from a
 Shifted Exponential distribution with shift=30 and lambda = 0.001566907

You got that after looking at the data.  H_0 has to be specified before
looking at the data.

 You appear to be applying the KS test after estimating parameters.

 I do in order to define H_0 as explained above

That's invalid.

 The distribution theory is for an iid sample from a known continuous
 distribution (and does not otherwise depend on the distribution).

 That's what I thougth but this is not what I understand reading:

Learn not to believe everything you read on the Web.

 Since your H_0 is not pre-specified, that distribution theory is not
 correct.

 please see above

Rather, please take careful note yourself.

 (Some corrections have been worked out for say ML fitting of exponential
 and normal distributions -- by Michael Stephens as I recall.)
 Also, your `truncated LogNormal' does not appear to be truncated, rather
 to be shifted.  That's the same thing for an exponential (for a positive
 shift), but not for any other distribution.

 Thanks for this clarification

 And what is the H_0 and H_1 used in the article?

 H_1 is that the sample is not coming from the specified distribution in H_0

Not so: perhaps an iid sample from some other continuous distribution?

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

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] R-help: beginner question

2003-08-28 Thread Monica Palaseanu-Lovejoy
Hi,

I am a beginner user of R. I have a trivial question – I am almost 
ashamed I cannot figure it out does not matter how many times I 
am reading the help.

I have a table in .txt format, tab delimited. I can read it with 
‘read.delim()’ with no problems.

Afterwards I would like to use boxplot function to see if there 
are any outliers in the column 5 of my data called TPAH16.ppm

In the boxplot help I saw that I have to declare my data with 
‘data()’. I am getting errors does not matter how I am calling 
‘data()’, only with the name of the table, with 
data(read.delim()), or in any other way. So in the end I was not 
able to use boxplot at all.

I will appreciate any help “for dummies” you can give me. Also, 
if you know any other way to identify outliers, or to use Cook 
dimension to identify them, I will really appreciate.

Thanks,

Monica


Monica Palaseanu-Lovejoy
University of Manchester
School of Geography
Mansfield Cooper Building 
Oxford Road, Manchester
M13 9PL, UK. 
email: [EMAIL PROTECTED]

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] how to call a C program from R function

2003-08-28 Thread Martin Olivier
Hi all,

I would like to call a C program from R function. I tried to use the 
.C() function
without success. I need a very simple example (such as the hello 
program) to understand
how it works. Could you give a  such example?
(I use the  1.7.1 Version of R with linux)

Does it work in the case of a C++ program instead of a C programm?

Best regards,
Olivier
--

-
Martin Olivier
INRA - Unité protéomique   LIRMM - IFA/MAB
2, Place Viala 161, rue Ada
F-34060 Montpellier Cédex 134392 Montpellier Cédex 5
Tel : 04 99 61 26 02   Tel : O4 67 41 86 71
[EMAIL PROTECTED]
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] R-help: beginner question

2003-08-28 Thread Douglas Bates
Monica Palaseanu-Lovejoy [EMAIL PROTECTED] writes:

 I am a beginner user of R. I have a trivial question – I am almost 
 ashamed I cannot figure it out does not matter how many times I 
 am reading the help.

 I have a table in .txt format, tab delimited. I can read it with 
 ‘read.delim()’ with no problems.

 Afterwards I would like to use boxplot function to see if there 
 are any outliers in the column 5 of my data called TPAH16.ppm

 In the boxplot help I saw that I have to declare my data with 
 ‘data()’. I am getting errors does not matter how I am calling 
 ‘data()’, only with the name of the table, with 
 data(read.delim()), or in any other way. So in the end I was not 
 able to use boxplot at all.

Yours is a common problem for those starting with R.  The problem is
that the object that you have read, let's call it `df', is in a
tabular form (called a data frame in R) and you need to specify a
single column of that table as an argument to the boxplot function.

There are several ways to do this.

- Use the `with' function to indicate the data frame to use

with(df, boxplot(TPAH16.ppm))

- Use both the name of the data frame and the name of the column,
separated by $

boxplot(df$TPAH16.ppm)

- Attach the data frame before creating the boxplot

attach(df)
boxplot(TPAH16.ppm)
detach()


-- 
Douglas Bates[EMAIL PROTECTED]
Statistics Department608/262-2598
University of Wisconsin - Madisonhttp://www.stat.wisc.edu/~bates/

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] how to call a C program from R function

2003-08-28 Thread Thomas Petzoldt
Martin Olivier wrote:

Hi all,

I would like to call a C program from R function. I tried to use the 
.C() function
without success. I need a very simple example (such as the hello 
program) to understand
Do you want to call a C program (executable) or a shared library? If you 
want to run a compiled program simply use system() or shell()

how it works. Could you give a  such example?
(I use the  1.7.1 Version of R with linux)
Does it work in the case of a C++ program instead of a C programm?
If you want to call a shared library (or DLL), please look into the 
Manual writing R extensions and look for the convolve example.

For a very simple hello-function see the C++ example below. Please 
check if you have installed the correct compiler on Linux and look into 
the manual how to compile a shared library. On Linux it is:

R CMD SHLIB test.cpp

Thomas P.

---
A simple example, but there are better in the docs ;-) e.g. building a 
package.



===
// File test.cpp:
#include R.h
#include Rinternals.h
extern C {

void testarr(int* n, double* x) {
for (int i = 0; i  *n; i++) {
   x[i] = 2 * i;
}
  }
}
===
## file test.R
dyn.load(test.so)

testarr - function(x) {
  .C(testarr, as.integer(length(x)), x=as.double(x))$x
}
print(testarr(1:10))

dyn.unload(test.so)

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] R-help: beginner question - Thank you! OUTLIERS

2003-08-28 Thread Monica Palaseanu-Lovejoy
Hi,

Thank you so much for all your rapid answers. I am impressed.

What i didn't know was that i have to assign my data to an object 
to work further on. It was not clear from the help (at least for me) 
that 'data()' itself is calling data already in R packages. All of you 
make that clear.

Now, if you can suggest any good package to use for identifying 
outliers it will be great ;-)) 

Hopefully from now one, since i understood how i am using the 
examples, what 'data()' means and how i am using my own data, i 
will put less trivial questions.

thank you so much indeed,

Monica


Monica Palaseanu-Lovejoy
University of Manchester
School of Geography
Mansfield Cooper Building 
Oxford Road, Manchester
M13 9PL, UK. 
email: [EMAIL PROTECTED]

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] R-help: beginner question

2003-08-28 Thread Peter Dalgaard BSA
Monica Palaseanu-Lovejoy [EMAIL PROTECTED] writes:

 Hi,
 
 I am a beginner user of R. I have a trivial question – I am almost 
 ashamed I cannot figure it out does not matter how many times I 
 am reading the help.
 
 I have a table in .txt format, tab delimited. I can read it with 
 ‘read.delim()’ with no problems.
 
 Afterwards I would like to use boxplot function to see if there 
 are any outliers in the column 5 of my data called TPAH16.ppm
 
 In the boxplot help I saw that I have to declare my data with 
 ‘data()’. I am getting errors does not matter how I am calling 
 ‘data()’, only with the name of the table, with 
 data(read.delim()), or in any other way. So in the end I was not 
 able to use boxplot at all.
 
 I will appreciate any help “for dummies” you can give me. Also, 
 if you know any other way to identify outliers, or to use Cook 
 dimension to identify them, I will really appreciate.

You don't need data() that's just to get some standard data for the
boxplot() example. What you need is

mydata - read.delim(...whatever...)

attach(mydata)
boxplot(V5) # or whatever col.5 is called

or 

with(mydata, boxplot(V5))

or

boxplot(mydata$V5)


(Almost all the boxplot examples appear to be using the formula interface,
which doesn't work without a grouping variable, and only the formula
interface allows you to give a data= argument to boxplot(). At least
one of those should probably be fixed.)

-- 
   O__   Peter Dalgaard Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics 2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark  Ph: (+45) 35327918
~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] R-help: beginner question

2003-08-28 Thread James MacDonald
If you read the data into a data frame, you should be able to simply pass the name of 
the data frame in a call to boxplot.

my.data - read.delim(mytext.txt)
boxplot(my.data)

If you only want a boxplot of column 5

boxplot(my.data[,5])

See ?boxplot for other options to make the boxplot look the way you like.

HTH,

Jim



James W. MacDonald
Affymetrix and cDNA Microarray Core
University of Michigan Cancer Center
1500 E. Medical Center Drive
7410 CCGC
Ann Arbor MI 48109
734-647-5623

 Monica Palaseanu-Lovejoy [EMAIL PROTECTED] 08/28/03 09:35AM 
Hi,

I am a beginner user of R. I have a trivial question * I am almost 
ashamed I cannot figure it out does not matter how many times I 
am reading the help.

I have a table in .txt format, tab delimited. I can read it with 
'read.delim()' with no problems.

Afterwards I would like to use boxplot function to see if there 
are any outliers in the column 5 of my data called TPAH16.ppm

In the boxplot help I saw that I have to declare my data with 
'data()'. I am getting errors does not matter how I am calling 
'data()', only with the name of the table, with 
data(read.delim()), or in any other way. So in the end I was not 
able to use boxplot at all.

I will appreciate any help for dummies you can give me. Also, 
if you know any other way to identify outliers, or to use Cook 
dimension to identify them, I will really appreciate.

Thanks,

Monica


Monica Palaseanu-Lovejoy
University of Manchester
School of Geography
Mansfield Cooper Building 
Oxford Road, Manchester
M13 9PL, UK. 
email: [EMAIL PROTECTED] 

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] how to call a C program from R function

2003-08-28 Thread Prof Brian Ripley
On Thu, 28 Aug 2003, Martin Olivier wrote:

 Hi all,
 
 I would like to call a C program from R function. I tried to use the 
 .C() function
 without success. I need a very simple example (such as the hello 
 program) to understand
 how it works. Could you give a  such example?

There is one in Writing R Extensions.  `Hello world' be too simple: you do 
need to know how to return results.

 (I use the  1.7.1 Version of R with linux)
 
 Does it work in the case of a C++ program instead of a C programm?

See Writing R extensions for details and examples.

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

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] (no subject)

2003-08-28 Thread giovanni caggiano
Dear All,
A couple of questions about the nls package.

1. I'm trying to run a nonlinear least squares
regression but the routine gives me the following
error message:

 step factor 0.000488281 reduced below `minFactor' of
0.000976563

even though I previously wrote the following command: 
nls.control(minFactor = 1/4096), which should set the
minFactor to a lower level than the default one,
1/1024=0.000976563. 
Is there any way of setting the new minfactor to a
lower level?

2. Is it possible to set some constraints upon the
parameters to be estimated in a nls regression?

Thanks,
Giovanni

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] R-help: beginner question - Thank you! OUTLIERS

2003-08-28 Thread Spencer Graves
Have you considered normal probability plots (qqnorm) to identify 
outliers?  These will identify much more, of course, including the need 
for transformations, mixtures of distributions, etc.

hope this helps.  spencer graves

Monica Palaseanu-Lovejoy wrote:
Hi,

Thank you so much for all your rapid answers. I am impressed.

What i didn't know was that i have to assign my data to an object 
to work further on. It was not clear from the help (at least for me) 
that 'data()' itself is calling data already in R packages. All of you 
make that clear.

Now, if you can suggest any good package to use for identifying 
outliers it will be great ;-)) 

Hopefully from now one, since i understood how i am using the 
examples, what 'data()' means and how i am using my own data, i 
will put less trivial questions.

thank you so much indeed,

Monica

Monica Palaseanu-Lovejoy
University of Manchester
School of Geography
Mansfield Cooper Building 
Oxford Road, Manchester
M13 9PL, UK. 
email: [EMAIL PROTECTED]

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] (no subject)

2003-08-28 Thread Peter Dalgaard BSA
giovanni caggiano [EMAIL PROTECTED] writes:

 Dear All,
 A couple of questions about the nls package.
 
 1. I'm trying to run a nonlinear least squares
 regression but the routine gives me the following
 error message:
 
  step factor 0.000488281 reduced below `minFactor' of
 0.000976563
 
 even though I previously wrote the following command: 
 nls.control(minFactor = 1/4096), which should set the
 minFactor to a lower level than the default one,
 1/1024=0.000976563. 
 Is there any way of setting the new minfactor to a
 lower level?

I suspect you didn't quite understand how to do it:

ctl.obj - nls.control(minFactor = 1/4096)
nls(., control=ctl.obj)


-- 
   O__   Peter Dalgaard Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics 2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark  Ph: (+45) 35327918
~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] nls problems (formerly no subject)

2003-08-28 Thread Spencer Graves
	  Please use an informative subject line.  The r-help archives at 
www.r-project.org - search - R site search indexes that, and I find 
answers to today's problems in the r-help discussions of yesterday's 
questions.

	  Only yesterday, I was got essentially that error message.  I solved 
it by setting trace=TRUE and studying which paramters were moving. 
With that information, I looked at the function and thought of ways to 
reparameterize it to make things more stable.  That helped but did not 
solve the problem.  Ultimately, I fixed two of the most volatile 
parameters to sensible values.  Then nls gave me answers very quickly.

	  An excellent reference on nonlinear regression is Bates and Watts 
(1988) Nonlinear regression and its applications (Wiley).  They talk 
some about reparameterizations.  A major contribution of this book is 
distinguishing between the intrinsic nonlinearity of the problem, which 
cannot be fixed without changing the model, and parameter effect 
curvature, which can be fixed by just writing the model in a different 
but equivalent way.  Pages 256-259 summarize some 67 different examples 
from published literature.  In each case, parameter effects curvature 
was more than the intrinsic curvature, with the median being a factor of 
16 larger.

	  For my problem yesterday, I did not just restrict myself to 
reparameterizations:  I also considered alternative models with similar 
but formally different behavior.

	  Also, have you considered using optim first, then feeding the 
answers to nls?  McCullough found a few years ago that it was easier 
for him to get answers if he did it that way, because the S-Plus 
versions of nls seems to get lost and quit prematurely, while optim 
will at least produce an answer.  If I'm not mistaken, this issue is 
discussed in either McCullough, B. D. (1999) Assessing the reliability 
of statistical software: Part II The American Statistician, 53, 149-159 
or McCullough, B. D. (1998) Assessing the reliability of statistical 
software: Part I The American Statistician, 52, 358-366.  I don't 
remember now which paper had this, but I believe one of them did;  I 
think I'd look at the second first.  (McCullough discussed nlminb 
instead of optim.  The former has been replaced by the latter in R.)

hope this helps.  spencer graves

giovanni caggiano wrote:
Dear All,
A couple of questions about the nls package.
1. I'm trying to run a nonlinear least squares
regression but the routine gives me the following
error message:
 step factor 0.000488281 reduced below `minFactor' of
0.000976563
even though I previously wrote the following command: 
nls.control(minFactor = 1/4096), which should set the
minFactor to a lower level than the default one,
1/1024=0.000976563. 
Is there any way of setting the new minfactor to a
lower level?

2. Is it possible to set some constraints upon the
parameters to be estimated in a nls regression?
Thanks,
Giovanni
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] Cook-distance-type plot (vertical bars)

2003-08-28 Thread Frank Gibbons
Hi,

Figure 13 of Emmanuel Paradis's R for Beginners was produced by termplot 
working on an aov object. The lower right-hand plot is labelled Cook's 
distance plot, and I'd really like to produce a similar type of figure, 
but in a totally different context. (I'm not even sure what this kind of 
figure is called, perhaps an impulse plot, where instead of a point at 
(x,y), there's a vertical bar running from the x-axis up to where the point 
would be).

Can anyone give me pointers on where to look for more info. I've had a look 
in the places I could think of (plot.lm.R, termplot.R, plot.R, aov.R), and 
couldn't find anything. Maybe I overlooked it?

Thanks

-Frank Gibbons

PhD, Computational Biologist,
Harvard Medical School BCMP/SGM-322, 250 Longwood Ave, Boston MA 02115, USA.
Tel: 617-432-3555   Fax: 
617-432-3557   http://llama.med.harvard.edu/~fgibbons

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] nls minFactor and constraints [was (no subject)]

2003-08-28 Thread Douglas Bates
giovanni caggiano [EMAIL PROTECTED] writes:

 A couple of questions about the nls package.

 1. I'm trying to run a nonlinear least squares
 regression but the routine gives me the following
 error message:
 
  step factor 0.000488281 reduced below `minFactor' of
 0.000976563
 
 even though I previously wrote the following command: 
 nls.control(minFactor = 1/4096), which should set the
 minFactor to a lower level than the default one,
 1/1024=0.000976563. 
 Is there any way of setting the new minfactor to a
 lower level?

You need to set control=nls.control(minFactor=1/4096) in the call to
nls.

 2. Is it possible to set some constraints upon the
 parameters to be estimated in a nls regression?

Other than by parameter transformation, no.  See section 3.4.1 of
Bates and Watts (1988), Nonlinear Regression Analysis and Its
Applications, Wiley to see how to use parameter transformations for
this.

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Cook-distance-type plot (vertical bars)

2003-08-28 Thread Prof Brian Ripley
On Thu, 28 Aug 2003, Frank Gibbons wrote:

 Hi,
 
 Figure 13 of Emmanuel Paradis's R for Beginners was produced by termplot 
 working on an aov object. The lower right-hand plot is labelled Cook's 
 distance plot, and I'd really like to produce a similar type of figure, 
 but in a totally different context. (I'm not even sure what this kind of 
 figure is called, perhaps an impulse plot, where instead of a point at 
 (x,y), there's a vertical bar running from the x-axis up to where the point 
 would be).

Often called an `index plot'.  It's done by plot(type=h).  R seems to
think that is `histogram-like', but the notation comes from S which calls
it `high-density lines'.  I've never found either intuitive notation.

 Can anyone give me pointers on where to look for more info. I've had a look 
 in the places I could think of (plot.lm.R, termplot.R, plot.R, aov.R), and 
 couldn't find anything. Maybe I overlooked it?

I suspect it was done by plot.lm(which=4), which does an index plot of 
Cook's distance.

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

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Cook-distance-type plot (vertical bars)

2003-08-28 Thread Thomas Lumley
On Thu, 28 Aug 2003, Frank Gibbons wrote:

 Hi,

 Figure 13 of Emmanuel Paradis's R for Beginners was produced by termplot
 working on an aov object.

No, it was produced by plot() working on a aov object, as its caption
indicates.  The termplot() is Figure 14.

The lower right-hand plot is labelled Cook's
 distance plot, and I'd really like to produce a similar type of figure,
 but in a totally different context. (I'm not even sure what this kind of
 figure is called, perhaps an impulse plot, where instead of a point at
 (x,y), there's a vertical bar running from the x-axis up to where the point
 would be).

It's called a high-density plot, and you get it by specifying type=h in
a plot() command.  It's mentioned on page 31 of `R for beginners'

It is in the code for plot.lm, where you say you also looked: the cook's
distance plot is created with
plot(cook, type = h, ylim = c(0, ymx), main = main,
 xlab = Obs. number, ylab = Cook's distance, ...)


-thomas

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] nls problems (formerly no subject)

2003-08-28 Thread Douglas Bates
I agree with what you said about using trace = TRUE when you are
having trouble getting nls to converge.  This allows you to see what
is happening to the parameters during the iterations and that it is
often quite instructive; as is plotting your data and thinking about
whether you should expect to be able to estimate all the parameters in
your model from the data that you have.  The nls function is not
magic.  It can only use that information that is available in the
data.

Spencer Graves [EMAIL PROTECTED] writes:

 Also, have you considered using optim first, then feeding
 the answers to nls?  McCullough found a few years ago that it was
 easier for him to get answers if he did it that way, because the
 S-Plus versions of nls seems to get lost and quit prematurely, while
 optim will at least produce an answer.  If I'm not mistaken, this
 issue is discussed in either McCullough, B. D. (1999) Assessing the
 reliability of statistical software: Part II The American
 Statistician, 53, 149-159 or McCullough, B. D. (1998) Assessing the
 reliability of statistical software: Part I The American Statistician,
 52, 358-366.  I don't remember now which paper had this, but I believe
 one of them did;  I think I'd look at the second first.  (McCullough
 discussed nlminb instead of optim.  The former has been replaced
 by the latter in R.)

I would be hesitant to draw too many conclusions from McCullough's
experiences.  He used the data sets, models, and starting estimates
from the NIST nonlinear least squares test sets.  These are available
in the NISTnls package for R.  If you run the examples in that package
you will see that all of the examples can be fit reasonably easily in
R.  However, the people at NIST decided that they wanted to create
easy and difficult versions of each example and they did this by
chosing one reasonable set of starting estimates nd one ridiculous set
of starting estimates for each problem.

Check, for example,

library(NISTnls)
example(Eckerle4)

The model that is being fit is a scaled version of a Gaussian
density.  A mere glance at the data shows that the location parameter
will be around 450 and the scale parameter will be around 5.  There is
no problem at all converging from those starting values - that's the
easy version of the problem.  The difficult version of the problem
is to try to converge from starting estimates of 500 for the location
and 10 for the scale.  

Look at a plot of the data.  Would anyone who knew what those
parameters represent consider 500 as a reasonable guess of the
location of the peak?  I don't feel that it is a terrible deficiency
in the nls implementation in R that it does not converge on this
model/data combination from those starting estimates.

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] R-help: beginner question

2003-08-28 Thread Patrick Burns
A Guide for the Unwilling S User would help orient you
to how R works. It is meant to do that as quickly and painlessly
as possible.
Patrick Burns

Burns Statistics
[EMAIL PROTECTED]
+44 (0)20 8525 0696
http://www.burns-stat.com
(home of S Poetry and A Guide for the Unwilling S User)
Monica Palaseanu-Lovejoy wrote:

Hi,

I am a beginner user of R. I have a trivial question  I am almost 
ashamed I cannot figure it out does not matter how many times I 
am reading the help.

I have a table in .txt format, tab delimited. I can read it with 
read.delim() with no problems.

Afterwards I would like to use boxplot function to see if there 
are any outliers in the column 5 of my data called TPAH16.ppm

In the boxplot help I saw that I have to declare my data with 
data(). I am getting errors does not matter how I am calling 
data(), only with the name of the table, with 
data(read.delim()), or in any other way. So in the end I was not 
able to use boxplot at all.

I will appreciate any help for dummies you can give me. Also, 
if you know any other way to identify outliers, or to use Cook 
dimension to identify them, I will really appreciate.

Thanks,

Monica

Monica Palaseanu-Lovejoy
University of Manchester
School of Geography
Mansfield Cooper Building 
Oxford Road, Manchester
M13 9PL, UK. 
email: [EMAIL PROTECTED]

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
 

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Cook-distance-type plot (vertical bars)

2003-08-28 Thread Frank Gibbons
Thanks to all who responded, and so promptly too: it works exactly as you 
describe.


 Figure 13 of Emmanuel Paradis's R for Beginners was produced by termplot
 working on an aov object.
No, it was produced by plot() working on a aov object, as its caption
indicates.  The termplot() is Figure 14.
Thomas Lumley is quite right, it's produced by plot() (not termplot()), and 
it is mentioned on p31 of R for beginners. My mistake.

In the interest of self education, is there a more comprehensive source for 
plot-types that I should read? Ideally, this would be something with lots 
of figures, so that I could browse the figures to find what I want to do, 
and then look up how to do it. R for Beginners goes some way along this 
path, but perhaps there's something more comprehensive?

Thanks again,

-Frank

PhD, Computational Biologist,
Harvard Medical School BCMP/SGM-322, 250 Longwood Ave, Boston MA 02115, USA.
Tel: 617-432-3555   Fax: 
617-432-3557   http://llama.med.harvard.edu/~fgibbons

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Newbie graphing questions

2003-08-28 Thread Francisco J. Bido
The MacOSX (carbon port)  command turned out to be, surprisingly enough,

macintosh()

Thanks!

On Thursday, August 28, 2003, at 07:19 AM, Peter Dalgaard BSA wrote:

Thomas Petzoldt [EMAIL PROTECTED] writes:

Marc Schwartz wrote:
In general, if you want to leave the existing device open and have a 
new
device open for a new plot, you simply call the device name that you
want to open (ie. under Linux you would use X11() ) to open a new
plotting device on the display.  See ?Devices for more details.
X11() works on Windows too.
..but the orig. poster was using a Mac.

--
   O__   Peter Dalgaard Blegdamsvej 3
  c/ /'_ --- Dept. of Biostatistics 2200 Cph. N
 (*) \(*) -- University of Copenhagen   Denmark  Ph: (+45) 35327918
~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] make dvi fails

2003-08-28 Thread William D. McCoy
I am working with a RedHat 9 system with gcc 3.2.2, makeinfo 4.3, and
perl 5.8.

I have just downloaded the latest r-patched with rsync and
successfully compiled the code and passed the tests conducted with
'make check'.

After that, 'make dvi' gives the following result:

make dvi
make[1]: Entering directory `/usr/src/R/doc'
make[2]: Entering directory `/usr/src/R/doc/manual'
creating doc/manual/version.tex
collecting LaTeX docs for package 'base' ...
make[3]: Entering directory `/usr/src/R/src/library'
  Building/Updating help pages for package 'base'
 Formats: latex 
make[3]: Leaving directory `/usr/src/R/src/library'
collecting LaTeX docs for package 'methods' ...
make[3]: Entering directory `/usr/src/R/src/library'
  Building/Updating help pages for package 'methods'
 Formats: latex 
make[3]: Leaving directory `/usr/src/R/src/library'
collecting LaTeX docs for package 'tools' ...
make[3]: Entering directory `/usr/src/R/src/library'
  Building/Updating help pages for package 'tools'
 Formats: latex 
make[3]: Leaving directory `/usr/src/R/src/library'
make[2]: *** No rule to make target `-pkg.tex', needed by `stamp-refman-dvi'.  Stop.
make[2]: Leaving directory `/usr/src/R/doc/manual'
make[1]: *** [dvi] Error 2
make[1]: Leaving directory `/usr/src/R/doc'
make: [dvi] Error 2 (ignored)


'make pdf' gives:

make pdf
make[1]: Entering directory `/usr/src/R/doc'
make[2]: Entering directory `/usr/src/R/doc/manual'
make[2]: *** No rule to make target `-pkg.tex', needed by `stamp-refman-pdf'.  Stop.
make[2]: Leaving directory `/usr/src/R/doc/manual'
make[1]: *** [pdf] Error 2
make[1]: Leaving directory `/usr/src/R/doc'
make: [pdf] Error 2 (ignored)


'make info' works fine.

Is there something wrong with the makefile?  Why the No rule to make
target `-pkg.tex', needed by `stamp-refman-dvi[or pdf] messages?  Any
idea what the problem is?

-- 
William D. McCoy
Geosciences
University of Massachusetts
Amherst, MA  01003

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Cook-distance-type plot (vertical bars)

2003-08-28 Thread Spencer Graves
Have you looked at Modern Applied Statistics with S by Venables and 
Ripley?

hope this helps.  spencer graves

Frank Gibbons wrote:
Thanks to all who responded, and so promptly too: it works exactly as 
you describe.


 Figure 13 of Emmanuel Paradis's R for Beginners was produced by 
termplot
 working on an aov object.

No, it was produced by plot() working on a aov object, as its caption
indicates.  The termplot() is Figure 14.


Thomas Lumley is quite right, it's produced by plot() (not termplot()), 
and it is mentioned on p31 of R for beginners. My mistake.

In the interest of self education, is there a more comprehensive source 
for plot-types that I should read? Ideally, this would be something with 
lots of figures, so that I could browse the figures to find what I want 
to do, and then look up how to do it. R for Beginners goes some way 
along this path, but perhaps there's something more comprehensive?

Thanks again,

-Frank

PhD, Computational Biologist,
Harvard Medical School BCMP/SGM-322, 250 Longwood Ave, Boston MA 02115, 
USA.
Tel: 617-432-3555   Fax: 617-432-3557   
http://llama.med.harvard.edu/~fgibbons

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Cook-distance-type plot (vertical bars)

2003-08-28 Thread Prof Brian Ripley
On Thu, 28 Aug 2003, Frank Gibbons wrote:

 Thanks to all who responded, and so promptly too: it works exactly as you 
 describe.
 
  
   Figure 13 of Emmanuel Paradis's R for Beginners was produced by termplot
   working on an aov object.
 
 No, it was produced by plot() working on a aov object, as its caption
 indicates.  The termplot() is Figure 14.
 
 Thomas Lumley is quite right, it's produced by plot() (not termplot()), and 
 it is mentioned on p31 of R for beginners. My mistake.
 
 In the interest of self education, is there a more comprehensive source for 
 plot-types that I should read? Ideally, this would be something with lots 
 of figures, so that I could browse the figures to find what I want to do, 
 and then look up how to do it. R for Beginners goes some way along this 
 path, but perhaps there's something more comprehensive?

`An Introduction to R'
`Modern Applied Statistics with S'

as in the R FAQ (and there may be others).

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

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


RE: [R] Cook-distance-type plot (vertical bars)

2003-08-28 Thread Paul, David A
I'm (relatively) new to R myself, and recently found 
the documentation by Dr. William Cleveland et al at

http://cm.bell-labs.com/cm/ms/departments/sia/project/trellis/
http://cm.bell-labs.com/cm/ms/departments/sia/project/trellis/software.writi
ng.html

It has been helpful, and covers S/Splus trellis graphics.  In R, the
equivalent is known as lattice graphics, and the syntax is
virtually identical.  Earlier today, Dr. Peter Dunn posted a 
notice to the R listserv announcing a workshop in Australia being
led by Dr. John Maindonald... in that announcement, you will find

...John Maindonald, the author of the forthcoming book 'Data Analysis 
and Graphics Using R: An Example-Based Approach' (with John Braun)...

so apparently there is a forthcoming book detailing the graphical
capabilities of R.  I'm eagerly awaiting the opportunity to buy it
and digest its contents!  Until then, I think the links to the 
.ps and .pdf files above should serve well.


Best wishes,
  david paul


P.S. - You should keep in mind that there are two classes of 
graphical functions in S/Splus/R: regular functions and
trellis/lattice functions.  They operate very differently.
After using a few of each, I must say that I am very impressed
with the power and flexibility of the trellis/lattice 
plotting functions.



-Original Message-
From: Frank Gibbons [mailto:[EMAIL PROTECTED] 
Sent: Thursday, August 28, 2003 1:53 PM
To: R users
Subject: Re: [R] Cook-distance-type plot (vertical bars)


Thanks to all who responded, and so promptly too: it works exactly as you 
describe.

 
  Figure 13 of Emmanuel Paradis's R for Beginners was produced by 
  termplot working on an aov object.

No, it was produced by plot() working on a aov object, as its caption 
indicates.  The termplot() is Figure 14.

Thomas Lumley is quite right, it's produced by plot() (not termplot()), and 
it is mentioned on p31 of R for beginners. My mistake.

In the interest of self education, is there a more comprehensive source for 
plot-types that I should read? Ideally, this would be something with lots 
of figures, so that I could browse the figures to find what I want to do, 
and then look up how to do it. R for Beginners goes some way along this 
path, but perhaps there's something more comprehensive?

Thanks again,

-Frank

PhD, Computational Biologist,
Harvard Medical School BCMP/SGM-322, 250 Longwood Ave, Boston MA 02115, USA.
Tel: 617-432-3555   Fax: 
617-432-3557   http://llama.med.harvard.edu/~fgibbons

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] how to randomize data matrix

2003-08-28 Thread szhan
Dear R users:
Is there a function or easier way to randomize the data between rows
(considering a row as a whole unit)? For example,
original data:
   A1  A2  A3  A4
B1 1   2   3   4
B2 5   6   7   8
B3 9   10  11  12
B4 13  14  15  16
randomized data:
   A1  A2  A3  A4
B4 13  14  15  16
B2 5   6   7   8
B1 1   2   3   4
B3 9   10  11  12
Thank you for your attention!
Joshua

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] how to randomize data matrix

2003-08-28 Thread Spencer Graves
A - array(1:16, dim=c(4,4))
dimnames(A) - list(LETTERS[1:4], letters[1:4])
A[sample(1:4), ]
 A - array(1:16, dim=c(4,4))
 dimnames(A) - list(LETTERS[1:4], letters[1:4])
 A[sample(1:4), ]
  a b  c  d
C 3 7 11 15
B 2 6 10 14
D 4 8 12 16
A 1 5  9 13

hope this helps.  spencer graves
[EMAIL PROTECTED] wrote:
Dear R users:
Is there a function or easier way to randomize the data between rows
(considering a row as a whole unit)? For example,
original data:
   A1  A2  A3  A4
B1 1   2   3   4
B2 5   6   7   8
B3 9   10  11  12
B4 13  14  15  16
randomized data:
   A1  A2  A3  A4
B4 13  14  15  16
B2 5   6   7   8
B1 1   2   3   4
B3 9   10  11  12
Thank you for your attention!
Joshua
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] mtext / expression and font type of bold

2003-08-28 Thread Al Piszcz
mtext does not appear to be rendering a 'bold' expression.
Is there another parameter to set? Thx.

example (does not create bold (font=2) on plot)
  mtext( font=2, expression(paste(y,  = ,  x + z), side=3 )

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] nls minFactor and constraints [was (no subject)]

2003-08-28 Thread Spencer Graves
In my experience, transformations of the type Doug just described has 
often made sums of squares (or log(likelihood)) contours more parabolic, 
thereby increasing the accuracy of the simple normal approximations to 
the distributions of parameter estimates.  It is wise to check these 
things, as it is not always true.

hope this helps.  spencer graves

Douglas Bates wrote:
giovanni caggiano [EMAIL PROTECTED] writes:


A couple of questions about the nls package.


1. I'm trying to run a nonlinear least squares
regression but the routine gives me the following
error message:
step factor 0.000488281 reduced below `minFactor' of
0.000976563
even though I previously wrote the following command: 
nls.control(minFactor = 1/4096), which should set the
minFactor to a lower level than the default one,
1/1024=0.000976563. 
Is there any way of setting the new minfactor to a
lower level?


You need to set control=nls.control(minFactor=1/4096) in the call to
nls.

2. Is it possible to set some constraints upon the
parameters to be estimated in a nls regression?


Other than by parameter transformation, no.  See section 3.4.1 of
Bates and Watts (1988), Nonlinear Regression Analysis and Its
Applications, Wiley to see how to use parameter transformations for
this.
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help