R: [R] solving for a transition point in a piecewise nonlinear model

2004-07-14 Thread Vito Muggeo
Dear Robert,
In general it may be difficult to estimate a model with generic (possibly
nonlinear) functions before/after the changepoint  to be estimated too.

However if you are willing to make some restrinctions on your F1(.) and
F2(.), you could semplify the problem..

For instance, have a look to the strucchange and segmented packages. The
former mainly deals with time series data, the latter with GLM.

hope this helps,
vito

PS Of course you can always perform a grid-search algorithm by fitting
different models for each fixed alpha, and picking the value that maximizes
the Lik..



- Original Message -
From: Robert Musk [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, July 14, 2004 6:43 AM
Subject: [R] solving for a transition point in a piecewise nonlinear model


 I want to fit a piecewise nonlinear model in which the transition point is
 an estimated parameter.

 Something like:

 F(x)=F1(x) when xalpha,
 F(x)=F2(x) when x=alpha.

 How can I solve for alpha within the nls call?

 Thanks,
 Rob

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

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


Re: [R] summary() doesn't work with Date class objects

2004-07-14 Thread Uwe Ligges
Scott Waichler wrote:
The handy function summary() doesn't work correctly with Date class
objects:

R.version.string
[1] R version 1.9.1, 2004-06-21
b - as.Date(c(2002-12-26, 2002-12-27, 2002-12-28, 2002-12-29, 2002-12-30))
b
[1] 2002-12-26 2002-12-27 2002-12-28 2002-12-29 2002-12-30
summary(b)
Min.  1st Qu.   Median Mean  3rd Qu. Max.
2002-12-29 2002-12-29 2002-12-29 2002-12-29 2002-12-29 2002-12-29
The obvious fix is to change summary.date (in 
.../src/library/base/R/dates.R) as follows:

old:
summary.Date - function(object, ...)
{
x - summary.default(unclass(object), ...)[1:6]# not NA's
class(x) - oldClass(object)
x
}
new:
summary.Date - function(object, ...)
{
x - unclass(object)
x - summary.default(x, digits = floor(log(x)) + 1, ...)[1:6]# not NA's
class(x) - oldClass(object)
x
}

One might want to change floor(log(x)) + 1 to something less 
computational in intensive like 10. ;-)

Uwe Ligges
BTW: Should I submit a bug report or does anybody fix the sources at once?

Scott Waichler
Pacific Northwest National Laboratory
Richland, WA   99352USA
[EMAIL PROTECTED]
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] RGui Titlebar

2004-07-14 Thread Erich Neuwirth
In the windows version (RGui), is there a way to set
the text displayed in the titlebar of the R window?
When I have 2 instances of RGui running, it would be helpul
if the titlebar could help to understand which is which.
--
Erich Neuwirth, Computer Supported Didactics Working Group
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-38624 Fax: +43-1-4277-9386
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] A function likes table

2004-07-14 Thread Perez Martin, Agustin
DeaR useRs:
 
Excuse me for my  bad English.
 
I am looking for a function likes table or ftable which returns the sum in a
object by the cross tabulation, not the counts of the cross tabulation.
I don’t know if everybody understand me.
 
Thank you very much.
 
Agus

---



 

[[alternative HTML version deleted]]

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


[R] Re:

2004-07-14 Thread Yong Wang
use 

unique(data) 

or

table(data)

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


Re: [R] Permutations

2004-07-14 Thread F. Tusell
Jordi:
If I understand you well, the function below may do what you asked for.
It is not clear to me from your posting wether e.g.
  1 2 4   3 5 6   7 8 910 11 12
and
  1 4 2   3 5 6   7 8 910 11 12
should count as differente permutations, i.e., wether once one pair of 
elements interchange their
blocks, permutations within any block are allowable. I have assumed that 
only one pair of
elements are interchanged (but the function could be modified to account 
for other possibilities).

 permutations
function(elements,blocks) {
   n - length(elements)
   el.per.block - n / blocks
   for (i in 1:n) {# For each element in turn,
 b - floor(i/(el.per.block+.1))+1 # find which block it belongs to.
 if (b==blocks)# If in the last block, we are done.
   break
 allow.pos - b*el.per.block + 1   # Find first position it could 
migrate to...
 for (j in (allow.pos:n)) {# and create permutations with 
all allowable
   perm - elements# interchanges.
   perm[i] - elements[j]
   perm[j] - elements[i]
   print(perm)
 }
   }   
 }

 permutations(1:4,2)
[1] 3 2 1 4
[1] 4 2 3 1
[1] 1 3 2 4
[1] 1 4 3 2
 permutations(1:6,2)
[1] 4 2 3 1 5 6
[1] 5 2 3 4 1 6
[1] 6 2 3 4 5 1
[1] 1 4 3 2 5 6
[1] 1 5 3 4 2 6
[1] 1 6 3 4 5 2
[1] 1 2 4 3 5 6
[1] 1 2 5 4 3 6
[1] 1 2 6 4 5 3
 permutations(1:9,3)
[1] 4 2 3 1 5 6 7 8 9
[1] 5 2 3 4 1 6 7 8 9
[1] 6 2 3 4 5 1 7 8 9
[1] 7 2 3 4 5 6 1 8 9
[1] 8 2 3 4 5 6 7 1 9
[1] 9 2 3 4 5 6 7 8 1
[1] 1 4 3 2 5 6 7 8 9
[1] 1 5 3 4 2 6 7 8 9
[1] 1 6 3 4 5 2 7 8 9
[1] 1 7 3 4 5 6 2 8 9
[1] 1 8 3 4 5 6 7 2 9
[1] 1 9 3 4 5 6 7 8 2
[1] 1 2 4 3 5 6 7 8 9
[1] 1 2 5 4 3 6 7 8 9
[1] 1 2 6 4 5 3 7 8 9
[1] 1 2 7 4 5 6 3 8 9
[1] 1 2 8 4 5 6 7 3 9
[1] 1 2 9 4 5 6 7 8 3
[1] 1 2 3 7 5 6 4 8 9
[1] 1 2 3 8 5 6 7 4 9
[1] 1 2 3 9 5 6 7 8 4
[1] 1 2 3 4 7 6 5 8 9
[1] 1 2 3 4 8 6 7 5 9
[1] 1 2 3 4 9 6 7 8 5
[1] 1 2 3 4 5 7 6 8 9
[1] 1 2 3 4 5 8 7 6 9
[1] 1 2 3 4 5 9 7 8 6
Notice that no error checking of any kind is done: one should check, 
e.g. that el.per.block is
integer.

Best,
ft.
--
Fernando TUSELLe-mail:
Departamento de Econometría y Estadística   [EMAIL PROTECTED] 
Facultad de CC.EE. y Empresariales Tel:   (+34)94.601.3733
Avenida Lendakari Aguirre, 83  Fax:   (+34)94.601.3754
E-48015 BILBAO  (Spain)Secr:  (+34)94.601.3740

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


Re: [R] Permutations

2004-07-14 Thread Erich Neuwirth
Perhaps what you want might better be described as
ordered partitions?
Is what you want the following:
We study sequences of length 12 and divide them in
4 segments
position 1 2 3, position 4 5 6,
position 7 8 9, position 10 11 12,
Find all permutation sequences of the numbers 1 to 12
with the property that all segment sequences
are monotonically increasing.
I think that produces what you need.
Since the segments are ordered, you avoid intra-block permutations.
If that is what you want, writing a recursive function should not be
too hard.

Jordi Altirriba Gutirrez wrote:
Dear R users,
Im a beginner user of R and Ive a problem with permutations that I 
dont know how to solve. Ive 12 elements in blocks of 3 elements and I 
want only to make permutations inter-blocks (no intra-blocks) (sorry if 
the terminology is not accurate), something similar to:

1 2 3 | 4 5 6 | 7 8 9 | 10 11 12   --1st permutation
1 3 2 | 4 5 6 | 7 8 9 | 10 11 12   NO
  -  -
3 2 1 | 4 5 6 | 7 8 9 | 10 11 12   NO
-  -  -
1 2 4 | 3 5 6 | 7 8 9 | 10 11 12   YES-2nd permutation
 --
4 5 6 | 1 2 3 | 7 8 9 | 10 11 12   YES-3rd permutation
-  -  -   -  -  -
4 5 6 | 2 1 3 | 7 8 9 | 10 11 12   NO
  -  -

 Thanks for your time,
Jordi Altirriba
Ph D student
Hospital Clinic  Barcelona - Spain
MSN Motor. http://motor.msn.es/researchcentre/
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! 
http://www.R-project.org/posting-guide.html


--
Erich Neuwirth, Computer Supported Didactics Working Group
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-38624 Fax: +43-1-4277-9386
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] RGui Titlebar

2004-07-14 Thread Henrik Bengtsson
It look like this will be possible from R v2.0.0;

From http://cran.r-project.org/bin/windows/base/CHANGES.rw2000dev

 Added functions setWindowTitle(), getWindowTitle(), and
getIdentification().

To R-devel: Will this be 1) Rgui only? and/or 2) Windows only?

Cheers

Henrik Bengtsson

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Erich Neuwirth
 Sent: Wednesday, July 14, 2004 8:57 AM
 To: [EMAIL PROTECTED]
 Subject: [R] RGui Titlebar
 
 
 In the windows version (RGui), is there a way to set
 the text displayed in the titlebar of the R window?
 
 When I have 2 instances of RGui running, it would be helpul
 if the titlebar could help to understand which is which.
 
 
 -- 
 Erich Neuwirth, Computer Supported Didactics Working Group 
 Visit our SunSITE at http://sunsite.univie.ac.at
 Phone: +43-1-4277-38624 Fax: +43-1-4277-9386
 
 __
 [EMAIL PROTECTED] mailing list 
 https://www.stat.math.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! 
 http://www.R-project.org/posting-guide.html
 


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


[R] SWIG for R

2004-07-14 Thread Hisaji ONO
Hi.

 Has R dev. team considered employing SWIG(http://www.swig.org/), which
supports PHP, Ruby, Java etc.,
for connecting C/C++ libraries with R?


 Regards.

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


Re: [R] (no subject) (was: Permutations)

2004-07-14 Thread Robin Hankin
Jordi
try this
R x - c(1,2,3,  10,11,12,  41,42,43,  81,82,83)
R dim(x) - c(3,4)
R x
 [,1] [,2] [,3] [,4]
[1,]1   10   41   81
[2,]2   11   42   82
[3,]3   12   43   83
R  jj - t(apply(x,1,sample))
R jj
 [,1] [,2] [,3] [,4]
[1,]1   41   10   81
[2,]2   11   82   42
[3,]   123   43   83
R as.vector(jj)
R
   [1]  1 2 12 41 11 3 10 82 43 81 42 83

and I think that does what you want...
We take the vector, rearrange it into a matrix with three rows, then 
sample *within* the rows,
then rearrange into a vector again.

There will be one forbidden permutation, namely the identity (which 
may or may not be
desirable).

This method doesn't allow intra block permutations.
best
rksh

 Dear R users,
 First of all, thanks for the incredibly fast answers and help of 
Rolf, Marc and Robert.
 Yes, I noticed that it was a lot of permutacions, but my intention 
was to make this process automatic and take only 5.000 - 10.000 
permutations. Therefore, I wanted only to take that interesting 
permutations with some information [inter-block permutations].
 The reason why I'm interested in these permutations is because I'm 
using some packages of Bioconductor to analyse my data from some 
microarrays and I thought that perhaps could be interesting to see 
what happens when I permute my data and I compare it against the not 
permuted data.
 Thanks again for your time and suggestions.

Jordi Altirriba
Ph. D. Student
Hospital Clinic-Barcelona-Spain
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

--
Robin Hankin
Uncertainty Analyst
Southampton Oceanography Centre
SO14 3ZH
tel +44(0)23-8059-7743
[EMAIL PROTECTED] (edit in obvious way; spam precaution)
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] ROracle - fetch gives empty dataframe

2004-07-14 Thread Rado Bonk
Dear R-users,
I was able to make ROracle package to connect to the DB (Oracle91, 
64bit, on Solaris). But after executing siple SQL query, fetch 
commaned gives me an empty dataframe.

### RORACLE INSTALATION PROCEDURE ###
R CMD INSTALL --configure-args='--enable-extralibs' --enable-oracle32=no 
~/tmp/ROracle_0.5-5.tar.gz  #since we have 64bit Oracle9i instalation

PROBLEM: after executing simple statement, from within R, fetch 
function gives me the empty dataframe:

### CONNECTION, and SQL QUERY EXECUTION
 ora - dbDriver(Oracle)
 con - dbConnect(ora, rado/only2admin
 dbListTables(con)
character(0)
 rs - dbSendQuery(con, desc * from si_r where id=498)
 d - fetch(rs, n= -1)
 dim(d)
[1] 0 3
str(d)
data.frame':   0 obs. of  3 variables:
$ ID : int
$ DAY: chr
$ R  : num
 seems like connections has been established
 dbGetInfo(ora)
$drvName
[1] Oracle (ProC/C++)
$connectionIds
$connectionIds[[1]]
OraConnection:(14939,0)
$fetch_default_rec
[1] 500
$managerId
OraDriver:(14939)
$length
[1] 10
$num_con
[1] 1
$counter
[1] 1
$clientVersion
[1] 0.5-4
Maybe it is something stupid (and I need just a hint), or may be it is 
something major.

Thanks in advance,
Rado Bonk
--
Dr. Radoslav Bonk
European Commission - DG Joint Research Centre (JRC)
Institute for Environment and Sustainability (IES)
LM Unit - Natural Hazards
Weather Driven Natural Hazards Action
Via E. Fermi, TP 261, 21020 Ispra (Va), Italy
Tel.: 0039-0332-786013
Fax: 0039-0332-786653
Webpage: http://natural-hazards.jrc.it/floods/
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] list of S3-methods

2004-07-14 Thread Meinhard Ploner
how can I get a list of all S3-methods (of a package)
such that I know which functions to include in the S3method()
in the NAMESPACE-file?
Maybe separated by generic=T/F.
thx
Meinhard Ploner
Vienna
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] RGui Titlebar

2004-07-14 Thread Uwe Ligges
Henrik Bengtsson wrote:
It look like this will be possible from R v2.0.0;
From http://cran.r-project.org/bin/windows/base/CHANGES.rw2000dev
 Added functions setWindowTitle(), getWindowTitle(), and
getIdentification().
To R-devel: Will this be 1) Rgui only? and/or 2) Windows only?
Well, the title of that page already tells us Windows-specific changes 
to R 

Uwe Ligges

Cheers
Henrik Bengtsson

-Original Message-
From: [EMAIL PROTECTED] 
[mailto:[EMAIL PROTECTED] On Behalf Of Erich Neuwirth
Sent: Wednesday, July 14, 2004 8:57 AM
To: [EMAIL PROTECTED]
Subject: [R] RGui Titlebar

In the windows version (RGui), is there a way to set
the text displayed in the titlebar of the R window?
When I have 2 instances of RGui running, it would be helpul
if the titlebar could help to understand which is which.
--
Erich Neuwirth, Computer Supported Didactics Working Group 
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-38624 Fax: +43-1-4277-9386

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



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


[R] ROracle - fetch gives...(corrected SQL code)

2004-07-14 Thread Rado Bonk
Sorry for posting the second time, I corrected the SQL code:
PROBLEM: after executing simple statement, from within R, fetch 
function gives me the empty dataframe:

### CONNECTION, and SQL QUERY EXECUTION
 ora - dbDriver(Oracle)
 con - dbConnect(ora, rado/only2admin
 dbListTables(con)
character(0)
 rs - dbSendQuery(con, select * from si_r where id=498)
  ^^ CORRECTION
 d - fetch(rs, n= -1)
 dim(d)
[1] 0 3
str(d)
data.frame':   0 obs. of  3 variables:
$ ID : int
$ DAY: chr
$ R  : num
 seems like connection has been established
 dbGetInfo(ora)
$drvName
[1] Oracle (ProC/C++)
$connectionIds
$connectionIds[[1]]
OraConnection:(14939,0)
$fetch_default_rec
[1] 500
$managerId
OraDriver:(14939)
$length
[1] 10
$num_con
[1] 1
$counter
[1] 1
$clientVersion
[1] 0.5-4
Maybe it is something stupid (and I need just a hint), or may be it is 
something major.

Thanks in advance,
Rado Bonk
--
Dr. Radoslav Bonk
European Commission - DG Joint Research Centre (JRC)
Institute for Environment and Sustainability (IES)
LM Unit - Natural Hazards
Weather Driven Natural Hazards Action
Via E. Fermi, TP 261, 21020 Ispra (Va), Italy
Tel.: 0039-0332-786013
Fax: 0039-0332-786653
Webpage: http://natural-hazards.jrc.it/floods/
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] list of S3-methods

2004-07-14 Thread Uwe Ligges
Meinhard Ploner wrote:
how can I get a list of all S3-methods (of a package)
such that I know which functions to include in the S3method()
in the NAMESPACE-file?
Maybe separated by generic=T/F.
thx
Meinhard Ploner
Vienna

Since one you does not register S3 methods (except for the Namespace 
file), you cannot get such a list very easily.
You might want to look for function names with a dot in it and then look 
whether the second part of that name corresponds to a class.

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


Re: [R] RGui Titlebar

2004-07-14 Thread Duncan Murdoch
On Wed, 14 Jul 2004 09:55:26 +0200, Henrik Bengtsson
[EMAIL PROTECTED] wrote:

It look like this will be possible from R v2.0.0;

From http://cran.r-project.org/bin/windows/base/CHANGES.rw2000dev

 Added functions setWindowTitle(), getWindowTitle(), and
getIdentification().

To R-devel: Will this be 1) Rgui only? and/or 2) Windows only?

From the man page:


 This sets the title of the frame in MDI mode, the title of the
 console for 'RGui --sdi', and the title of the window from which
 it was launched for 'Rterm'. It has no effect in embedded uses of
 R.

Duncan Murdoch

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


Re: [R] list of S3-methods

2004-07-14 Thread Meinhard Ploner
Meinhard Ploner wrote:
how can I get a list of all S3-methods (of a package)
such that I know which functions to include in the S3method()
in the NAMESPACE-file?
Maybe separated by generic=T/F.
thx
Meinhard Ploner
Vienna

Since one you does not register S3 methods (except for the Namespace 
file), you cannot get such a list very easily.
You might want to look for function names with a dot in it and then 
look whether the second part of that name corresponds to a class.

Uwe Ligges
Thank you.
Usually users register S3-methods prior to make libraries or
is this possible only for S4 classes?
Meinhard Ploner
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] RGui Titlebar

2004-07-14 Thread Jens Oehlschlägel

An ugly workaround for versions prior 2.0 would be creating a copy of
Rgui.exe and change its icon (google for 'change icon'). Under xp I also can
just deactivate the icon on the compatibility tab (disable visual themes).

Best


Jens Oehlschlägel

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


Re: [R] list of S3-methods

2004-07-14 Thread Uwe Ligges
Meinhard Ploner wrote:
Meinhard Ploner wrote:
how can I get a list of all S3-methods (of a package)
such that I know which functions to include in the S3method()
in the NAMESPACE-file?
Maybe separated by generic=T/F.
thx
Meinhard Ploner
Vienna

Since one you does not register S3 methods (except for the Namespace 
file), you cannot get such a list very easily.
You might want to look for function names with a dot in it and then 
look whether the second part of that name corresponds to a class.

Uwe Ligges
Thank you.
Usually users register S3-methods prior to make libraries or
is this possible only for S4 classes?
Meinhard Ploner
Yes. S3 method dispatchj is solely based on the naming conventions.
Uwe
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] list of S3-methods

2004-07-14 Thread Martin Maechler
 UweL == Uwe Ligges [EMAIL PROTECTED]
 on Wed, 14 Jul 2004 11:25:20 +0200 writes:

UweL Meinhard Ploner wrote:
 how can I get a list of all S3-methods (of a package)
 such that I know which functions to include in the
 S3method() in the NAMESPACE-file?  Maybe separated by
 generic=T/F.
 
 thx Meinhard Ploner Vienna


UweL Since one you does not register S3 methods (except for
UweL the Namespace file), you cannot get such a list very
UweL easily.  You might want to look for function names
UweL with a dot in it and then look whether the second part
UweL of that name corresponds to a class.

yes;  and for this you can re-use some of the code the current
methods() function has. It *is* doing a very related thing:

Looking for all S3 methods belonging to a given class or to a
given generic.

Martin Maechler

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


Re: [R] ROracle - fetch gives empty dataframe

2004-07-14 Thread Michael Seewald

Dear Rado,

I think you didn't get a proper db connection at all. You forgot to specify
the database to connect to.

On Wed, 14 Jul 2004, Rado Bonk wrote:
 ### CONNECTION, and SQL QUERY EXECUTION
   ora - dbDriver(Oracle)
   con - dbConnect(ora, rado/only2admin

Which database???

   dbListTables(con)
 character(0)

dbListTables would display something, if you had connected. You should get
this working before you proceed.

Regards,
Michael

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


[R] constrOptim and function with additional parameters?

2004-07-14 Thread Marlene Mueller

How can I use a function with some additional input parameters
in constrOptim? For example, something like

fr - function(x,a) {   ## Rosenbrock Banana function
  x1 - x[1]
  x2 - x[2]
  a * (x2 - x1 * x1)^2 + (1 - x1)^2
}

where the optimum is to be found w.r.t. x. Calling
optim(c(-1.2,1), fr, NULL, a=100) works as expected, but I fail 
to provide the a=100 in the constrained case:

  constrOptim(c(-1.2,0.9), fr, NULL, ui=rbind(c(-1,0),c(0,-1)),
ci=c(-1,-1),a=100)
Error in f(theta) : Argument a is missing, with no default

Is this a bug or is there a different solution that I miss here?

TIA, Marlene

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


RE: [R] Smooth monotone estimation on R

2004-07-14 Thread Liaw, Andy
Browsing over the FDA book, I can not find any discussion of monotone
smoothing.

Andy

 From: Kjetil  Halvorsen
 
 Hola!
 
 Experimenting a little, package fda seems very much under 
 development, 
 and help pages are definitely not finished.
 It would certainly help to read the book functional data 
 analysis by 
 the author of fda, which is in our library.
 On the other hand package mgcv is more mature, so it would 
 seem easier 
 to use that.
 
 It is not totally automatic, but the example
 library(mgcv)
 example(mono.con)
 
 has everything necessary to get started.
 
 Kjetil Halvorsen
 
 Eliyahu-Oron wrote:
 
 Kjetil and Andy,
 
 Thanks for your helpful answers! The first two (mgcv and 
 fda) seem to be in
 the direction I'm looking for. I downloaded them both.
 
 I'm running into a lot of implementation difficulties, 
 though. I wonder if
 there's anyone who tried to do a monotone spline using 
 either the 'mgcv' or
 the 'fda' packages, whom I could ask directly?
 
 Thanks again, Assaf
 
 -Original Message-
 From: Kjetil Halvorsen [mailto:[EMAIL PROTECTED]
 Sent: Monday, July 12, 2004 4:32 PM
 To: Assaf P Oron
 Cc: [EMAIL PROTECTED]
 Subject: Re: [R] Smooth monotone estimation on R
 
 
 help.search()
 on my machine turns up only:
 
 mono.con(mgcv)  Monotonicity constraints for a cubic
 regression spline.
 
 smooth.monotone(fda)Monotone Smoothing of Data
 pmreg(ftnonpar) Piecewise monotone regression with taut
 strings
 backSpline(splines) Monotone Inverse Spline
 isoreg(stats)   Isotonic / Monotone Regression
 
 so you should find something of use in packages mgvc, fda, 
 ftnonpar, splines
 or stats (.loaded by default)
 
 Kjetil Halvorsen
 
 
 Assaf P Oron wrote:
 
   
 
 Hi all,
 
 I'm looking for smooth monotone estimation packages, 
 preferably using
 
 
 splines.
   
 
 I downloaded the 'cobs' package and intend to use it, but 
 since it offers
 
 
 only quadratic splines based on L1 minimization, I'd like to 
 compare its
 performance to that of a more 'mainstream' cubic-spline, 
 L2-norm minimizing
 spline. Preferably a smoothing spline.
   
 
 Does anyone know of such code existing anywhere? Or another 
 smooth monotone
 
 
 alternative?
   
 
 Thanks in advance,
 
 Assaf Oron
 Statistics Department
 University of Washington
 
 __
 [EMAIL PROTECTED] mailing list
 https://www.stat.math.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide!
 
 
 http://www.R-project.org/posting-guide.html
   
 
 
 
 
 
 
 __
 [EMAIL PROTECTED] mailing list
 https://www.stat.math.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! 
 http://www.R-project.org/posting-guide.html
 
 
   
 
 
 
 __
 [EMAIL PROTECTED] mailing list
 https://www.stat.math.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! 
 http://www.R-project.org/posting-guide.html
 


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


Re: [R] constrOptim and function with additional parameters?

2004-07-14 Thread Dimitris Rizopoulos
Hi Marlene,

from the on-line help file of `constrOptim' you can see that the ...
argument is used for passing extra arguments to the `optim' function
and not in the function being optimized under constraints.

A simple solution would be to pass the value of the extra argument
directly to the function definition e.g., `fr(x, a=100)'. Otherwise
you could create a new version of `constrOptim' that passes the ...
to the function being optimized and `optim'

I hope this helps.

Best,
Dimitris


Dimitris Rizopoulos
Doctoral Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven

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



- Original Message - 
From: Marlene Mueller [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, July 14, 2004 2:59 PM
Subject: [R] constrOptim and function with additional parameters?



 How can I use a function with some additional input parameters
 in constrOptim? For example, something like

 fr - function(x,a) {   ## Rosenbrock Banana function
   x1 - x[1]
   x2 - x[2]
   a * (x2 - x1 * x1)^2 + (1 - x1)^2
 }

 where the optimum is to be found w.r.t. x. Calling
 optim(c(-1.2,1), fr, NULL, a=100) works as expected, but I fail
 to provide the a=100 in the constrained case:

   constrOptim(c(-1.2,0.9), fr, NULL, ui=rbind(c(-1,0),c(0,-1)),
 ci=c(-1,-1),a=100)
 Error in f(theta) : Argument a is missing, with no default

 Is this a bug or is there a different solution that I miss here?

 TIA, Marlene

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

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


Re: [R] constrOptim and function with additional parameters?

2004-07-14 Thread Duncan Murdoch
On Wed, 14 Jul 2004 14:59:01 +0200 (MEST), Marlene Mueller
[EMAIL PROTECTED] wrote :

How can I use a function with some additional input parameters
in constrOptim? For example, something like

fr - function(x,a) {   ## Rosenbrock Banana function
  x1 - x[1]
  x2 - x[2]
  a * (x2 - x1 * x1)^2 + (1 - x1)^2
}

where the optimum is to be found w.r.t. x. Calling
optim(c(-1.2,1), fr, NULL, a=100) works as expected, but I fail 
to provide the a=100 in the constrained case:

  constrOptim(c(-1.2,0.9), fr, NULL, ui=rbind(c(-1,0),c(0,-1)),
ci=c(-1,-1),a=100)
Error in f(theta) : Argument a is missing, with no default

Is this a bug or is there a different solution that I miss here?

I can't spot why your use of constrOptim isn't working, but you should
be able to workaround it by doing something  like this:

applyDefaults - function(fn, ...) {
  function(x) fn(x, ...)
}

constrOptim(c(-1.2,0.9), applyDefaults(fr, a=100), NULL,
ui=rbind(c(-1,0),c(0,-1)),ci=c(-1,-1))

The applyDefaults function creates a new function which evaluates the
old one with some of the parameters set to fixed values.

Duncan Murdoch

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


Re: [R] constrOptim and function with additional parameters?

2004-07-14 Thread Roger D. Peng
Actually, I think this is a bug.  Take a look at this part of constrOptim:
 constrOptim
function (theta, f, grad, ui, ci, mu = 1e-04, control = list(),
method = if (is.null(grad)) Nelder-Mead else BFGS, 
outer.iterations = 10
0,
outer.eps = 1e-05, ...)
{
if (!is.null(control$fnscale)  control$fnscale  0)
mu - -mu
[...]
obj - f(theta)
^^^
r - R(theta, theta)
for (i in 1:outer.iterations) {
obj.old - obj
r.old - r
[...]
}

So the object function `f' is called on the starting value `theta' but 
the `...' is not passed through.

-roger
Duncan Murdoch wrote:
On Wed, 14 Jul 2004 14:59:01 +0200 (MEST), Marlene Mueller
[EMAIL PROTECTED] wrote :

How can I use a function with some additional input parameters
in constrOptim? For example, something like
fr - function(x,a) {   ## Rosenbrock Banana function
x1 - x[1]
x2 - x[2]
a * (x2 - x1 * x1)^2 + (1 - x1)^2
}
where the optimum is to be found w.r.t. x. Calling
optim(c(-1.2,1), fr, NULL, a=100) works as expected, but I fail 
to provide the a=100 in the constrained case:


constrOptim(c(-1.2,0.9), fr, NULL, ui=rbind(c(-1,0),c(0,-1)),
ci=c(-1,-1),a=100)
Error in f(theta) : Argument a is missing, with no default
Is this a bug or is there a different solution that I miss here?

I can't spot why your use of constrOptim isn't working, but you should
be able to workaround it by doing something  like this:
applyDefaults - function(fn, ...) {
  function(x) fn(x, ...)
}
constrOptim(c(-1.2,0.9), applyDefaults(fr, a=100), NULL,
ui=rbind(c(-1,0),c(0,-1)),ci=c(-1,-1))
The applyDefaults function creates a new function which evaluates the
old one with some of the parameters set to fixed values.
Duncan Murdoch
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] (no subject)

2004-07-14 Thread Herman, David (NIH/NIMH)
Hello,
I'm new to R, and I'm having trouble importing a text file (I'm
on Windows XP)
 
  m - read.table(/Desktop/work/128_L)
Error in file(file, r) : unable to open connection
In addition: Warning message: 
cannot open file `/Desktop/work/128_L'
 
 
do you know why this isn't working?  All I have is a bunch of text files,
each with a single column of about 30,000 rows.
 
thanks

[[alternative HTML version deleted]]

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


RE: [R] Smooth monotone estimation on R

2004-07-14 Thread Eliyahu-Oron
Andy, Kjetil, hi,

I figured out how to run this, after visiting Jim Ramsay's FDA webpage
example on monotone smoothing:
http://ego.psych.mcgill.ca/misc/fda/ex-growth-d1.html

The code there is Matlab, using very similar names to the R names.

First one needs to create a 'blank' B-spline object (using
create.bspline.basis(), then data2fd() with a 'blank' data vector of, say,
zeros).
Then this object is used as the 'Wfdobj' argument in 'smooth.monotone()'.
The smoothing spline version (lambda=some positive constant) seems to work
better than non-penalized splines (lambda=0).
So the command would be
solution-smooth.monotone(x,y,Wfdobj=createdbspline,lambda=0.1)

The fit may be shown using
fitted-solution$beta[1]+solution$beta[2]*eval.monfd(xx,solution$Wfdobj).

eval.monfd() is a utility to perform the integration on the exponent of the
'embedded' B-spline object.

Algebraic details do appear in the 'smooth.monotone()' help, and also on the
webpage.

Ramsay's approach seems to be the one most 'popular' in literature at the
moment, so I'll probably use this package a lot over the next few weeks. If
someone can't access Jim Ramsay or some other 'FDA insider', you can
probably forward them to me regarding smooth.monotone().

Thanks so much again,

Assaf

-Original Message-
From: Liaw, Andy [mailto:[EMAIL PROTECTED]
Sent: Wednesday, July 14, 2004 6:17 AM
To: 'Kjetil Halvorsen'; Eliyahu-Oron
Cc: [EMAIL PROTECTED]
Subject: RE: [R] Smooth monotone estimation on R


Browsing over the FDA book, I can not find any discussion of monotone
smoothing.

Andy

 From: Kjetil  Halvorsen

 Hola!

 Experimenting a little, package fda seems very much under
 development,
 and help pages are definitely not finished.
 It would certainly help to read the book functional data
 analysis by
 the author of fda, which is in our library.
 On the other hand package mgcv is more mature, so it would
 seem easier
 to use that.

 It is not totally automatic, but the example
 library(mgcv)
 example(mono.con)

 has everything necessary to get started.

 Kjetil Halvorsen

 Eliyahu-Oron wrote:

 Kjetil and Andy,
 
 Thanks for your helpful answers! The first two (mgcv and
 fda) seem to be in
 the direction I'm looking for. I downloaded them both.
 
 I'm running into a lot of implementation difficulties,
 though. I wonder if
 there's anyone who tried to do a monotone spline using
 either the 'mgcv' or
 the 'fda' packages, whom I could ask directly?
 
 Thanks again, Assaf
 
 -Original Message-
 From: Kjetil Halvorsen [mailto:[EMAIL PROTECTED]
 Sent: Monday, July 12, 2004 4:32 PM
 To: Assaf P Oron
 Cc: [EMAIL PROTECTED]
 Subject: Re: [R] Smooth monotone estimation on R
 
 
 help.search()
 on my machine turns up only:
 
 mono.con(mgcv)  Monotonicity constraints for a cubic
 regression spline.
 
 smooth.monotone(fda)Monotone Smoothing of Data
 pmreg(ftnonpar) Piecewise monotone regression with taut
 strings
 backSpline(splines) Monotone Inverse Spline
 isoreg(stats)   Isotonic / Monotone Regression
 
 so you should find something of use in packages mgvc, fda,
 ftnonpar, splines
 or stats (.loaded by default)
 
 Kjetil Halvorsen
 
 
 Assaf P Oron wrote:
 
 
 
 Hi all,
 
 I'm looking for smooth monotone estimation packages,
 preferably using
 
 
 splines.
 
 
 I downloaded the 'cobs' package and intend to use it, but
 since it offers
 
 
 only quadratic splines based on L1 minimization, I'd like to
 compare its
 performance to that of a more 'mainstream' cubic-spline,
 L2-norm minimizing
 spline. Preferably a smoothing spline.
 
 
 Does anyone know of such code existing anywhere? Or another
 smooth monotone
 
 
 alternative?
 
 
 Thanks in advance,
 
 Assaf Oron
 Statistics Department
 University of Washington
 
 __
 [EMAIL PROTECTED] mailing list
 https://www.stat.math.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide!
 
 
 http://www.R-project.org/posting-guide.html
 
 
 
 
 
 
 
 __
 [EMAIL PROTECTED] mailing list
 https://www.stat.math.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide!
 http://www.R-project.org/posting-guide.html
 
 
 
 


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





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

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


Re: [R] (no subject)

2004-07-14 Thread Vincent Goulet
Hi,

I but you left out the extension that Windows is hiding from you.

Vincent

On Wednesday 14 July 2004 10:02, Herman, David (NIH/NIMH) wrote:
 Hello,
 I'm new to R, and I'm having trouble importing a text file (I'm
 on Windows XP)

   m - read.table(/Desktop/work/128_L)

 Error in file(file, r) : unable to open connection
 In addition: Warning message:
 cannot open file `/Desktop/work/128_L'


 do you know why this isn't working?  All I have is a bunch of text files,
 each with a single column of about 30,000 rows.

 thanks

   [[alternative HTML version deleted]]

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

-- 
  Vincent Goulet, Professeur agrégé
  École d'actuariat
  Université Laval, Québec 
  [EMAIL PROTECTED]   http://vgoulet.act.ulaval.ca

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


Re: [R] (no subject)

2004-07-14 Thread Wolski
Hello!

It just is not able to find the file as the error message says.
You can check if you are specified the right directory path using dir.

?dir

dir(/Desktop/work/)

I gues you are not.

If you are specifying the full path, precede it with the drive name c:/

Eryk


*** REPLY SEPARATOR  ***

On 7/14/2004 at 10:02 AM Herman, David (NIH/NIMH) wrote:

Hello,
I'm new to R, and I'm having trouble importing a text file
(I'm
on Windows XP)
 
  m - read.table(/Desktop/work/128_L)
Error in file(file, r) : unable to open connection
In addition: Warning message: 
cannot open file `/Desktop/work/128_L'
 
 
do you know why this isn't working?  All I have is a bunch of text files,
each with a single column of about 30,000 rows.
 
thanks

 [[alternative HTML version deleted]]

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



Dipl. bio-chem. Eryk Witold Wolski@MPI-Moleculare Genetic   
Ihnestrasse 63-73 14195 Berlin   'v'
tel: 0049-30-83875219   /   \
mail: [EMAIL PROTECTED]---W-Whttp://www.molgen.mpg.de/~wolski

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


Re: [R] ROracle - fetch gives empty dataframe

2004-07-14 Thread Don MacQueen
This is what I would try next if I were in your situation; I don't 
know it will help.

Try
con - dbConnect(ora, rado/[EMAIL PROTECTED])
instead of
   con - dbConnect(ora, rado/only2admin
The default dbname is Sys.getenv(ORACLE_SID), have you checked that?
For myself, when I make connections to Oracle 9i using ROracle, I use the form
 dbConnect,ora, user='oracleuid',dbname='adbname',password='whatever')
-Don
At 10:38 AM +0200 7/14/04, Rado Bonk wrote:
Dear R-users,
I was able to make ROracle package to connect to the DB (Oracle91, 
64bit, on Solaris). But after executing siple SQL query, fetch 
commaned gives me an empty dataframe.

### RORACLE INSTALATION PROCEDURE ###
R CMD INSTALL --configure-args='--enable-extralibs' 
--enable-oracle32=no ~/tmp/ROracle_0.5-5.tar.gz  #since we have 
64bit Oracle9i instalation

PROBLEM: after executing simple statement, from within R, fetch 
function gives me the empty dataframe:

### CONNECTION, and SQL QUERY EXECUTION
  ora - dbDriver(Oracle)
  con - dbConnect(ora, rado/only2admin
  dbListTables(con)
character(0)
 rs - dbSendQuery(con, desc * from si_r where id=498)
 d - fetch(rs, n= -1)
 dim(d)
[1] 0 3
str(d)
data.frame':   0 obs. of  3 variables:
$ ID : int
$ DAY: chr
$ R  : num
 seems like connections has been established
 dbGetInfo(ora)
$drvName
[1] Oracle (ProC/C++)
$connectionIds
$connectionIds[[1]]
OraConnection:(14939,0)
$fetch_default_rec
[1] 500
$managerId
OraDriver:(14939)
$length
[1] 10
$num_con
[1] 1
$counter
[1] 1
$clientVersion
[1] 0.5-4
Maybe it is something stupid (and I need just a hint), or may be it 
is something major.

Thanks in advance,
Rado Bonk
--
Dr. Radoslav Bonk
European Commission - DG Joint Research Centre (JRC)
Institute for Environment and Sustainability (IES)
LM Unit - Natural Hazards
Weather Driven Natural Hazards Action
Via E. Fermi, TP 261, 21020 Ispra (Va), Italy
Tel.: 0039-0332-786013
Fax: 0039-0332-786653
Webpage: http://natural-hazards.jrc.it/floods/
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

--
--
Don MacQueen
Environmental Protection Department
Lawrence Livermore National Laboratory
Livermore, CA, USA
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] (no subject)

2004-07-14 Thread Duncan Murdoch
On Wed, 14 Jul 2004 10:11:30 -0400, Vincent Goulet
[EMAIL PROTECTED] wrote :

Hi,

I but you left out the extension that Windows is hiding from you.

Yes indeed!  Why Windows hides extensions has never made any sense to
me.  To turn off this seriously broken behaviour, open a folder, then
in the Tools|Folder Options dialog, find Hide extensions for known
file types and make sure it is not checked.  In Win XP it's under the
View tab, around 10 lines down; I think it's in other places in other
versions.

Duncan Murdoch


Vincent

On Wednesday 14 July 2004 10:02, Herman, David (NIH/NIMH) wrote:
 Hello,
 I'm new to R, and I'm having trouble importing a text file (I'm
 on Windows XP)

   m - read.table(/Desktop/work/128_L)

 Error in file(file, r) : unable to open connection
 In addition: Warning message:
 cannot open file `/Desktop/work/128_L'


 do you know why this isn't working?  All I have is a bunch of text files,
 each with a single column of about 30,000 rows.

 thanks

  [[alternative HTML version deleted]]

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

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


[R] Running the optimization on the subset of parameters

2004-07-14 Thread Victoria Landsman
Dear all,
I'd like to find a minimum of (-loglik) function which is a function of k parameters. 
I'd like to run the minimization algorithm for the different subsets of the parameters 
and assign the fixed values to the complementary subset. How should I define my 
(-loglik) function such that it can be passed to the optim or other optimization 
function?
 
Much thanks for any suggestions. 
Vicky Landsman. 
[[alternative HTML version deleted]]

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


Re: [R] table lookup n R

2004-07-14 Thread Don MacQueen
There is also the match() function, and the %in% operator, either of 
which might do the job, depending on your exact details. For example,

   (1:26)[letters %in% c('x','t','j')]
-Don
At 2:34 PM +0200 7/13/04, Anne wrote:
Hello R helpers!
I looked  but did not find a table-lookup R-utility. I could use a 
loop to do the job (old FORTRAN/C habits die hard) but if I have a 
big table in which I have to search for the values corresponding to 
a vector, I end up logically with a double loop.
Is there already such a utility? Otherwise, is there a way without loops?

Thanks as always
Anne

Anne Piotet
Tel: +41 79 359 83 32 (mobile)
Email: [EMAIL PROTECTED]
---
M-TD Modelling and Technology Development
PSE-C
CH-1015 Lausanne
Switzerland
Tel: +41 21 693 83 98
Fax: +41 21 646 41 33
--
[[alternative HTML version deleted]]
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

--
--
Don MacQueen
Environmental Protection Department
Lawrence Livermore National Laboratory
Livermore, CA, USA
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] constrOptim and function with additional parameters?

2004-07-14 Thread Dimitris Rizopoulos
This is why the `...' argument is passed to `optim' and not to the
function being optimized, as it also referred in the help file of
`constrOptim'

 constrOptim
function (theta, f, grad, ui, ci, mu = 1e-04, control = list(),
method = if (is.null(grad)) Nelder-Mead else BFGS,
outer.iterations = 100,
outer.eps = 1e-05, ...)

...

 a - optim(theta.old, fun, gradient, control = control,
method = method, ...)

...
}


Best,
Dimitris


Dimitris Rizopoulos
Doctoral Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven

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


- Original Message - 
From: Roger D. Peng [EMAIL PROTECTED]
To: Duncan Murdoch [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]; Marlene Mueller
[EMAIL PROTECTED]
Sent: Wednesday, July 14, 2004 4:01 PM
Subject: Re: [R] constrOptim and function with additional parameters?


 Actually, I think this is a bug.  Take a look at this part of
constrOptim:

   constrOptim
 function (theta, f, grad, ui, ci, mu = 1e-04, control = list(),
  method = if (is.null(grad)) Nelder-Mead else BFGS,
 outer.iterations = 10
 0,
  outer.eps = 1e-05, ...)
 {
  if (!is.null(control$fnscale)  control$fnscale  0)
  mu - -mu
  [...]
  obj - f(theta)
  ^^^
  r - R(theta, theta)
  for (i in 1:outer.iterations) {
  obj.old - obj
  r.old - r
  [...]
 }

 So the object function `f' is called on the starting value `theta'
but
 the `...' is not passed through.

 -roger

 Duncan Murdoch wrote:
  On Wed, 14 Jul 2004 14:59:01 +0200 (MEST), Marlene Mueller
  [EMAIL PROTECTED] wrote :
 
 
 How can I use a function with some additional input parameters
 in constrOptim? For example, something like
 
 fr - function(x,a) {   ## Rosenbrock Banana function
  x1 - x[1]
  x2 - x[2]
  a * (x2 - x1 * x1)^2 + (1 - x1)^2
 }
 
 where the optimum is to be found w.r.t. x. Calling
 optim(c(-1.2,1), fr, NULL, a=100) works as expected, but I fail
 to provide the a=100 in the constrained case:
 
 
  constrOptim(c(-1.2,0.9), fr, NULL, ui=rbind(c(-1,0),c(0,-1)),
 
 ci=c(-1,-1),a=100)
 Error in f(theta) : Argument a is missing, with no default
 
 Is this a bug or is there a different solution that I miss here?
 
 
  I can't spot why your use of constrOptim isn't working, but you
should
  be able to workaround it by doing something  like this:
 
  applyDefaults - function(fn, ...) {
function(x) fn(x, ...)
  }
 
  constrOptim(c(-1.2,0.9), applyDefaults(fr, a=100), NULL,
  ui=rbind(c(-1,0),c(0,-1)),ci=c(-1,-1))
 
  The applyDefaults function creates a new function which evaluates
the
  old one with some of the parameters set to fixed values.
 
  Duncan Murdoch
 
  __
  [EMAIL PROTECTED] mailing list
  https://www.stat.math.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html
 

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

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


Re: [R] notes on specifying paths and file extensions in Windows; was: (no subject)

2004-07-14 Thread Uwe Ligges
Duncan Murdoch wrote:
On Wed, 14 Jul 2004 10:11:30 -0400, Vincent Goulet
[EMAIL PROTECTED] wrote :

Hi,
I but you left out the extension that Windows is hiding from you.

Yes indeed!  Why Windows hides extensions has never made any sense to
me.  To turn off this seriously broken behaviour, open a folder, then
in the Tools|Folder Options dialog, find Hide extensions for known
file types and make sure it is not checked.  In Win XP it's under the
View tab, around 10 lines down; I think it's in other places in other
versions.
In particular, the path for sure does not realy start with /Desktop...
You might want to try
  dir(file.path(Sys.getenv(USERPROFILE), Desktop/work))
and correct the entry to
  read.table(file.path(Sys.getenv(USERPROFILE), 
Desktop/work/128_L.YourExtension))

Uwe Ligges
BTW: I wonder why nobody uses a sensible subject in this thread

Duncan Murdoch

Vincent
On Wednesday 14 July 2004 10:02, Herman, David (NIH/NIMH) wrote:
Hello,
   I'm new to R, and I'm having trouble importing a text file (I'm
on Windows XP)

m - read.table(/Desktop/work/128_L)
Error in file(file, r) : unable to open connection
In addition: Warning message:
cannot open file `/Desktop/work/128_L'
do you know why this isn't working?  All I have is a bunch of text files,
each with a single column of about 30,000 rows.
thanks
[[alternative HTML version deleted]]
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html

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


Re: [R] ROracle - fetch gives empty dataframe

2004-07-14 Thread Rado Bonk
Michael,
Yes you are right, I forgot to specify the dbname when posting in R-help 
list. But not in my R-code, since it is specified in ORACLE_SID variable 
on Linux. Using the proper syntax I still get an empty data frame:

 library(ROracle)
 drv - dbDriver(Oracle)
 con - dbConnect(drv, rado/[EMAIL PROTECTED])
 dbListTables(con)
character(0)
 q.sql - c(select * from si_r where id=498)
 rs - dbSendQuery(con, q.sql)
 data - fetch(rs, n= -1)
 dim(data)
[1] 0 3
 dbGetStatement(rs)
[1] select * from si_r where id=498
 dbGetInfo(con)
$dbname
[1] dea
$user
[1] rado
$passwd
[1] mypassword
$conType
[1] NA
$serverVersion
[1] NA
$protocolVersion
[1] NA
$threadId
[1] -1
$resultSetIds
$resultSetIds[[1]]
OraResult:(15551,0,2)
 data
[1] ID  DAY R
0 rows (or 0-length row.names)

### CONNECTION, and SQL QUERY EXECUTION
 ora - dbDriver(Oracle)
 con - dbConnect(ora, rado/only2admin

Which database???
--
Radoslav Bonk
European Commission - DG Joint Research Centre (JRC)
Institute for Environment and Sustainability (IES)
LM Unit - Natural Hazards
Weather Driven Natural Hazards Action
Via E. Fermi, TP 261, 21020 Ispra (Va), Italy
Tel.: 0039-0332-786013
Fax: 0039-0332-786653
Webpage: http://natural-hazards.jrc.it/floods/
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] duplicate row importing issue

2004-07-14 Thread Herman, David (NIH/NIMH)
Hello,
I'm simply trying to import a .txt file that has a column of
about 30,000 pts. I found the file, but I'm getting an error:
 m - read.table(choose.files())
Error in row.names-.data.frame(`*tmp*`, value = row.names) : 
duplicate row.names are not allowed
 
Any help with getting around this?
 
I really appreciate all the help.
Thanks
dave

[[alternative HTML version deleted]]

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


[R] Tcl/Tk and R

2004-07-14 Thread Talita Leite
Hi!!
I'm using the R package tcltk. See the stretch of code below:
tbn1 = tclvalue(tkadd(tn,label=Modify Data))
tkpack(tbw1 - .Tk.newwin(tbn1))
tkpack(fr1 - tkframe(tbw1))
tkpack(lb1- tkwidget(fr1,iwidgets::labeledframe))
When I try to execute this I have this error at the last line:
Error in structure(.External(dotTclObjv, objv, PACKAGE = tcltk), class = 
tclObj) :
   [tcl] can't find usual code for tag Frame.

Please help me!!
Thank's
Talita Perciano Costa Leite
Graduanda em Ciência da Computação
Universidade Federal de Alagoas - UFAL
Departamento de Tecnologia da Informação - TCI
Construção de Conhecimento por Agrupamento de Dados - CoCADa
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] duplicate row importing issue

2004-07-14 Thread Adaikalavan Ramasamy
Try read.table(choose.files(), row.names=NULL).

BTW, I think you might be using an older R version because in R-1.9.1,
the value for row.names is missing by default in read.table(). 

 args(read.table)
function (file, header = FALSE, sep = , quote = \', dec = .,
   row.names, col.names, as.is = FALSE, na.strings = NA, 
   colClasses = NA, nrows = -1, skip = 0, check.names = TRUE, 
   fill = !blank.lines.skip, strip.white = FALSE, 
   blank.lines.skip = TRUE, comment.char = #)

Try read.delim() or read.csv() if the data is tab-delimited or comma
separated. Also check to see if you have a header, in which case you
would set the option header=TRUE. For more info, help(read.table).

Do dim(m), head(m) to see if the data has been read correctly.


On Wed, 2004-07-14 at 16:12, Herman, David (NIH/NIMH) wrote:
 Hello,
 I'm simply trying to import a .txt file that has a column of
 about 30,000 pts. I found the file, but I'm getting an error:
  m - read.table(choose.files())
 Error in row.names-.data.frame(`*tmp*`, value = row.names) : 
 duplicate row.names are not allowed
  
 Any help with getting around this?
  
 I really appreciate all the help.
 Thanks
 dave
 
   [[alternative HTML version deleted]]
 
 __
 [EMAIL PROTECTED] mailing list
 https://www.stat.math.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


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


RE: [R] duplicate row importing issue

2004-07-14 Thread John Fox
Dear David,

If there is one fewer variable name in the first row of the data file than
fields in the remaining rows, then read.table() will treat the first entry
in each row as the row name. Simply add a new first variable (such as
name) to the first row, and specify header=TRUE in the call to
read.table(). (Of course, this assumes that I've correctly guessed the
source of the problem.)

I hope that this helps,
 John

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of 
 Herman, David (NIH/NIMH)
 Sent: Wednesday, July 14, 2004 10:13 AM
 To: '[EMAIL PROTECTED]'
 Subject: [R] duplicate row importing issue
 
 Hello,
 I'm simply trying to import a .txt file that has 
 a column of about 30,000 pts. I found the file, but I'm 
 getting an error:
  m - read.table(choose.files())
 Error in row.names-.data.frame(`*tmp*`, value = row.names) : 
 duplicate row.names are not allowed
  
 Any help with getting around this?
  
 I really appreciate all the help.
 Thanks
 dave


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


Re: [R] SWIG for R

2004-07-14 Thread Duncan Murdoch
On Wed, 14 Jul 2004 08:01:28 -0700, Duncan Temple Lang
[EMAIL PROTECTED] wrote :

SWIG is an extensible system and so people
other than the SWIG developers can indeed 
provide facilities for supporting R.
I am surprised nobody has done it yet
and remember asking you whether you had considered
using SWIG for your OpenGL about 3 years ago.

Sorry, I forgot about that.

I don't think SWIG would be much help with OpenGL, because there the
difficulty is in translating the R ideas of what data is like and what
people want to do with it into corresponding concepts in OpenGL, the
actual calls to the OpenGL API are a pretty easy part of the whole
exercise.  In any case, they probably have to be written in compiled
code for performance reasons, since you make so many OpenGL calls 
for every frame being drawn.

But I'm sure there are other libraries where this isn't true, and SWIG
would be useful for them.  Maybe Hisaji has one, and would want to
tackle the R support.

Duncan Murdoch

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


Re: [R] Permutations

2004-07-14 Thread Jordi Altirriba Gutiérrez
 Dear R users,
 First of all, thanks to Rolf, Brad, Robin, Erich, Fernando and Adaikalavan 
for your time and suggestions.
 I’ve been testing some algorithms (sorry for the delay, I’m very slow, and 
I’m a completely beginner in R’s world).
 First, the Robin algorithm.
 I think that there is a problem because I’ve done 200 permutations and 
I’ve found that these permutations are the same:
52 and 91, 99 and 110, 121 and 122, 51 and 141, 130 and 134.
 Thanks again,

Jordi Altirriba
Hospital Clinic – Barcelona - Spain
x - c(1,2,3,4,5,6,7,8,9,10,11,12)
dim(x) - c(3,4) a-matrix(1,200,12)
for (i in 1:200)
+ {
+  jj - t(apply(x,1,sample))
+ a[i,]-as.vector(jj)
+ }
a
  [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12]
 [1,]7231   11648910 512
 [2,]1297   11648   1210 5 3
 [3,]7291   11345610 812
 [4,]   108645   12729 111 3
 [5,]   102   121   119786 4 5 3
 [6,]7861594   11   1210 2 3
 [7,]15   127264891011 3
 [8,]159   1086423 71112
 [9,]1   11672   1245910 8 3
[10,]45   12   10   119186 7 2 3
[11,]1   11975648   1210 2 3
[12,]18342   12   1059 711 6
[13,]1237   116   105   12 4 8 9
[14,]483   105   12729 111 6
[15,]   10234867   119 1 512
[16,]489   102   12756 111 3
[17,]126   105378   12 411 9
[18,]   10294   11   12156 7 8 3
[19,]4867   11   1212910 5 3
[20,]18   12723   10   116 4 5 9
[21,]   102   121597   116 4 8 3
[22,]4   11   12123   1086 7 5 9
[23,]1   113726   1059 4 812
[24,]729   105   121   113 4 8 6
[25,]789126453101112
[26,]45   12   10237   116 1 8 9
[27,]4591   11378   1210 2 6
[28,]1564   11378910 212
[29,]4561   119   102   12 7 8 3
[30,]4   11378   12   1056 1 2 9
[31,]   10231   116789 4 512
[32,]   10237891   116 4 512
[33,]7   11618945   1210 2 3
[34,]75   121864   11310 2 9
[35,]123486759101112
[36,]7831   119   102   12 4 5 6
[37,]   10261   11   12753 4 8 9
[38,]1594   11   1278310 2 6
[39,]12   12759   1083 411 6
[40,]183   102   127   116 4 5 9
[41,]129483   10   11   12 7 5 6
[42,]456129   1083 71112
[43,]1267   11   12   1059 4 8 3
[44,]129   10   11   12486 7 5 3
[45,]   10597   116423 1 812
[46,]1234   11675910 812
[47,]426183   105   12 711 9
[48,]48972315   121011 6
[49,]   108   121294   113 7 5 6
[50,]   108612375   12 411 9
[51,]72   12   10   116483 1 5 9
[52,]45612   12   10   119 7 8 3
[53,]123756489101112
[54,]   10537   119186 4 212
[55,]7   11   12423   1086 1 5 9
[56,]1594   11   12   1083 7 2 6
[57,]4597   113   1026 1 812
[58,]   10   11345618   12 7 2 9
[59,]489   1056723 11112
[60,]42   12186   1059 711 3
[61,]4867   119   105   12 1 2 3
[62,]783   10561   11   12   

Re: [R] SWIG for R

2004-07-14 Thread A.J. Rossini

I like SWIG (well, it facilitates wrappers for Python really well),
but it's not perfect. 

I've not delved into the difficulties in any detail yet, but we've had
problems with mixing SWIG and Boost.python for connections with Python
code -- and the Boost.python mechanism feels like DTL's RSyour
language here code, where as SWIG doesn't quite have the same flavor.

(sorry for failing on the details, but I'm doing something else
today).




Duncan Murdoch [EMAIL PROTECTED] writes:

 On Wed, 14 Jul 2004 08:01:28 -0700, Duncan Temple Lang
 [EMAIL PROTECTED] wrote :

SWIG is an extensible system and so people
other than the SWIG developers can indeed 
provide facilities for supporting R.
I am surprised nobody has done it yet
and remember asking you whether you had considered
using SWIG for your OpenGL about 3 years ago.

 Sorry, I forgot about that.

 I don't think SWIG would be much help with OpenGL, because there the
 difficulty is in translating the R ideas of what data is like and what
 people want to do with it into corresponding concepts in OpenGL, the
 actual calls to the OpenGL API are a pretty easy part of the whole
 exercise.  In any case, they probably have to be written in compiled
 code for performance reasons, since you make so many OpenGL calls 
 for every frame being drawn.

 But I'm sure there are other libraries where this isn't true, and SWIG
 would be useful for them.  Maybe Hisaji has one, and would want to
 tackle the R support.

 Duncan Murdoch

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


-- 
Anthony Rossini Research Associate Professor
[EMAIL PROTECTED]http://www.analytics.washington.edu/ 
Biomedical and Health Informatics   University of Washington
Biostatistics, SCHARP/HVTN  Fred Hutchinson Cancer Research Center
UW (Tu/Th/F): 206-616-7630 FAX=206-543-3461 | Voicemail is unreliable
FHCRC  (M/W): 206-667-7025 FAX=206-667-4812 | use Email

CONFIDENTIALITY NOTICE: This e-mail message and any attachme...{{dropped}}

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


[R] Ord-Getis O statistics

2004-07-14 Thread Monica Palaseanu-Lovejoy
Hi list,

I am wondering if anybody knows if the Ord-Getis O statistics of 
local spatial autocorrelation in the presence of the global spatial 
association is implemented in any of the R packages - and of 
course in which package ;-)). I am not interested in Getis-Ord G 
statistics, for now.

Thank you in advance,

Monica




Monica Palaseanu-Lovejoy
University of Manchester
School of Geography
Mansfield Cooper Bld. 3.21
Oxford Road
Manchester M13 9PL
England, UK
Tel: +44 (0) 275 8689
Email: [EMAIL PROTECTED]

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


Re: [R] Permutations

2004-07-14 Thread Gabor Grothendieck

As Erich points out, there is some question as to
what the original problem really is but lets
assume its as Erich describes.  Then, to get a
random ordered permutation we just get a random 
permutation of 12 elements and sort the intra-block 
elements like this:

   c(apply(matrix(sample(12,12),3),2,sort))

Note that there are 12! = 479,001,600 permutations
of 12 elements and 3!^4 = 1,296 of those
permutations correspond to each ordered
permutation so there are 479,001,600 / 1,296 =
369,600 ordered permutations in all.  

Erich Neuwirth erich.neuwirth at univie.ac.at writes:

: 
: Perhaps what you want might better be described as
: ordered partitions?
: 
: Is what you want the following:
: 
: We study sequences of length 12 and divide them in
: 4 segments
: position 1 2 3, position 4 5 6,
: position 7 8 9, position 10 11 12,
: 
: Find all permutation sequences of the numbers 1 to 12
: with the property that all segment sequences
: are monotonically increasing.
: 
: I think that produces what you need.
: Since the segments are ordered, you avoid intra-block permutations.
: 
: If that is what you want, writing a recursive function should not be
: too hard.
: 
: Jordi Altirriba Gutirrez wrote:
: 
:  Dear R users,
:  Im a beginner user of R and Ive a problem with permutations that I 
:  dont know how to solve. Ive 12 elements in blocks of 3 elements and I 
:  want only to make permutations inter-blocks (no intra-blocks) (sorry if 
:  the terminology is not accurate), something similar to:
:  
:  1 2 3 | 4 5 6 | 7 8 9 | 10 11 12   --1st permutation
:  
:  1 3 2 | 4 5 6 | 7 8 9 | 10 11 12   NO
:-  -
:  3 2 1 | 4 5 6 | 7 8 9 | 10 11 12   NO
:  -  -  -
:  1 2 4 | 3 5 6 | 7 8 9 | 10 11 12   YES-2nd permutation
:   --
:  4 5 6 | 1 2 3 | 7 8 9 | 10 11 12   YES-3rd permutation
:  -  -  -   -  -  -
:  4 5 6 | 2 1 3 | 7 8 9 | 10 11 12   NO
:-  -
:  
:  
:   Thanks for your time,
:  
:  Jordi Altirriba
:  Ph D student
:  
:  Hospital Clinic  Barcelona - Spain
:  
:  
:  MSN Motor. http://motor.msn.es/researchcentre/
:  
:  __
:  R-help at stat.math.ethz.ch mailing list
:  https://www.stat.math.ethz.ch/mailman/listinfo/r-help
:  PLEASE do read the posting guide! 
:  http://www.R-project.org/posting-guide.html
:  
:

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


Re: [R] SWIG for R

2004-07-14 Thread A.J. Rossini
[EMAIL PROTECTED] (A.J. Rossini) writes:

 I like SWIG (well, it facilitates wrappers for Python really well),
 but it's not perfect. 

 I've not delved into the difficulties in any detail yet, but we've had
 problems with mixing SWIG and Boost.python for connections with Python
 code -- and the Boost.python mechanism feels like DTL's RSyour
 language here code, where as SWIG doesn't quite have the same flavor.

 (sorry for failing on the details, but I'm doing something else
 today).

Argh.  To be clear, this is in the context of C++ systems.  Which is
relevant but completely different.

-- 
Anthony Rossini Research Associate Professor
[EMAIL PROTECTED]http://www.analytics.washington.edu/ 
Biomedical and Health Informatics   University of Washington
Biostatistics, SCHARP/HVTN  Fred Hutchinson Cancer Research Center
UW (Tu/Th/F): 206-616-7630 FAX=206-543-3461 | Voicemail is unreliable
FHCRC  (M/W): 206-667-7025 FAX=206-667-4812 | use Email

CONFIDENTIALITY NOTICE: This e-mail message and any attachme...{{dropped}}

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


RE: [R] Is there a statistics that can summarize the correlation for more than two random variables?

2004-07-14 Thread F Duan
Thank you for your reminding. Could you tell me the addresses of STAT-L and
ALLSTAT lists?

By the way, I found Cronbach's alpha suggested by Prof. Baron might be the
one I am looking for though it's not perfect. 

Frank

-Original Message-
From: Peter Flom [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, July 13, 2004 16:06
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: [R] Is there a statistics that can summarize the correlation
formore than two random variables?

This seems more like a STATS question than an R question - asking on a
list like STAT-L or ALLSTAT may result in more replies

Nevertheless, it seems to me that you need to describe (and maybe
decide) what you mean by 'summarize' the correlations.  Certainly the
mean DOES summarize them, but is it the summary you want? Maybe, maybe
not.  Perhaps the median? Or a trimmed mean? Do you want to take the
absolute values of the correlations, or not? 

HTH



Peter L. Flom, PhD
Assistant Director, Statistics and Data Analysis Core
Center for Drug Use and HIV Research
National Development and Research Institutes
71 W. 23rd St
www.peterflom.com
New York, NY 10010
(212) 845-4485 (voice)
(917) 438-0894 (fax)


 F Duan [EMAIL PROTECTED] 07/13/04 2:34 PM 
Hi, R people,

 

I wonder if there is a statistics than can measure the correlation for
more
than two random variables, instead of computing the correlation
coefficient
matrix. If so, what R package should I use? 

 

Right now I can only think of the mean of all pair-wise correlation
coefficients, e.g., (corr(x,y) + corr(x,z) + corr(y,z)) / 3 for three
random
variables (x, y, z). 

 

Thanks a lot,

 

Frank


[[alternative HTML version deleted]]

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

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


Re: [R] constrOptim and function with additional parameters?

2004-07-14 Thread Marlene Mueller

OK, I got the point why the help refers to the arguments
of 'optim' only. (Of course, I have read this but did'nt
believe it ... ;-))

Thanks to all of you for the clarification and special thanks 
to Duncan Murdoch for the workaround, which is very close to 
what I want. I am doing a lot of constrained regression in the 
moment, so including additional parameters (=the data) is an 
issue for me.

Best regards, Marlene



 This is why the `...' argument is passed to `optim' and not to the
 function being optimized, as it also referred in the help file of
 `constrOptim'
 
  constrOptim
 function (theta, f, grad, ui, ci, mu = 1e-04, control = list(),
 method = if (is.null(grad)) Nelder-Mead else BFGS,
 outer.iterations = 100,
 outer.eps = 1e-05, ...)
 
 ...
 
  a - optim(theta.old, fun, gradient, control = control,
 method = method, ...)
 
 ...
 }
 
 
 Best,
 Dimitris
 
 
 Dimitris Rizopoulos
 Doctoral Student
 Biostatistical Centre
 School of Public Health
 Catholic University of Leuven
 
 Address: Kapucijnenvoer 35, Leuven, Belgium
 Tel: +32/16/396887
 Fax: +32/16/337015
 Web: http://www.med.kuleuven.ac.be/biostat/
  http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm
 
 
 - Original Message - 
 From: Roger D. Peng [EMAIL PROTECTED]
 To: Duncan Murdoch [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]; Marlene Mueller
 [EMAIL PROTECTED]
 Sent: Wednesday, July 14, 2004 4:01 PM
 Subject: Re: [R] constrOptim and function with additional parameters?
 
 
  Actually, I think this is a bug.  Take a look at this part of
 constrOptim:
 
constrOptim
  function (theta, f, grad, ui, ci, mu = 1e-04, control = list(),
   method = if (is.null(grad)) Nelder-Mead else BFGS,
  outer.iterations = 10
  0,
   outer.eps = 1e-05, ...)
  {
   if (!is.null(control$fnscale)  control$fnscale  0)
   mu - -mu
   [...]
   obj - f(theta)
   ^^^
   r - R(theta, theta)
   for (i in 1:outer.iterations) {
   obj.old - obj
   r.old - r
   [...]
  }
 
  So the object function `f' is called on the starting value `theta'
 but
  the `...' is not passed through.
 
  -roger
 
  Duncan Murdoch wrote:
   On Wed, 14 Jul 2004 14:59:01 +0200 (MEST), Marlene Mueller
   [EMAIL PROTECTED] wrote :
  
  
  How can I use a function with some additional input parameters
  in constrOptim? For example, something like
  
  fr - function(x,a) {   ## Rosenbrock Banana function
   x1 - x[1]
   x2 - x[2]
   a * (x2 - x1 * x1)^2 + (1 - x1)^2
  }
  
  where the optimum is to be found w.r.t. x. Calling
  optim(c(-1.2,1), fr, NULL, a=100) works as expected, but I fail
  to provide the a=100 in the constrained case:
  
  
   constrOptim(c(-1.2,0.9), fr, NULL, ui=rbind(c(-1,0),c(0,-1)),
  
  ci=c(-1,-1),a=100)
  Error in f(theta) : Argument a is missing, with no default
  
  Is this a bug or is there a different solution that I miss here?
  
  
   I can't spot why your use of constrOptim isn't working, but you
 should
   be able to workaround it by doing something  like this:
  
   applyDefaults - function(fn, ...) {
 function(x) fn(x, ...)
   }
  
   constrOptim(c(-1.2,0.9), applyDefaults(fr, a=100), NULL,
   ui=rbind(c(-1,0),c(0,-1)),ci=c(-1,-1))
  
   The applyDefaults function creates a new function which evaluates
 the
   old one with some of the parameters set to fixed values.
  
   Duncan Murdoch
  
   __
   [EMAIL PROTECTED] mailing list
   https://www.stat.math.ethz.ch/mailman/listinfo/r-help
   PLEASE do read the posting guide!
 http://www.R-project.org/posting-guide.html
  
 
  __
  [EMAIL PROTECTED] mailing list
  https://www.stat.math.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide!
 http://www.R-project.org/posting-guide.html
 
 __
 [EMAIL PROTECTED] mailing list
 https://www.stat.math.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide!
 http://www.R-project.org/posting-guide.html


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


RE: [R] duplicate row importing issue

2004-07-14 Thread F Duan
How about you delete the first row (column names) and then use
header=FALSE in read.table()?

Frank

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Herman, David
(NIH/NIMH)
Sent: Wednesday, July 14, 2004 11:13
To: '[EMAIL PROTECTED]'
Subject: [R] duplicate row importing issue

Hello,
I'm simply trying to import a .txt file that has a column of
about 30,000 pts. I found the file, but I'm getting an error:
 m - read.table(choose.files())
Error in row.names-.data.frame(`*tmp*`, value = row.names) : 
duplicate row.names are not allowed
 
Any help with getting around this?
 
I really appreciate all the help.
Thanks
dave

[[alternative HTML version deleted]]

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

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


Re: [R] reading text file in Windows (was no subject)

2004-07-14 Thread Gabor Grothendieck
John Fox jfox at mcmaster.ca writes:

 You got several useful suggestions for what you may have done wrong. I often
 find that it's easier to use read.table(file.choose()) and to navigate to
 the file in the resulting dialog than to type the path to the file.

Related to this, you could issue the command exactly as shown without
any arguments at all:

  file.choose()

from the R console, navigate to the correct file and it will return the
correct text representation of the filename to use in your read.table.

For example, below I navigated to the AUTHORS file in the rw1091
R distribution:

   R file.choose()
   [1] C:\\Program Files\\R\\rw1091\\AUTHORS

This should help you decipher whether you got the path wrong, the filename
wrong, etc.

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


Re: [R] Permutations

2004-07-14 Thread Adaikalavan Ramasamy
I think the issue here is in the two keywords - permutations or sample.

AFAIK, permutations should return all admissible (by some rule)
combinations. If this is a large number, as some have pointed out, then
one essentially takes a _sample_ of all admissible combinations. Since
you earlier mentioned that you only want 5-10 outputs, perhaps the
correct term is sampling with restrictions.

There main problem with Robin's method in that all elements within a row
are mutually exclusive to the other. e.g. only one of either 1, 4, 7, 10
can appear in block 1. Furthermore they can only appear in the first
slot of the first block (so no intra-block randomness). This limits the
number of possible outputs.

Can you clearly define the rules (with examples) for an admissible
combination ? They seem to have a different meaning every time I read
the mail. Maybe I am just confused.


On Wed, 2004-07-14 at 17:16, Jordi Altirriba Gutirrez wrote:
   Dear R users,
   First of all, thanks to Rolf, Brad, Robin, Erich, Fernando and Adaikalavan 
 for your time and suggestions.
   Ive been testing some algorithms (sorry for the delay, Im very slow, and 
 Im a completely beginner in Rs world).
   First, the Robin algorithm.
   I think that there is a problem because Ive done 200 permutations and 
 Ive found that these permutations are the same:
 52 and 91, 99 and 110, 121 and 122, 51 and 141, 130 and 134.
   Thanks again,
 
 Jordi Altirriba
 Hospital Clinic  Barcelona - Spain
 
 x - c(1,2,3,4,5,6,7,8,9,10,11,12)
 dim(x) - c(3,4) a-matrix(1,200,12)
 for (i in 1:200)
 + {
 +  jj - t(apply(x,1,sample))
 + a[i,]-as.vector(jj)
 + }
 a
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12]
   [1,]7231   11648910 512
   [2,]1297   11648   1210 5 3
   [3,]7291   11345610 812
   [4,]   108645   12729 111 3
   [5,]   102   121   119786 4 5 3
   [6,]7861594   11   1210 2 3
   [7,]15   127264891011 3
   [8,]159   1086423 71112
   [9,]1   11672   1245910 8 3
 [10,]45   12   10   119186 7 2 3
 [11,]1   11975648   1210 2 3
 [12,]18342   12   1059 711 6
 [13,]1237   116   105   12 4 8 9
 [14,]483   105   12729 111 6
 [15,]   10234867   119 1 512
 [16,]489   102   12756 111 3
 [17,]126   105378   12 411 9
 [18,]   10294   11   12156 7 8 3
 [19,]4867   11   1212910 5 3
 [20,]18   12723   10   116 4 5 9
 [21,]   102   121597   116 4 8 3
 [22,]4   11   12123   1086 7 5 9
 [23,]1   113726   1059 4 812
 [24,]729   105   121   113 4 8 6
 [25,]789126453101112
 [26,]45   12   10237   116 1 8 9
 [27,]4591   11378   1210 2 6
 [28,]1564   11378910 212
 [29,]4561   119   102   12 7 8 3
 [30,]4   11378   12   1056 1 2 9
 [31,]   10231   116789 4 512
 [32,]   10237891   116 4 512
 [33,]7   11618945   1210 2 3
 [34,]75   121864   11310 2 9
 [35,]123486759101112
 [36,]7831   119   102   12 4 5 6
 [37,]   10261   11   12753 4 8 9
 [38,]1594   11   1278310 2 6
 [39,]12   12759   1083 411 6
 [40,]183   102   127   116 4 5 9
 [41,]129483   10   11   12 7 5 6
 [42,]456129   1083 71112
 [43,]1267   11   12   1059 4 8 3
 [44,]129   10   11   12486 7 5 3
 [45,]   10597   116423 1 812
 [46,]1234   11675910 812
 [47,]426183   105   12 711  

RE: [R] Is there a statistics that can summarize the correlation for more than two random variables?

2004-07-14 Thread Adaikalavan Ramasamy
http://www.jiscmail.ac.uk/lists/ALLSTAT.html


On Wed, 2004-07-14 at 17:47, F Duan wrote:
 Thank you for your reminding. Could you tell me the addresses of STAT-L and
 ALLSTAT lists?
 
 By the way, I found Cronbach's alpha suggested by Prof. Baron might be the
 one I am looking for though it's not perfect. 
 
 Frank
 
 -Original Message-
 From: Peter Flom [mailto:[EMAIL PROTECTED] 
 Sent: Tuesday, July 13, 2004 16:06
 To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Subject: Re: [R] Is there a statistics that can summarize the correlation
 formore than two random variables?
 
 This seems more like a STATS question than an R question - asking on a
 list like STAT-L or ALLSTAT may result in more replies
 
 Nevertheless, it seems to me that you need to describe (and maybe
 decide) what you mean by 'summarize' the correlations.  Certainly the
 mean DOES summarize them, but is it the summary you want? Maybe, maybe
 not.  Perhaps the median? Or a trimmed mean? Do you want to take the
 absolute values of the correlations, or not? 
 
 HTH
 
 
 
 Peter L. Flom, PhD
 Assistant Director, Statistics and Data Analysis Core
 Center for Drug Use and HIV Research
 National Development and Research Institutes
 71 W. 23rd St
 www.peterflom.com
 New York, NY 10010
 (212) 845-4485 (voice)
 (917) 438-0894 (fax)
 
 
  F Duan [EMAIL PROTECTED] 07/13/04 2:34 PM 
 Hi, R people,
 
  
 
 I wonder if there is a statistics than can measure the correlation for
 more
 than two random variables, instead of computing the correlation
 coefficient
 matrix. If so, what R package should I use? 
 
  
 
 Right now I can only think of the mean of all pair-wise correlation
 coefficients, e.g., (corr(x,y) + corr(x,z) + corr(y,z)) / 3 for three
 random
 variables (x, y, z). 
 
  
 
 Thanks a lot,
 
  
 
 Frank
 
 
   [[alternative HTML version deleted]]
 
 __
 [EMAIL PROTECTED] mailing list
 https://www.stat.math.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide!
 http://www.R-project.org/posting-guide.html
 
 __
 [EMAIL PROTECTED] mailing list
 https://www.stat.math.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


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


[R] Convex smoothing via 'Iterative Convex Minorant' ?

2004-07-14 Thread Martin Maechler
I've been asked, and interested myself:

Has anybody implemented the above in R or another S language dialect?

We are talking about the algorithms / methodology
by Wellner, Groeneboom and Jongbloed, e.g., from the following article

@Article{Jongbloed:1998:ICM,
  author =   Geurt Jongbloed,
  title =The Iterative Convex Minorant Algorithm for
 Nonparametric Estimation,
  journal =  j-J-COMPUT-GRAPH-STAT,
  volume =   7,
  number =   3,
  pages =310--321,
  month =sep,
  year = 1998,
  CODEN =,
  ISSN = 1061-8600,
  MRclass =  62G05,
  MRnumber = 1 646 718,
  bibdate =  Sat Jan 2 17:33:21 MST 1999,
  URL =  http://www.amstat.org/publications/jcgs/abstracts98/jongbloed.html;,
  acknowledgement = ack-nhfb,
}

--

I know about Roger Koenker and Pin Ng's very interesting nprq
package (and its earlier version cobs) where one can fit splines
with convexity constraints. 

At the moment however, we are specifically interested in the ICM
algorithm for convex nonparametric regression.

Thank you for pointers in advance.
Martin Maechler, ETH Zurich

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


RE: [R] duplicate row importing issue

2004-07-14 Thread Liaw, Andy
Or just read.table(..., header=FALSE, skip=1)

Andy

 From:  F Duan
 
 How about you delete the first row (column names) and then use
 header=FALSE in read.table()?
 
 Frank
 
 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of Herman, David
 (NIH/NIMH)
 Sent: Wednesday, July 14, 2004 11:13
 To: '[EMAIL PROTECTED]'
 Subject: [R] duplicate row importing issue
 
 Hello,
 I'm simply trying to import a .txt file that has 
 a column of
 about 30,000 pts. I found the file, but I'm getting an error:
  m - read.table(choose.files())
 Error in row.names-.data.frame(`*tmp*`, value = row.names) : 
 duplicate row.names are not allowed
  
 Any help with getting around this?
  
 I really appreciate all the help.
 Thanks
 dave
 
   [[alternative HTML version deleted]]
 
 __
 [EMAIL PROTECTED] mailing list
 https://www.stat.math.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide!
 http://www.R-project.org/posting-guide.html
 
 __
 [EMAIL PROTECTED] mailing list
 https://www.stat.math.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! 
 http://www.R-project.org/posting-guide.html
 


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


Re: [R] Permutations

2004-07-14 Thread Jordi Altirriba Gutiérrez
Dear Adaikalavan,
 Now I've send a similar e-mail to Robin and Rolf, therefore I can deduce 
that my first e-mail was not enough clear (sorry).
 Therefore, I'm going to try it again with an explanation of why I don't 
want those permutations:

I’ve 12 elements in blocks of 3 elements and I want only to make 
permutations inter-blocks (no intra-blocks) (sorry if the terminology is not 
accurate), something similar to:

1 2 3 | 4 5 6 | 7 8 9 | 10 11 12   YES---1st permutation
1 3 2 | 4 5 6 | 7 8 9 | 10 11 12   NO because it's an intra-block 
permutation of permutation 1
  -  -
3 2 1 | 4 5 6 | 7 8 9 | 10 11 12   NO because it's an intra-block 
permutation of permutation 1
-  -  -
1 2 4 | 3 5 6 | 7 8 9 | 10 11 12   YES-2nd permutation

4 5 6 | 1 2 3 | 7 8 9 | 10 11 12   YES-3rd permutation
4 5 6 | 2 1 3 | 7 8 9 | 10 11 12   NO because it's an intra-block 
permutation of permutation 3
  -  -
10 1 7 | 4 8 7 | 5 6 12 | 3 2 9YES---Xth permutation

1 10 7 | 4 8 7 | 5 6 12 | 3 2 9NO because it's an 
intra-blockpermutation of permutation X
-   -

So, what is a not correct permutation is an intra-block permutation of a 
permutation created before.

Again, thanks for your time and suggestions,
Jordi Altirriba
PhD student
Hospital Clinic - Barcelona - Spain
P.S. Probably (it's the way of how I'm testing the algorithms now with 
Excel) [sorry if it's stupid], could be interesting something similar to:

1 2 3 | 4 5 6 | 7 8 9 | 10 11 12 --- 1*2*3=6 | 4*5*6=120 | 7*8*9=504 | 
10*11*12=1320

1 3 2 | 4 5 6 | 7 8 9 | 10 11 12 --- 1*3*2=6 | 4*5*6=120 | 7*8*9=504 | 
10*11*12=1320

4 5 6 | 1 2 3 | 7 8 9 | 10 11 12 --- 4*5*6=120 | 1*2*3=6 | 7*8*9=504 | 
10*11*12=1320

Results:
permutation1: 6 | 120 | 504 | 1320
permutation2: 6 | 120 | 504 | 1320
permutation3: 120 | 6 | 504 | 1320
Order the permutations according first to the first parameter, second to the 
second...and to the fourth.

In this case it's the same:
permutation1: 6 | 120 | 504 | 1320
permutation2: 6 | 120 | 504 | 1320
permutation3: 120 | 6 | 504 | 1320
Therefore, if the first, second, third and fourth parameter of a 
permutations have the same value that the next permutation it's because 
there is an intra-block permutation. So, permutation 2 is an intra-block 
permutation of permutation 1.

P.S. Sorry for having forgotten the title of the last e-mail

From: Adaikalavan Ramasamy [EMAIL PROTECTED]
To: Jordi Altirriba Gutiérrez [EMAIL PROTECTED]
CC: [EMAIL PROTECTED], R-help [EMAIL PROTECTED]
Subject: Re: [R]  Permutations
Date: Wed, 14 Jul 2004 18:00:49 +0100
I think the issue here is in the two keywords - permutations or sample.
AFAIK, permutations should return all admissible (by some rule)
combinations. If this is a large number, as some have pointed out, then
one essentially takes a _sample_ of all admissible combinations. Since
you earlier mentioned that you only want 5-10 outputs, perhaps the
correct term is sampling with restrictions.
There main problem with Robin's method in that all elements within a row
are mutually exclusive to the other. e.g. only one of either 1, 4, 7, 10
can appear in block 1. Furthermore they can only appear in the first
slot of the first block (so no intra-block randomness). This limits the
number of possible outputs.
Can you clearly define the rules (with examples) for an admissible
combination ? They seem to have a different meaning every time I read
the mail. Maybe I am just confused.
On Wed, 2004-07-14 at 17:16, Jordi Altirriba Gutiérrez wrote:
   Dear R users,
   First of all, thanks to Rolf, Brad, Robin, Erich, Fernando and 
Adaikalavan
 for your time and suggestions.
   Ive been testing some algorithms (sorry for the delay, Im very slow, 
and
 Im a completely beginner in Rs world).
   First, the Robin algorithm.
   I think that there is a problem because Ive done 200 permutations and
 Ive found that these permutations are the same:
 52 and 91, 99 and 110, 121 and 122, 51 and 141, 130 and 134.
   Thanks again,

 Jordi Altirriba
 Hospital Clinic  Barcelona - Spain

 x - c(1,2,3,4,5,6,7,8,9,10,11,12)
 dim(x) - c(3,4) a-matrix(1,200,12)
 for (i in 1:200)
 + {
 +  jj - t(apply(x,1,sample))
 + a[i,]-as.vector(jj)
 + }
 a
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12]
   [1,]7231   11648910 512
   [2,]1297   11648   1210 5 3
   [3,]7291   11345610 812
   [4,]   108645   12729 111 3
   [5,]   102   121   119786 4 5 3
   [6,]7861594   11   1210 2 3
   [7,]15   127264891011 3
   [8,]159   1086423 71112
   [9,]1   11672   1245910 8 3
 [10,]45   12   10   119186 7 2 3
 

Re: [R] Permutations

2004-07-14 Thread Marc Schwartz
On Wed, 2004-07-14 at 08:06, Rolf Turner wrote:
 In respect of generating random ``restricted'' permutations, it
 occurred to me as I was driving home last night  If one is going
 to invoke some kind of ``try again if it doesn't work procedure''
 then one might as well keep it simple:  Essentially use the rejection
 method.  Just generate a random permutation, and then check whether
 it meets the restriction criterion.   If yes, return that
 permutation, if not, throw it away and try again.
 
 This will definitely (???) genererate a genuinely random restricted
 permutation.  I figured that since a very large fraction of permutations
 are acutally restricted permutions one wouldn't reject much of the
 time, and so the rejection method should be pretty efficient.
 
 I wrote the following code to do the work:
 
 restr.perm2 - function () {
 #
 okay - function (x) {
   m1 - cbind(1:12,rep(1:4,rep(3,4)))
   m2 - m1[x,]
   all((m2[,1] == m1[,1]) | (m2[,2] != m1[,2]))
 }
 #
 repeat{
   x - sample(12,12)
   if(okay(x)) return(x)
 }
 }
 
 I'm bothered again, but:  I did a little test to see how many tries
 it would take on average.  On 1000 attempts I got a mean of 8.44
 tries, with a standard deviation of 7.7610 (standard error of the
 mean = 0.2454).  The value of 7.76 is roughly consistent with
 sqrt(1-p.hat)/p.hat = 7.92 that one gets from the geometric
 distribution.
 
 This would indicate that the fraction of ``restricted'' permutations
 is something like p.hat = 1/8.44 = 0.1184834.  Which is a lot less
 than the rough estimate of (4.7 x 10^6)/12! approx. = 0.9853 from
 Robert Baskin's back-of-the-envelope calculations.
 
 What's going on/wrong?


Rolf,

I have not quite figured out what the issues are, but I took your
approach above and combined it with Gabor's f1a() function that was the
result of the recent thread on matching/counting rows between matrices
and came up with the following. The basic concept is that we know (or
think that we know) what the non-allowable set of intra-block
permutations are:

  # Create non-allowable 'intra-block' permutations
  # Need a generalizable way to do this, but
  # good enough for now
  a - permutations(3, 3, 1:3)
  b - permutations(3, 3, 4:6)
  c - permutations(3, 3, 7:9)
  d - permutations(3, 3, 10:12)
  intra - rbind(a[-1, ], b[-1, ], c[-1, ], d[-1, ])

'intra' looks like:

 intra
  [,1] [,2] [,3]
 [1,]132
 [2,]213
 [3,]231
 [4,]312
 [5,]321
 [6,]465
 [7,]546
 [8,]564
 [9,]645
[10,]654
[11,]798
[12,]879
[13,]897
[14,]978
[15,]987
[16,]   10   12   11
[17,]   11   10   12
[18,]   11   12   10
[19,]   12   10   11
[20,]   12   11   10


With that in place, we can then take the randomly generated 'x', coerce
it into a 3 column matrix by row and use Gabor's function to check for
any matches of the rows of 3 in 'x' with the non-allowable permutations
in 'intra'. 

Thus, the function will assign 'x' to the appropriate row in 'results'
(which is pre-allocated based upon the number of runs) if 'x' passes or
sets the row to NA's if it does not. 

I then use complete.cases() to return only the valid rows. Presumably,
some of the randomly generated 'x' vectors could be duplicates, so I
also use unique():

restr.perm3 - function(runs)
{
  results - matrix(numeric(runs * 12), ncol = 12)

  # use Gabor's function to check for row matches
  # between 'x' and 'intra' to filter out in okay()
  f1a - function(a,b,sep=:)
  {
f - function(...) paste(..., sep=sep)
a2 - do.call(f, as.data.frame(a))
b2 - do.call(f, as.data.frame(b))
c(table(c(b2,unique(a2)))[a2] - 1)
  }

  okay - function (x)
  {
x.match - matrix(x, ncol = 3, byrow = TRUE)
all(f1a(x.match, intra) == 0)
  }

  for (i in 1:runs)
  {
x - sample(12,12)
if (okay(x))
  results[i, ] - x
else
  results[i, ] - rep(NA, 12)
  }

  unique(results[complete.cases(results), ])
}


So, with all that in place, we can then do something like the following:

r - replicate(10, restr.perm3(1000))

 str(r)
List of 10
 $ : num [1:934, 1:12] 10 6 8 7 7 11 1 1 8 4 ...
 $ : num [1:944, 1:12] 7 4 4 11 1 11 8 3 3 9 ...
 $ : num [1:953, 1:12] 8 4 11 1 11 6 7 11 9 10 ...
 $ : num [1:951, 1:12] 1 2 1 4 4 10 8 10 3 12 ...
 $ : num [1:949, 1:12] 1 7 11 9 2 2 11 7 11 4 ...
 $ : num [1:937, 1:12] 3 3 11 10 4 8 12 10 3 2 ...
 $ : num [1:952, 1:12] 7 3 1 6 4 4 4 11 2 8 ...
 $ : num [1:946, 1:12] 1 9 3 10 11 6 1 7 8 11 ...
 $ : num [1:945, 1:12] 8 9 1 2 8 3 4 1 7 11 ...
 $ : num [1:933, 1:12] 9 1 12 3 4 1 10 1 1 8 ...


So the above would suggest that indeed, the restricted permutations are
a fairly high proportion of the total.

I went ahead and did the following 50 replicates of 1000 each:

 system.time(r - replicate(50, restr.perm3(1000)))
[1] 91.20  0.06 92.98  0.00  0.00

 mean(unlist(lapply(r, nrow)))

[R] simultaneous confidence intervals --- question

2004-07-14 Thread jlamack
Dear all, is there a R function to construct 
 simultaneous confidence intervals for multinomial 
 proportions?
 
 Best wishes 
  
 jl

 
__
Acabe com aquelas janelinhas que pulam na sua tela.
AntiPop-up UOL - É grátis!
http://antipopup.uol.com.br/

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


[R] PCA in R

2004-07-14 Thread Herman, David (NIH/NIMH)
Hello,
I'm attempting to run a PCA on an example data set. I ran it
just fine, but I don't know how to few the output?  I listed what the
variable got stored in it, but I don't know how I can get anything else out
of it. Are there other ways to view the results?
Also, I'm confused about the last line 6  variables and  8 observations
Aren't the rows the variables and the columns the observations?
 
(NOTE: if anyone knows a good guide for doing a PCA on an example data set,
from start to finish, it would be greatly appreciated)
 
 m
 [,1] [,2] [,3] [,4] [,5] [,6]
[1,]123456
[2,]343781
[3,]123456
[4,]874143
[5,]123456
[6,]458213
[7,]987678
[8,]137350
 pc.cr-princomp(m,cor=TRUE)
 pc.cr
Call:
princomp(x = m, cor = TRUE)
 
Standard deviations:
  Comp.1   Comp.2   Comp.3   Comp.4   Comp.5
Comp.6 
1.545609e+00 1.407093e+00 9.886649e-01 7.539927e-01 2.919276e-01
2.460515e-09 
 
 6  variables and  8 observations.

 
thanks! 
Dave 

[[alternative HTML version deleted]]

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


Re: [R] PCA in R

2004-07-14 Thread Jonathan Baron
On 07/14/04 16:05, Herman, David (NIH/NIMH) wrote:
Hello,
I'm attempting to run a PCA on an example data set. I ran it
just fine, but I don't know how to few the output?

Take a look at the help file for prcomp, especially the bottom of
it.  (This is completely general advice for any R function.)  You
will see under See also a number of things listed, and if you
look them up or try them, then you will see several different
ways of viewing the result.  Under that is Examples, which
provides more hints still.  And, if this isn't enough, type

example(prcomp)

on the command line.  The biplot function is especially nice.

Jon
-- 
Jonathan Baron, Professor of Psychology, University of Pennsylvania
Home page:http://www.sas.upenn.edu/~baron
R search page:http://finzi.psych.upenn.edu/

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


RE: [R] PCA in R

2004-07-14 Thread Liaw, Andy
When all else fails, RTFM; e.g., see ?princomp and read it in its entirety.
Then maybe also try running example(princomp).

Andy

 From: Herman, David (NIH/NIMH)
 
 Hello,
 I'm attempting to run a PCA on an example data 
 set. I ran it
 just fine, but I don't know how to few the output?  I listed what the
 variable got stored in it, but I don't know how I can get 
 anything else out
 of it. Are there other ways to view the results?
 Also, I'm confused about the last line 6  variables and  8 
 observations
 Aren't the rows the variables and the columns the observations?
  
 (NOTE: if anyone knows a good guide for doing a PCA on an 
 example data set,
 from start to finish, it would be greatly appreciated)
  
  m
  [,1] [,2] [,3] [,4] [,5] [,6]
 [1,]123456
 [2,]343781
 [3,]123456
 [4,]874143
 [5,]123456
 [6,]458213
 [7,]987678
 [8,]137350
  pc.cr-princomp(m,cor=TRUE)
  pc.cr
 Call:
 princomp(x = m, cor = TRUE)
  
 Standard deviations:
   Comp.1   Comp.2   Comp.3   Comp.4   Comp.5
 Comp.6 
 1.545609e+00 1.407093e+00 9.886649e-01 7.539927e-01 2.919276e-01
 2.460515e-09 
  
  6  variables and  8 observations.
 
  
 thanks! 
 Dave 
 
   [[alternative HTML version deleted]]
 
 __
 [EMAIL PROTECTED] mailing list
 https://www.stat.math.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! 
 http://www.R-project.org/posting-guide.html
 


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


Re: [R] Permutations

2004-07-14 Thread Gabor Grothendieck

Based on your description below and our off-list
discussion I gather than the problem is equivalent
to sampling ordered permutations in the sense
defined by Erich (i.e.  permutations which are
increasing within blocks) WITHOUT replacement.

Actually one of your valid permutations in your
example is not ordered but it seems arbitrary
which representative of the 3!^4 intrablock
permutations is used which is why I believe this
solves your problem. 

The following code (not extensively tested) does this:

ordered.perm - function(N) {
   samp - function() c(apply(matrix(sample(12,12),3),2,sort))
   z - vector(length=N, mode=character)
   for(i in 1:N) 
  while( (z[i]-paste(samp(),collapse= )) %in% z[seq(len=i-1)] ) {}
   matrix(as.numeric(unlist(strsplit(z, split =  ))), nc = 12, byrow = TRUE)
}
ordered.perm(3)  # test run

In the above, samp(), which is from my previous
response, gets one sample WITH replacement. It generates
an unrestricted permutation of 12 and then projects that
onto its associated ordered permutation of 12.  Note that
samp does not use rejection.  That comes later which is
why there are relatively few rejections.
 
Each iteration of the for loop gets one sample without
replacement storing the unrejected sammples as
character strings in vector z.  Each iteration of this
for loop uses a while to call samp() repeatedly until it 
finds a sample that has not previously been generated
(i.e. rejecting the others). The line beginning
with matrix converts the strings to numbers.


Jordi Altirriba Gutirrez altirriba at hotmail.com writes:

: 
: Dear Adaikalavan,
:   Now I've send a similar e-mail to Robin and Rolf, therefore I can deduce 
: that my first e-mail was not enough clear (sorry).
:   Therefore, I'm going to try it again with an explanation of why I don't 
: want those permutations:
: 
: Ive 12 elements in blocks of 3 elements and I want only to make 
: permutations inter-blocks (no intra-blocks) (sorry if the terminology is not 
: accurate), something similar to:
: 
: 1 2 3 | 4 5 6 | 7 8 9 | 10 11 12   YES---1st permutation
: 
: 1 3 2 | 4 5 6 | 7 8 9 | 10 11 12   NO because it's an intra-block 
: permutation of permutation 1
:-  -
: 3 2 1 | 4 5 6 | 7 8 9 | 10 11 12   NO because it's an intra-block 
: permutation of permutation 1
: -  -  -
: 1 2 4 | 3 5 6 | 7 8 9 | 10 11 12   YES-2nd permutation
: 
: 4 5 6 | 1 2 3 | 7 8 9 | 10 11 12   YES-3rd permutation
: 
: 4 5 6 | 2 1 3 | 7 8 9 | 10 11 12   NO because it's an intra-block 
: permutation of permutation 3
:-  -
: 10 1 7 | 4 8 7 | 5 6 12 | 3 2 9YES---Xth permutation
: 
: 1 10 7 | 4 8 7 | 5 6 12 | 3 2 9NO because it's an 
: intra-blockpermutation of permutation X
: -   -
: 
: So, what is a not correct permutation is an intra-block permutation of a 
: permutation created before.
: 
: Again, thanks for your time and suggestions,
: 
: Jordi Altirriba
: PhD student
: Hospital Clinic - Barcelona - Spain
: 
: P.S. Probably (it's the way of how I'm testing the algorithms now with 
: Excel) [sorry if it's stupid], could be interesting something similar to:
: 
: 1 2 3 | 4 5 6 | 7 8 9 | 10 11 12 --- 1*2*3=6 | 4*5*6=120 | 7*8*9=504 | 
: 10*11*12=1320
: 
: 1 3 2 | 4 5 6 | 7 8 9 | 10 11 12 --- 1*3*2=6 | 4*5*6=120 | 7*8*9=504 | 
: 10*11*12=1320
: 
: 4 5 6 | 1 2 3 | 7 8 9 | 10 11 12 --- 4*5*6=120 | 1*2*3=6 | 7*8*9=504 | 
: 10*11*12=1320
: 
: 
: Results:
: permutation1: 6 | 120 | 504 | 1320
: permutation2: 6 | 120 | 504 | 1320
: permutation3: 120 | 6 | 504 | 1320
: 
: Order the permutations according first to the first parameter, second to the 
: second...and to the fourth.
: 
: In this case it's the same:
: permutation1: 6 | 120 | 504 | 1320
: permutation2: 6 | 120 | 504 | 1320
: permutation3: 120 | 6 | 504 | 1320
: 
: Therefore, if the first, second, third and fourth parameter of a 
: permutations have the same value that the next permutation it's because 
: there is an intra-block permutation. So, permutation 2 is an intra-block 
: permutation of permutation 1.
: 
: P.S. Sorry for having forgotten the title of the last e-mail
: 
: 
: From: Adaikalavan Ramasamy ramasamy at cancer.org.uk
: To: Jordi Altirriba Gutirrez altirriba at hotmail.com
: CC: rksh at soc.soton.ac.uk, R-help r-help at stat.math.ethz.ch
: Subject: Re: [R]  Permutations
: Date: Wed, 14 Jul 2004 18:00:49 +0100
: 
: I think the issue here is in the two keywords - permutations or sample.
: 
: AFAIK, permutations should return all admissible (by some rule)
: combinations. If this is a large number, as some have pointed out, then
: one essentially takes a _sample_ of all admissible combinations. Since
: you earlier mentioned that you only want 5-10 outputs, perhaps the
: correct term is sampling with restrictions.
: 
: There main problem with Robin's method in that all elements within a row
: are mutually exclusive to the other. e.g. only one of either 1, 4, 7, 10
: can appear in block 1. Furthermore they can only appear in the first

[R] using mean in by(x,y,mean)

2004-07-14 Thread William Revelle
Dear list friends
I fail to understand how to find means for multiple groups using the 
by() function. Help would be appreciated. Thanks.
Bill

x - runif(20,0,10)
group - rep(c(A,B),10)
df -data.frame(x,group)
#df#show the data
rm(x,group)
attach(df)
sd(x)   # sd is defined
mean(x) #so is mean
by(x,group,sd)   #this works for both groups
by(x,group,mean)  #this does not
produces this output:

 x - runif(20,0,10)
 group - rep(c(A,B),10)
 df -data.frame(x,group)
 #df#show the data
 rm(x,group)
 attach(df)
 sd(x)   # sd is defined
[1] 2.952699
 mean(x) #so is mean
[1] 5.026441
 by(x,group,sd)   #this works for both groups
INDICES: A
[1] 2.813504
 

INDICES: B
[1] 3.236663
 by(x,group,mean)  #this does not
Error in FUN(X[[as.integer(1)]], ...) : couldn't find function FUN
I am using a Mac OS 10.3.4 running R 1.9.1
--

William Revelle   http://pmc.psych.northwestern.edu/revelle.html
Department of Psychology, Northwestern University
Personality Project: http://personality-project.org/personality.html
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] using mean in by(x,y,mean)

2004-07-14 Thread Sundar Dorai-Raj
William Revelle wrote:
Dear list friends
I fail to understand how to find means for multiple groups using the 
by() function. Help would be appreciated. Thanks.
Bill

x - runif(20,0,10)
group - rep(c(A,B),10)
df -data.frame(x,group)
#df#show the data
rm(x,group)
attach(df)
sd(x)   # sd is defined
mean(x) #so is mean
by(x,group,sd)   #this works for both groups
by(x,group,mean)  #this does not
produces this output:

 x - runif(20,0,10)
 group - rep(c(A,B),10)
 df -data.frame(x,group)
 #df#show the data
 rm(x,group)
 attach(df)
 sd(x)   # sd is defined
[1] 2.952699
 mean(x) #so is mean
[1] 5.026441
 by(x,group,sd)   #this works for both groups
INDICES: A
[1] 2.813504
 

INDICES: B
[1] 3.236663
 by(x,group,mean)  #this does not
Error in FUN(X[[as.integer(1)]], ...) : couldn't find function FUN
I am using a Mac OS 10.3.4 running R 1.9.1
Hi Bill,
Works for me. Do you have a local mean defined? Try rm(mean) and re-try.
 R.version
 _
platform i386-pc-mingw32
arch i386
os   mingw32
system   i386, mingw32
status
major1
minor9.1
year 2004
month06
day  21
language R
--sundar
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] using mean in by(x,y,mean)

2004-07-14 Thread Liaw, Andy
 From: Sundar Dorai-Raj
 
 William Revelle wrote:
 
  Dear list friends
  
  I fail to understand how to find means for multiple groups 
 using the 
  by() function. Help would be appreciated. Thanks.
  Bill
  
  
  x - runif(20,0,10)
  group - rep(c(A,B),10)
  df -data.frame(x,group)
  #df#show the data
  
  rm(x,group)
  attach(df)
  
  sd(x)   # sd is defined
  mean(x) #so is mean
  
  by(x,group,sd)   #this works for both groups
  by(x,group,mean)  #this does not
  
  
  produces this output:
  
  
   x - runif(20,0,10)
   group - rep(c(A,B),10)
   df -data.frame(x,group)
   #df#show the data
 
   rm(x,group)
   attach(df)
 
   sd(x)   # sd is defined
  
  [1] 2.952699
  
   mean(x) #so is mean
  
  [1] 5.026441
  
 
   by(x,group,sd)   #this works for both groups
  
  INDICES: A
  [1] 2.813504
  
 --
 -- 
  
  INDICES: B
  [1] 3.236663
  
   by(x,group,mean)  #this does not
  
  Error in FUN(X[[as.integer(1)]], ...) : couldn't find function FUN
  
  
  I am using a Mac OS 10.3.4 running R 1.9.1
 
 Hi Bill,
 
 Works for me. Do you have a local mean defined? Try 
 rm(mean) and re-try.
 
   R.version
   _
 platform i386-pc-mingw32
 arch i386
 os   mingw32
 system   i386, mingw32
 status
 major1
 minor9.1
 year 2004
 month06
 day  21
 language R
 
 --sundar

Or try replacing `mean' with `base:::mean'.  BTW, why not just use tapply(x,
group, mean)?

Andy

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


[R] MASS package?

2004-07-14 Thread Johanna Hardin
Did the MASS package disappear?  Specifically, I'm looking for a function to
find the MCD (robust measure of shape and location) for a multi-dimensional
data matrix.

 

Anyone know anything about this?

 

Thanks, Jo

 

Jo Hardin

Assistant Professor

Department of Mathematics

Pomona College

610 N. College Ave.

Claremont, CA 91711

909-607-8717

[EMAIL PROTECTED]

 


[[alternative HTML version deleted]]

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


[R] RODBC repeated rows problem

2004-07-14 Thread Kevin Bartz
Hello everyone! I'm having the dreaded repeated rows problem in RODBC.
Specifically, when I have a NULL value in a column, odbcFetchRows reads the
value not as NULL or NA but as the most recent non-NULL value in the column.
If there is no such non-NULL column, odbcFetchRows reads the value as 0. Let
me give you an example (though you won't be able to run it with the
product table--just use some table you've defined):

 head(sqlQuery(channel, select NULL from product))
  c(0, 0, 0, 0, 0, 0)
1   0
2   0
3   0
4   0
5   0
6   0

Obviously, I'd like to see NAs here, not 0s. Let me give you some of my
specs:

 version
 _   
platform x86_64-unknown-linux-gnu
arch x86_64  
os   linux-gnu   
system   x86_64, linux-gnu   
status   
major1   
minor9.1 
year 2004
month06  
day  21  
language R   

Other specs: I'm reading a unixODBC ODBC driver. When I run from isql and
try the same query, I get, as I might expect, a bunch of blanks.

SQL select top 5 NULL from product
++
||
++
||
||
||
||
||
++
SQLRowCount returns 5
5 rows fetched

It shouldn't be relevant, but the ODBC is powered by a FreeTDS driver hooked
to an MS SQL Server 2000 Professional.

I noticed a previous note from Professor Ripley reporting that this problem
had been fixed with a version of RODBC from long ago. I am running RODBC
version 1.04, the latest version, however, so I'm at a loss as to what to
do.

One last note: I looked at the relevant line from sql.h that defines my
SQL_NULL_DATA, which RODBC (presumably) compares to its results. It says:

#define SQL_NULL_DATA (-1)

Unfortunately, I have no idea what this should mean to me :(

Are there any further diagnostics I can run? Any new versions of software I
should install? Any workarounds for the time being?

Thanks for any help you can provide.

Kevin

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


RE: [R] MASS package?

2004-07-14 Thread Liaw, Andy
Search on the R site ought to show you.  cov.rob() is in MASS (part of the
`VR' bundle, and should be part of all R distribution).  There's also the
rrcov package with the covMcd() function.

Andy

 From: Johanna Hardin
 
 Did the MASS package disappear?  Specifically, I'm looking 
 for a function to
 find the MCD (robust measure of shape and location) for a 
 multi-dimensional
 data matrix.
 
  
 
 Anyone know anything about this?
 
  
 
 Thanks, Jo
 
  
 
 Jo Hardin
 
 Assistant Professor
 
 Department of Mathematics
 
 Pomona College
 
 610 N. College Ave.
 
 Claremont, CA 91711
 
 909-607-8717
 
 [EMAIL PROTECTED]
 
  
 
 
   [[alternative HTML version deleted]]
 
 __
 [EMAIL PROTECTED] mailing list
 https://www.stat.math.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! 
 http://www.R-project.org/posting-guide.html
 


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


Re: [R] MASS package?

2004-07-14 Thread Marc Schwartz
On Wed, 2004-07-14 at 17:05, Johanna Hardin wrote:
 Did the MASS package disappear?  Specifically, I'm looking for a function to
 find the MCD (robust measure of shape and location) for a multi-dimensional
 data matrix.
 
  
 
 Anyone know anything about this?


Try:

library(MASS)
?cov.rob

It's there, unless you have a corrupted/incomplete installation.

HTH,

Marc Schwartz

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


Re: [R] Permutations

2004-07-14 Thread Gabor Grothendieck

Just in case my last post is wrong in assuming that 
ordered repesentatives of the 3!^4 intragroup permutations
are adequate, the following minor variation of the routine 
in my last post will provide an unordered representative.
Its actually easy to do since sample(12,12), which we
already calculated, is that representative so we merely
store it.  

ordered.perm2 - function(N) {
   samp - function() c(apply(matrix(z[i,] - sample(12,12),3),2,sort))
   s - vector(length = N, mode = character)
   z - matrix(nr = N, nc = 12)
   for(i in 1:N) 
  while( (s[i]-paste(samp(),collapse= )) %in% s[seq(len=i-1)] ) {}
   z
}

# test
set.seed(1)
ordered.perm(3)  



Gabor Grothendieck ggrothendieck at myway.com writes:

: 
: Based on your description below and our off-list
: discussion I gather than the problem is equivalent
: to sampling ordered permutations in the sense
: defined by Erich (i.e.  permutations which are
: increasing within blocks) WITHOUT replacement.
: 
: Actually one of your valid permutations in your
: example is not ordered but it seems arbitrary
: which representative of the 3!^4 intrablock
: permutations is used which is why I believe this
: solves your problem. 
: 
: The following code (not extensively tested) does this:
: 
: ordered.perm - function(N) {
:samp - function() c(apply(matrix(sample(12,12),3),2,sort))
:z - vector(length=N, mode=character)
:for(i in 1:N) 
:   while( (z[i]-paste(samp(),collapse= )) %in% z[seq(len=i-1)] ) {}
:matrix(as.numeric(unlist(strsplit(z, split =  ))), nc = 12, byrow = 
TRUE)
: }
: ordered.perm(3)  # test run
: 
: In the above, samp(), which is from my previous
: response, gets one sample WITH replacement. It generates
: an unrestricted permutation of 12 and then projects that
: onto its associated ordered permutation of 12.  Note that
: samp does not use rejection.  That comes later which is
: why there are relatively few rejections.
: 
: Each iteration of the for loop gets one sample without
: replacement storing the unrejected sammples as
: character strings in vector z.  Each iteration of this
: for loop uses a while to call samp() repeatedly until it 
: finds a sample that has not previously been generated
: (i.e. rejecting the others). The line beginning
: with matrix converts the strings to numbers.
: 
: Jordi Altirriba Gutirrez altirriba at hotmail.com writes:
: 
: : 
: : Dear Adaikalavan,
: :   Now I've send a similar e-mail to Robin and Rolf, therefore I can deduce 
: : that my first e-mail was not enough clear (sorry).
: :   Therefore, I'm going to try it again with an explanation of why I don't 
: : want those permutations:
: : 
: : Ive 12 elements in blocks of 3 elements and I want only to make 
: : permutations inter-blocks (no intra-blocks) (sorry if the terminology is 
not 
: : accurate), something similar to:
: : 
: : 1 2 3 | 4 5 6 | 7 8 9 | 10 11 12   YES---1st permutation
: : 
: : 1 3 2 | 4 5 6 | 7 8 9 | 10 11 12   NO because it's an intra-block 
: : permutation of permutation 1
: :-  -
: : 3 2 1 | 4 5 6 | 7 8 9 | 10 11 12   NO because it's an intra-block 
: : permutation of permutation 1
: : -  -  -
: : 1 2 4 | 3 5 6 | 7 8 9 | 10 11 12   YES-2nd permutation
: : 
: : 4 5 6 | 1 2 3 | 7 8 9 | 10 11 12   YES-3rd permutation
: : 
: : 4 5 6 | 2 1 3 | 7 8 9 | 10 11 12   NO because it's an intra-block 
: : permutation of permutation 3
: :-  -
: : 10 1 7 | 4 8 7 | 5 6 12 | 3 2 9YES---Xth permutation
: : 
: : 1 10 7 | 4 8 7 | 5 6 12 | 3 2 9NO because it's an 
: : intra-blockpermutation of permutation X
: : -   -
: : 
: : So, what is a not correct permutation is an intra-block permutation of 
a 
: : permutation created before.
: : 
: : Again, thanks for your time and suggestions,
: : 
: : Jordi Altirriba
: : PhD student
: : Hospital Clinic - Barcelona - Spain
: : 
: : P.S. Probably (it's the way of how I'm testing the algorithms now with 
: : Excel) [sorry if it's stupid], could be interesting something similar to:
: : 
: : 1 2 3 | 4 5 6 | 7 8 9 | 10 11 12 --- 1*2*3=6 | 4*5*6=120 | 7*8*9=504 | 
: : 10*11*12=1320
: : 
: : 1 3 2 | 4 5 6 | 7 8 9 | 10 11 12 --- 1*3*2=6 | 4*5*6=120 | 7*8*9=504 | 
: : 10*11*12=1320
: : 
: : 4 5 6 | 1 2 3 | 7 8 9 | 10 11 12 --- 4*5*6=120 | 1*2*3=6 | 7*8*9=504 | 
: : 10*11*12=1320
: : 
: : 
: : Results:
: : permutation1: 6 | 120 | 504 | 1320
: : permutation2: 6 | 120 | 504 | 1320
: : permutation3: 120 | 6 | 504 | 1320
: : 
: : Order the permutations according first to the first parameter, second to 
the 
: : second...and to the fourth.
: : 
: : In this case it's the same:
: : permutation1: 6 | 120 | 504 | 1320
: : permutation2: 6 | 120 | 504 | 1320
: : permutation3: 120 | 6 | 504 | 1320
: : 
: : Therefore, if the first, second, third and fourth parameter of a 
: : permutations have the same value that the next permutation it's because 
: : there is an intra-block permutation. So, permutation 2 is an intra-
block 
: : permutation of permutation 1.
: : 
: 

[R] questions about R

2004-07-14 Thread house-ball
Hi,
 
I try to compute critical value for multivariate normal distribution, and I find the 
crit(fit, const = c(0, 1), d = 1, cov = 0.95, rdf = 0) which seems to compute critical 
value. However, I can't compute right critical value for multivariate normal 
distribution which I want. I don't know how to solve my question. I send my question 
in the file. Would you help me to solve it, please? My English is not very well, but I 
appreciate you very much.

   Chia-Yi





-
,!
Yahoo!Messenger6.0__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

[R] older versions of R (v1.0)

2004-07-14 Thread Kathryn Jones
Hi folks,
Does anyone know where I can find downloads for old versions 
of R, around version 1.0? I found the downloads for unix but 
not windows. Any help would be greatly appreciated!
Thank you,
Kathryn

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