Re: [R] Mixed model

2005-06-28 Thread Stephen
Thanks
Most thoughtful...
Regards
S



From: Spencer Graves [mailto:[EMAIL PROTECTED]
Sent: Mon 27/06/2005 19:52
To: Stephen
Cc: Douglas Bates; r-help@stat.math.ethz.ch
Subject: Re: [R] Mixed model



  I often think carefully about what I want and store only that.
For
example, I might do something like the following:

  b1 - coef(lme(...))
  kb - length(b1)
  B - array(NA, dim=c(nb, kb))
  for(i in 1:nb){

B[i, ] - coef(lme(...))   
  }

  With fit[[i]] - lme(...), you store, as Doug said, a copy
of the
model frame (the parts of Dataset that are needed to evaluate the model)
plus a lot of other information) for each pass through the loop.  Since
you are doing a simulation, you probably only really care about a few
numbers for each i.  Identify those and only store those each time
through the loop.

  spencer graves
p.s.  Have you considered simulate.lme?

Stephen wrote:

 Hi
 Thank you for your comments.
 Yes you are correct its a very big data set.
 Perhaps I am best splitting it up and then importing to R.
 The reason for the loop is that I am conducting the equivalent of
Split
 file in SPSS.
 Specifically, I am conducting the analysis for each value of on the
 grouping variable 'runnb'.
 If there is a less memory intensive way of doing this I'd appreciate
 knowing about it.
 Many Thanks and comments appreciated
 Regards
 Stephen

 

 From: Douglas Bates [mailto:[EMAIL PROTECTED]
 Sent: Sun 26/06/2005 17:01
 To: Stephen
 Cc: r-help@stat.math.ethz.ch
 Subject: Re: [R] Mixed model



 On 6/26/05, Stephen [EMAIL PROTECTED] wrote:



Hi All,



I am currently conducting a mixed model. I have 7 repeated measures on

 a

simulated clinical trial. If I understand the model correctly, the
outcome is the measure (as a factor) the predictors are clinical group
and trial (1-7). The fixed factors are the measure and group. The

 random

factors are the intercept and id and group.



I tried using 2 functions to calculate mixed effects.

Following previous correspondence .



Dataset - read.table(C:/Program

 Files/R/rw2011/data/miss/model1a.dat,

header=TRUE, sep=\t, na.strings=NA, dec=., strip.white=TRUE)

attach(Dataset)



require (nlme)

with(Dataset, table(runnb, id, grp))

b.lvls - table(Dataset$runnb)

nb - length(b.lvls)

fit - vector(mode=list, nb)



for(i in 1:nb)

 fit[[i]]- lme (trans1 ~ Index1 + grp,

random = ~ 1 | id / grp ,

data = Dataset,

na.action = na.exclude)





This (above) worked OK only I am having memory problems.

I have a gig of RAM set at --sdi --max-mem-size=512M (complete version
below)

I am wondering if running the file as a database be slower / faster?



Then I read that lme4 does it quicker and more accurately

so I thought that I should re-run the code but from the for line:




for (i in 1:nb)

+  fit[[i]]  - lmer(trans1 ~ Index1 + grp + (1|id:grp) + (1|id),

+ Dataset, na.action = na.exclude)



Producing



Error in lmer(trans1 ~ Index1 + grp + (1 | id:grp) + (1 | id),

 Dataset,

:

flist[[2]] must be a factor of length 20

In addition: Warning messages:

1: numerical expression has 20 elements: only the first used in:
id:grp

2: numerical expression has 20 elements: only the first used in:
id:grp


 Check

 str(Dataset)

 and, if necessary, convert id to a factor with

 Dataset$id - factor(Dataset$id)


 In is not surprising that you are running into memory problems.  Look
 at the size of one of the fitted objects from lme or from lmer.  They
 are very large because they contain a copy of the model frame (the
 parts of Dataset that are needed to evaluate the model) plus a lot of
 other information.  You have a large Dataset and you are saving
 multiple copies of it although I must admit that I don't understand
 why the calls to lme or lmer are in a loop.



  ??  
 http://mail.nana.co.il

   [[alternative HTML version deleted]]

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

--
Spencer Graves, PhD
Senior Development Engineer
PDF Solutions, Inc.
333 West San Carlos Street Suite 700
San Jose, CA 95110, USA

[EMAIL PROTECTED]
www.pdf.com http://www.pdf.com
Tel:  408-938-4420
Fax: 408-280-7915



 ??  
http://mail.nana.co.il

[[alternative HTML version deleted]]

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


Re: [R] How to convert c:\a\b to c:/a/b?

2005-06-28 Thread Prof Brian Ripley
This is based on a false premise.  R _can_ read files containing such 
names: use readLines() or scan(allowEscapes=FALSE).  Someone else wrote 
the C for you!

The restriction is that if you pass character strings to the parser, they 
are interpreted according to the documented rules, including interpreting 
escapes.

On Tue, 28 Jun 2005, Mulholland, Tom wrote:

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] Behalf Of Henrik Bengtsson
 Sent: Tuesday, 28 June 2005 2:54 AM
 To: Spencer Graves
 Cc: r-help@stat.math.ethz.ch; Dirk Eddelbuettel
 Subject: Re: [R] How to convert c:\a\b to c:/a/b?

 ... snipped

   Thus, you cannot write your program such that it fools the parser,
 because your program is evaluated first after the parser.  In other
 words, there is no way you can get nchar(\n) to equal 2.


 I had been waiting for this answer because it was the conclusion I had 
 come to. Given that I mainly work in a windows world this has been a 
 problem. For various reasons I receive files liberally sprinkled with 
 such pathnames. I generally pre-process them using whatever is at hand. 
 It's not a big problem, just annoying to have to explain to collegues 
 that this is something R can't do. Not a good advertisment for those who 
 have no idea about escape codes.

 However I can't believe that this problem cannot be solved. The thoughts 
 that have come through my head are to write a c routine that effectively 
 ignores the possibility that \n means newline and thus remaps all the 
 escape codes into text (\\ and the character code.)

 I've never written in C which is one of the reasons that I have never 
 attempted this. I would be interested in any thoughts about the 
 viability of my proposal. It seems an awful lot of work (at least for 
 someone who hasn't done this sort of stuff before) for something that 
 can be achieved in many other ways.

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

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


Re: [R] GetRNGstate() crashes in Windows

2005-06-28 Thread Prof Brian Ripley
On Tue, 28 Jun 2005, Ju-Sung Lee wrote:

 I think I've misread the intent of the GetRNGstate() and other API
 functions; these only work when embedded in C functions eventually called
 from R.  Apologies for the mistake.

First, the posting guide asks you to send programming questions to the 
R-devel list.

You can call some of the API functions from a C program, but you need to 
build a standalone libRmath: see src/nmath/standalone/README in the R 
sources.  But GetRNGstate is not one of them, and `Writing R Extensions' 
states clearly which they are.  See its section `Standalone Mathlib1'.

Linking like

gcc -o prog.exe prog.c -I{R's include path} R.dll

is not supported by MinGW (even though it is documented, it fails far too 
often and the reply to my bug report was that it was not supposed to 
work!).

 On Tue, 28 Jun 2005, Ju-Sung Lee wrote:

 Hi,

 Has anyone managed to successfully call GetRNGstate() / PutRNGstate()
 without crashing in a Windows environment (spec. XP)?  I've compiled
 successfully using both the latest Cygwin, latest Mingw, and the version
 of Mingw suggested in Building R for Windows website, but when the
 executable runs, it crashes; the functions themselves can run when I omit
 GenRNGstate()/PutRNGstate, but return the same values every time.  My
 compilation command is, having copied R.dll to my current directory:

 gcc -o prog.exe prog.c -I{R's include path} R.dll

 I've also tried:

 gcc -o prog.exe prog.c -I{R's include path} -L./ -lR

 I've managed to successfully compile Rmath.dll and call R functions that
 way, but remain puzzled why the first way doesn't work.  I've read mention
 of initializing R (within a C program I assume) but haven't found the
 documentation that explains this.

 My test program is simply:
 #include R.h
 int main() {
   GetRNGstate();
   PutRNGstate();
   return 0;
 }

 I've also tried #include-ing host of the other .h files.   Thanks!


-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

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


[R] Help

2005-06-28 Thread noomen ajmi
Hi,
Please, can you tell if there are any package or R
code for STAR models estimation and test
misspecification.
Thanks in advance
Best regards
AJMI Noomen
PHD Student
TUNISIA

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


Re: [R] How to convert c:\a\b to c:/a/b?

2005-06-28 Thread Henrik Bengtsson
Mulholland, Tom wrote:
 
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Henrik Bengtsson
Sent: Tuesday, 28 June 2005 2:54 AM
To: Spencer Graves
Cc: r-help@stat.math.ethz.ch; Dirk Eddelbuettel
Subject: Re: [R] How to convert c:\a\b to c:/a/b?

 
 ... snipped
  
 
  Thus, you cannot write your program such that it fools the parser, 
because your program is evaluated first after the parser.  In other 
words, there is no way you can get nchar(\n) to equal 2.

 
 
 I had been waiting for this answer because it was the conclusion I had come 
 to. Given that I mainly work in a windows world this has been a problem. For 
 various reasons I receive files liberally sprinkled with such pathnames. I 
 generally pre-process them using whatever is at hand. It's not a big problem, 
 just annoying to have to explain to collegues that this is something R can't 
 do. Not a good advertisment for those who have no idea about escape codes. 

Please, note this basically only applies to source(), expressions at the 
R prompt (and unfortunately read.table()), and therefore you should not 
have to pre-process you files.  Here are some illustrating example. It 
is a good exercise to convince yourself that you understand why you get 
the different results;

code - x - \D:\\spencerg\\statmtds\\R\\Rnews\
cat(file=foo.R, code)

file.show(foo.R)   # x - D:\spencerg\statmtds\R\Rnews

x - NA
eval(parse(text=code))
print(x)
rm(x)
[1] D:spencergstatmtdsRRnews

source(foo.R)
print(x)
[1] D:spencergstatmtdsRRnews

print(readLines(foo.R))
[1] x - \D:\\spencerg\\statmtds\\R\\Rnews\

print(scan(foo.R, what=character(0), allowEscapes=FALSE))
[1] x-
[3] D:spencergstatmtdsRRnews

print(read.table(foo.R))
   V1 V2   V3
1  x - D:spencergstatmtdsRRnews

print(readChar(foo.R, nchar=256))
[1] x - \D:\\spencerg\\statmtds\\R\\Rnews\

  print(readBin(foo.R, what=integer(0), size=1, n=256))
[1]  120  32  60  45  32  34  68  58  92 115 112 101 110  99 101 114 103 
  92 115
[20] 116  97 116 109 116 100 115  92  82  92  82 110 101 119 115  34


Comment/suggestion: It would be nice if read.table() would pass argument 
'allowEscapes' (or just '...') to scan().

/Henrik

 However I can't believe that this problem cannot be solved. The thoughts that 
 have come through my head are to write a c routine that effectively ignores 
 the possibility that \n means newline and thus remaps all the escape codes 
 into text (\\ and the character code.) 
 
 I've never written in C which is one of the reasons that I have never 
 attempted this. I would be interested in any thoughts about the viability of 
 my proposal. It seems an awful lot of work (at least for someone who hasn't 
 done this sort of stuff before) for something that can be achieved in many 
 other ways.
 
 Tom
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 


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


[R] .ts

2005-06-28 Thread pir2.jv
Goog morning!
How to construct a time serie in hours or in minuts, ...
The examples are all in years
Excuse for questions so basic!

Jver
[EMAIL PROTECTED]

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


Re: [R] help--package:MIX

2005-06-28 Thread F.Tusell
The general location model is assumed: continuous variables are assumed
normal conditional on the categorical variables. 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

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


[R] STAR models estimation with R

2005-06-28 Thread noomen ajmi
Hi,
 
Can you tell me if there are an R package or code for STAR model estimation and 
test misspecification. If no, how i could do this.
 
Thanks in advance
Best regards
AJMI Noomen
Phd student
TUNISIA  


-


[[alternative HTML version deleted]]

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


[R] nonparametric 2way repeated-measures anova

2005-06-28 Thread Christoph Lehmann
Dear useRs
is there any nonparametric test for the analysis of variance in a design
with two within-factors (repeated measures on both factors)? Friedman is not
appropriate here, therefore I am grateful for any alternative test.

thanks for any hint
cheers
christoph

--

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


[R] How to import data as numeric array?

2005-06-28 Thread tong wang
Did some search but couldn't find useful result.

I am trying to read a n*m dimension data with read.table,  what i need is a 
numeric array, 
is there any efficient way to allow me get this array directly instead of a 
list? 
I tried to use as.array() to change the mode, but seems it doesn't work and i 
got this error message:

Error in dimnames-.data.frame(`*tmp*`, value = list(function (M)  : 
invalid dimnames given for data frame 
 
what's wrong with the dimension names , should i delete them? how can i do that?

Thanks a lot for any help.

tong wang

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


[R] [R-pkgs] New package `party': A Laboratory for Recursive Part(y)itioning

2005-06-28 Thread Torsten Hothorn

Dear useRs,

a new package for tree-structured regression is available on CRAN.

This package implements a unified framework for recursive partitioning
which embeds tree-structured regression models into a well defined
theory of conditional inference procedures. Stopping criteria based on
multiple test procedures are implemented. The methodology is applicable
to all kinds of regression problems, including nominal, ordinal, numeric,
censored as well as multivariate response variables and arbitrary
measurement scales of the covariates. Extensible functionality for
visualizing tree-structured regression models is available.

Best,

Torsten

__


Package: party
Title: A Laboratory for Recursive Part(y)itioning
Date: $Date: 2005/06/27 06:38:16 $
Version: 0.2-2
Author: Torsten Hothorn, Kurt Hornik and Achim Zeileis
Maintainer: Torsten Hothorn [EMAIL PROTECTED]
Description: Unbiased recursive partitioning in a conditional
  inference framework.
Depends: R (= 2.0.1), survival, grid, modeltools, coin
Suggests: ipred
SaveImage: yes
License: GPL
Packaged: Sun Jun 12 10:38:21 2005; hothorn

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

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


Re: [R] How to import data as numeric array?

2005-06-28 Thread Prof Brian Ripley
Please consult the `R Data Import/Export Manual'.  You could be using 
scan(), as in

   matrix(scan(some_file, 0), nrow=n, byrow=TRUE)

On Tue, 28 Jun 2005, tong wang wrote:

 Did some search but couldn't find useful result.

 I am trying to read a n*m dimension data with read.table, what i need is 
 a numeric array, is there any efficient way to allow me get this array 
 directly instead of a list? I tried to use as.array() to change the 
 mode, but seems it doesn't work and i got this error message:

 Error in dimnames-.data.frame(`*tmp*`, value = list(function (M)  :
invalid dimnames given for data frame 

 what's wrong with the dimension names , should i delete them? how can i do 
 that?

I think you wanted as.matrix here, not as.array: probably the call to the 
latter was incorrect, but we were not shown it.

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

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


Re: [R] Mixed model

2005-06-28 Thread Stephen
Hi,

 

Your last email was excellent and I got it working using the following. 

 

It did the job extremely quickly, more so a commercial piece of software
my university uses! 

 

#This works fine -

Dataset - read.table(C:/Program Files/R/rw2011/data/miss/model1.dat,
header=TRUE, sep=\t, na.strings=NA, dec=.,strip.white=TRUE)

Dataset$id - factor(Dataset$id)

attach(Dataset)

names (Dataset)

require (nlme)

fit - vector(mode=list, 100)

i = 0

 

for (i in 1:100)

{   Dataset2 - subset(Dataset, subset= i == runnb)

   summary (fit[[i]]- lme (trans1 ~ Index1 + grp, 

   random = ~ 1 | id / grp ,

  data = Dataset2,

na.action = na.exclude) 

)

i =i +1

}

 

Strangely enough I was less lucky with LMER. 

  for (i in 1:100)

+ {   Dataset2 - subset(Dataset, subset= i == runnb)

+ fit[[i]]  - lmer(trans1 ~ Index1 + grp + (1|id:grp) + (1|id),
Dataset2, na.action = na.exclude)

+ i =i +1

+ }

Error in lmer(trans1 ~ Index1 + grp + (1 | id:grp) + (1 | id), Dataset2,
: 

flist[[2]] must be a factor of length 4000

In addition: Warning messages:

1: numerical expression has 4000 elements: only the first used in:
id:grp 

2: numerical expression has 4000 elements: only the first used in:
id:grp 



 

Many thanks to you all for your assistance on this issue.

 

Regards

 

Stephen

 

 




From: Douglas Bates [mailto:[EMAIL PROTECTED]
Sent: Sun 26/06/2005 17:01
To: Stephen
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] Mixed model



On 6/26/05, Stephen [EMAIL PROTECTED] wrote:



 Hi All,



 I am currently conducting a mixed model. I have 7 repeated measures on
a
 simulated clinical trial. If I understand the model correctly, the
 outcome is the measure (as a factor) the predictors are clinical group
 and trial (1-7). The fixed factors are the measure and group. The
random
 factors are the intercept and id and group.



 I tried using 2 functions to calculate mixed effects.

 Following previous correspondence .



 Dataset - read.table(C:/Program
Files/R/rw2011/data/miss/model1a.dat,
 header=TRUE, sep=\t, na.strings=NA, dec=., strip.white=TRUE)

 attach(Dataset)



 require (nlme)

 with(Dataset, table(runnb, id, grp))

 b.lvls - table(Dataset$runnb)

 nb - length(b.lvls)

 fit - vector(mode=list, nb)



 for(i in 1:nb)

  fit[[i]]- lme (trans1 ~ Index1 + grp,

 random = ~ 1 | id / grp ,

 data = Dataset,

 na.action = na.exclude)





 This (above) worked OK only I am having memory problems.

 I have a gig of RAM set at --sdi --max-mem-size=512M (complete version
 below)

 I am wondering if running the file as a database be slower / faster?



 Then I read that lme4 does it quicker and more accurately

 so I thought that I should re-run the code but from the for line:



  for (i in 1:nb)

 +  fit[[i]]  - lmer(trans1 ~ Index1 + grp + (1|id:grp) + (1|id),

 + Dataset, na.action = na.exclude)



 Producing



 Error in lmer(trans1 ~ Index1 + grp + (1 | id:grp) + (1 | id),
Dataset,
 :

 flist[[2]] must be a factor of length 20

 In addition: Warning messages:

 1: numerical expression has 20 elements: only the first used in:
 id:grp

 2: numerical expression has 20 elements: only the first used in:
 id:grp

Check

str(Dataset)

and, if necessary, convert id to a factor with

Dataset$id - factor(Dataset$id)


In is not surprising that you are running into memory problems.  Look
at the size of one of the fitted objects from lme or from lmer.  They
are very large because they contain a copy of the model frame (the
parts of Dataset that are needed to evaluate the model) plus a lot of
other information.  You have a large Dataset and you are saving
multiple copies of it although I must admit that I don't understand
why the calls to lme or lmer are in a loop.



 ??  
http://mail.nana.co.il

[[alternative HTML version deleted]]

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


Re: [R] .ts

2005-06-28 Thread Achim Zeileis
On Tue, 28 Jun 2005 09:20:54 +0200 pir2.jv wrote:

 Goog morning!
 How to construct a time serie in hours or in minuts, ...
 The examples are all in years
 Excuse for questions so basic!

Look at the zoo package for time series with arbitrary time scale (e.g.,
Date, chron, POSIXct, ...). The zoo vignette also explains the
relation to other irregular time series classes available in package
its, fCalendar and tseries.
Z

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


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


[R] enhanced multidimensional scaling?

2005-06-28 Thread Karen Kotschy
Dear R list

Would anyone be able to tell me whether it is possible to do enhanced 
multidimensional scaling (enhanced MDS) in R? In other words, something that 
goes beyond cmdscale by iteratively improving the fit between observed 
dissimilarities and inter-object distances, using the KYST algorithm 
(Kruskal, 1964).

I have found several implementations of non-metric MDS in various packages but 
nothing like what I have described above.

Thanks in advance
-- 
Karen Kotschy
Centre for Water in the Environment
University of the Witwatersrand
Johannesburg

P/Bag X3, Wits, 2050
Tel: +2711 717-6425

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


Re: [R] .ts

2005-06-28 Thread Prof Brian Ripley
On Tue, 28 Jun 2005, Achim Zeileis wrote:

 On Tue, 28 Jun 2005 09:20:54 +0200 pir2.jv wrote:

 Goog morning!
 How to construct a time serie in hours or in minuts, ...
 The examples are all in years
 Excuse for questions so basic!

 Look at the zoo package for time series with arbitrary time scale (e.g.,
 Date, chron, POSIXct, ...). The zoo vignette also explains the
 relation to other irregular time series classes available in package
 its, fCalendar and tseries.

However, this might be a regular time series.  For an example, see
example(beav1, package=MASS).  This a series measured every 10 mins.

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

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


Re: [R] How to import data as numeric array?

2005-06-28 Thread ronggui
maybe you can use the array function,like
array(CO2,dim(CO2),list(rownames(CO2),colnames(CO2)))
and matrix is just a specif type of array,so maybe you can use as.matrix
as.matrix(CO2)

the above tow,the CO2 is a data.frame which can use read.table to read in.

the third way is:use the scan the read the data and use array to change the 
data to array.


On Tue, 28 Jun 2005 01:05:23 -0700
tong wang [EMAIL PROTECTED] wrote:

 Did some search but couldn't find useful result.
 
 I am trying to read a n*m dimension data with read.table,  what i need is a 
 numeric array, 
 is there any efficient way to allow me get this array directly instead of a 
 list? 
 I tried to use as.array() to change the mode, but seems it doesn't work and i 
 got this error message:
 
 Error in dimnames-.data.frame(`*tmp*`, value = list(function (M)  : 
 invalid dimnames given for data frame 
  
 what's wrong with the dimension names , should i delete them? how can i do 
 that?
 
 Thanks a lot for any help.
 
 tong wang
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


-- 
Department of Sociology
Fudan University,Shanghai
Blog:http://sociology.yculblog.com

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


Re: [R] .ts

2005-06-28 Thread Achim Zeileis
On Tue, 28 Jun 2005 10:53:11 +0100 (BST) Prof Brian Ripley wrote:

 On Tue, 28 Jun 2005, Achim Zeileis wrote:
 
  On Tue, 28 Jun 2005 09:20:54 +0200 pir2.jv wrote:
 
  Goog morning!
  How to construct a time serie in hours or in minuts, ...
  The examples are all in years
  Excuse for questions so basic!
 
  Look at the zoo package for time series with arbitrary time scale
  (e.g.,Date, chron, POSIXct, ...). The zoo vignette also
  explains the relation to other irregular time series classes
  available in package its, fCalendar and tseries.
 
 However, this might be a regular time series.  For an example, see
 example(beav1, package=MASS).  This a series measured every 10 mins.

...which you could handle by creating a regular zoo series (of class
zooreg).
Z

 -- 
 Brian D. Ripley,  [EMAIL PROTECTED]
 Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
 University of Oxford, Tel:  +44 1865 272861 (self)
 1 South Parks Road, +44 1865 272866 (PA)
 Oxford OX1 3TG, UKFax:  +44 1865 272595


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


[R] enhanced MDS

2005-06-28 Thread Karen Kotschy
Hi again

Sorry, in looking again at sammon and isoMDS I see that they seem to do 
exactly what I want, except that they are non-metric, which means, as I 
understand it, that they relate the rank orders of the variables rather than 
the actual distances. 

Could I use these non-metric MDS packages even if my distances are metric?

Thanks
Karen
-- 
Karen Kotschy
Centre for Water in the Environment
University of the Witwatersrand
Johannesburg

P/Bag X3, Wits, 2050
Tel: +2711 717-6425

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


Re: [R] .ts

2005-06-28 Thread Prof Brian Ripley
On Tue, 28 Jun 2005, Achim Zeileis wrote:

 On Tue, 28 Jun 2005 10:53:11 +0100 (BST) Prof Brian Ripley wrote:

 On Tue, 28 Jun 2005, Achim Zeileis wrote:

 On Tue, 28 Jun 2005 09:20:54 +0200 pir2.jv wrote:

 Goog morning!
 How to construct a time serie in hours or in minuts, ...
 The examples are all in years
 Excuse for questions so basic!

 Look at the zoo package for time series with arbitrary time scale
 (e.g.,Date, chron, POSIXct, ...). The zoo vignette also
 explains the relation to other irregular time series classes
 available in package its, fCalendar and tseries.

 However, this might be a regular time series.  For an example, see
 example(beav1, package=MASS).  This a series measured every 10 mins.

 ...which you could handle by creating a regular zoo series (of class
 zooreg).

Yes, but the standard ts analysis functions are for objects of class ts, 
and those suffice for regular time series.

Some work for class zooreg and some do not.  (More would if zooreg had a 
tsp() method.)

 Z

 --
 Brian D. Ripley,  [EMAIL PROTECTED]
 Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
 University of Oxford, Tel:  +44 1865 272861 (self)
 1 South Parks Road, +44 1865 272866 (PA)
 Oxford OX1 3TG, UKFax:  +44 1865 272595




-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

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


Re: [R] enhanced MDS

2005-06-28 Thread Prof Brian Ripley
On Tue, 28 Jun 2005, Karen Kotschy wrote:

 Hi again

 Sorry, in looking again at sammon and isoMDS I see that they seem to do
 exactly what I want, except that they are non-metric, which means, as I
 understand it, that they relate the rank orders of the variables rather than
 the actual distances.

 Could I use these non-metric MDS packages even if my distances are metric?

Yes.

BTW, Sammon is not ordinal.  What `non-metric' means depends on who is 
using the term.

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

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


Re: [R] solving equation system

2005-06-28 Thread Clark Allan
HI ALL

i would like to solve a complex set of equations. i have four parameters
and four equations. i could set up more equations since they are derived
from the momnets of a particular distribution.

the parameters are NON LINEAR!!!

AND the eqautions are of the form:

phi(i)=function(a,x,y,z)

is there a package or group of commands that might be used in order to
solve the system directly?

thanking you in advance

/
allan





Spencer Graves wrote:
 
   Have you considered writing a function to compute the sum of squares
 of deviations from equality and using optim?  I use sum of squares not
 sum of absolute values, because if my functions are differentiable, the
 sum of squares will also be differentible while the sum of absolute
 values will not be.  This means that sum of absolute values will not
 work well with a quasi-Newton algorithm.
 
   Also, have you considered making plots?  If I understand your
 example, you can solve for lambda using (II) as lambda = x/mean(X).
 Then you can use (I) to solve for c.  To understand this, it would
 help to plot the digamma function.  If you do this (e.g.,
 http://mathworld.wolfram.com/DigammaFunction.html), you will see that
 there are countably infinite solutions to this equation.  If you want
 the positive solution, I suggest you try to solve for ln.c = log(c)
 rather than c directly, because that should make optim more stable.
   More generally, it often helps to make, e.g., contour or perspective
 plots and to try to find a parameterization that will make the sum of
 squares of errors approximatly parabolic in your parameters.
 
   My favorite reference on this is Bates and Watts (1988) Nonlinear
 Regression Analysis and Its Applications (Wiley).  There may be better,
 more recent treatments of this subject, but I am not familiar with them.
 
   spencer graves
 p.s.  I never (no never, not ever) use c as a variable name, because
 it is the name of a common R function.  R is smart enough to distinguish
 between a function and a non-function in some contexts but not in all.
 When I want a name for a new object, I routinely ask R to print my
 proposed name.  If it returns Error:  object ... not found, I can use
 
 
 Carsten Steinhoff wrote:
 
  Hello,
 
  I want to solve some two dimensional equation system with R. Some systems
  are not solvable analytically.
 
  Here is an example:
 
  (I)1/n*sum{from_i=1_to_n}(Xi) = ln lambda + digamma(c)
 
  (II)mean(X) = x / lambda
 
  I want to find lambda and c,
 
  which R-function could do that task?
 
  Carsten
 
[[alternative HTML version deleted]]
 
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide! 
  http://www.R-project.org/posting-guide.html
 
 --
 Spencer Graves, PhD
 Senior Development Engineer
 PDF Solutions, Inc.
 333 West San Carlos Street Suite 700
 San Jose, CA 95110, USA
 
 [EMAIL PROTECTED]
 www.pdf.com http://www.pdf.com
 Tel:  408-938-4420
 Fax: 408-280-7915
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

[R] R-postgresql

2005-06-28 Thread orkun
hello

where can download R-postgresql from ?


regards

Ahmet Temiz

__
XamimeLT - installed on mailserver for domain @deprem.gov.tr
Queries to: [EMAIL PROTECTED]
__
The views and opinions expressed in this e-mail message are ...{{dropped}}

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


Re: [R] R-postgresql

2005-06-28 Thread Uwe Ligges
orkun wrote:

 hello
 
 where can download R-postgresql from ?

Please read the posting guide.
What is R-postgresql? For which version of R on which platform?

The following two web pages might help you to precise your question:
  http://www.omegahat.org/RSPostgres/
  http://rpgsql.sourceforge.net/

Uwe Ligges

 
 regards
 
 Ahmet Temiz
 
 __
 XamimeLT - installed on mailserver for domain @deprem.gov.tr
 Queries to: [EMAIL PROTECTED]
 __
 The views and opinions expressed in this e-mail message are ...{{dropped}}
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

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


Re: [R] add transformed columns into a matrix

2005-06-28 Thread Bjørn-Helge Mevik
Supposing 'inmatrix' is a matrix with coloumn names 'x1', 'x2' and
'x3'; how about something like

model.matrix(~ (x1 + x2 + x3)^2 + log(x1) + log(x2) + log(x3) +
 sqrt(x1) + sqrt(x2) + sqrt(x3) - 1,
 as.data.frame(inmatrix))

-- 
Bjørn-Helge Mevik

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


Re: [R] nonparametric 2way repeated-measures anova

2005-06-28 Thread Frederico Zanqueta Poleto
Cristoph:
Take a look on
Brunner, E., Domhof, S. and Langer, F. (2002). Nonparametric analysis of 
longitudinal data in factorial experiments. John Wiley  Sons, New York.
for the theory.

The authors have R and SAS code available on
http://www.ams.med.uni-goettingen.de/de/sof/ld/makros.html

Sincerely,

-- 
Frederico Zanqueta Poleto
[EMAIL PROTECTED]
--
An approximate answer to the right problem is worth a good deal more than an 
exact answer to an approximate problem. J. W. Tukey



Christoph Lehmann wrote:

Dear useRs
is there any nonparametric test for the analysis of variance in a design
with two within-factors (repeated measures on both factors)? Friedman is not
appropriate here, therefore I am grateful for any alternative test.

thanks for any hint
cheers
christoph

--

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



  


-- 
Frederico Zanqueta Poleto
[EMAIL PROTECTED]
--
An approximate answer to the right problem is worth a good deal more than an 
exact answer to an approximate problem. J. W. Tukey

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


[R] index of dispersion

2005-06-28 Thread Markus Schwarz
Hi list

I'm looking for statisitic measurements describing the pattern of points 
within a given polygon. Is there a function calculating the Index of 
Dispersion and/or are there other functions summarising an observed pattern?



Markus Schwarz
.
Markus Schwarz
Wissenschaftliche Mitarbeiterin
Eidg. Forschungsanstalt WSL
Forschungsprogramm Musterland
Zürcherstrasse 111
CH-8903 Birmensdorf

Telefon +41-44-739 22 87
Fax +41-44-739 22 15
[EMAIL PROTECTED]
http://www.wsl.ch/staff/markus.schwarz/ 
.

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


[R] Programming Books

2005-06-28 Thread Philip Bermingham
I am about to embark on the writing of a program for R and I wanted to 
know a good reference book that would be useful.  There has been some 
talk about S programming the Springer publication ISBN:0387989668.  Is 
that what most people are using or are there other books that might be 
dedicated to R.

Philip Bermingham

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


Re: [R] How to convert c:\a\b to c:/a/b?

2005-06-28 Thread Ted Harding
On 27-Jun-05 Spencer Graves wrote:
 Thanks, Dirk, Gabor, Eric:
 
 You all provided appropriate solutions for the stated problem. 
 Sadly, I oversimplified the problem I was trying to solve:  I copy a 
 character string giving a DOS path from MS Windows Explorer into an R 
 script file, and I get something like the following:
 
 D:\spencerg\statmtds\R\Rnews
 
 I want to be able to use this in R with its non-R meaning,
e.g., in 
 readLine, count.fields, read.table, etc., after appending a file name. 
 Your three solutions all work for my oversimplified toy example but are
 inadequate for the problem I really want to solve.

The various responses show that solving this problem directly within
R may be, well, problematic!

I'm not a perl user, but possibly Spencer Graves's speculation might
eventually be brought into a straightforward solution.

Unfortunately, for this query, I'm not a Windows users either, so
can't be authoritative about how practical the following may be for
Spencer's problem (and similar).

In the Unix world, the string editor program 'sed' simply mops
up problems of this kind. For example, I just did:

  echo D:\spencerg\statmtds\R\Rnews | sed '[EMAIL PROTECTED]@/@g'

and got the response:

  D:/spencerg/statmtds/R/Rnews

Note: the parsing of the 'sed' command is as follows:

  [EMAIL PROTECTED]@[EMAIL PROTECTED] means substitute y for every (g = 
global) occurrence
  of x.

  The character to be replaced (x=\) is the escape character so
  needs to be escaped (\\); but apart from this it's straightforward.

  The usual separator is / instead of @, but I used @
  to simplify things since the substitute itself is y=/.

  An alternative using / as separator would be

echo D:\spencerg\statmtds\R\Rnews | sed 's/\\/\//g'
D:/spencerg/statmtds/R/Rnews

  which is a bit more complicated but still straightforward
  (depending on your eyesight). Here, both x=\ and y=/
  need to be escaped.

'sed', and a lot of other useful stuff, is available as GNU tools
which can be installed on Windows, and allow this kind of thing to
be very slickly done, but outside of R of course.

I also make much use of 'awk' (but you can equally use perl) for
tidying up CSV files exported from Excel, and for all sorts of
rearrangements and substitutions in data files. While Unix users
take this sort of thing for granted, I suggest to Windows users
that it could be well worth installing the GNU tools, since they
are very useful indeed.

It's not clear from Spencer's follow-up whether doing this kind
of preliminary work outside of R, and then bringing the results
into R (e.g. via the clipboard or a file) is practical in his
context. If not (i.e. all the work has to be done inside R), then
of course my sugestion above is not helpful in this case!

Best wishes,
Ted.



E-Mail: (Ted Harding) [EMAIL PROTECTED]
Fax-to-email: +44 (0)870 094 0861
Date: 28-Jun-05   Time: 13:38:37
-- XFMail --

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


Re: [R] Programming Books

2005-06-28 Thread Uwe Ligges
Philip Bermingham wrote:

 I am about to embark on the writing of a program for R and I wanted to 
 know a good reference book that would be useful.  There has been some 
 talk about S programming the Springer publication ISBN:0387989668.  Is 
 that what most people are using or are there other books that might be 
 dedicated to R.

Yes, this is a ggod book, quite a lot of other books, online material 
and paper are mentioned on CRAN, e.g. CRAN/other-docs.html
the latter points to, e.g.,
http://www.r-project.org/other-docs.html
and
http://www.r-project.org/doc/bib/R-publications.html

Uwe Ligges

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

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


[R] function for cumulative occurrence of elements

2005-06-28 Thread Steven K Friedman

Hello, 

I have a data set with 9700 records, and 7 parameters. 

The data were collected for a survey of forest communities.  Sample plots 
(1009) and species (139) are included in this data set. I need to determine 
how species are accumulated as new plots are considered. Basically, I want 
to develop a species area curve. 

I've included the first 20 records from the data set.  Point represents the 
plot id. The other parameters are parts of the information statistic H'. 

Using Table, I can construct a data set that lists the occurrence of a 
species at any Point (it produces a binary 0/1 data table). From there it 
get confusing, regarding the most efficient approach to determining the 
addition of new and or repeated species occurrences. 

ptcount -  table(sppoint.freq$species, sppoint.freq$Point) 

 From here I've played around with colSums to calculate the number of species 
at each Point.  The difficulty is determining if a species is new or 
repeated.  Also since there are 1009 points a function is needed to screen 
every Point. 

Two goals are of interest: 1) the species accumulation curve, and 2) an 
accumulation curve when random Points are considered. 

Any help would be greatly appreciated. 

Thank you
Steve Friedman 


 Pointspecies frequency point.list point.prop   log.prop 
point.hprime
1  7   American elm 7 27 0.25925926 -1.3499267
0.3499810
2  7  apple 2 27 0.07407407 -2.6026897
0.1927918
3  7   black cherry 8 27 0.29629630 -1.2163953
0.3604134
4  7  black oak 1 27 0.03703704 -3.2958369
0.1220680
5  7chokecherry 1 27 0.03703704 -3.2958369
0.1220680
6  7 oak sp 1 27 0.03703704 -3.2958369
0.1220680
7  7 pignut hickory 1 27 0.03703704 -3.2958369
0.1220680
8  7  red maple 1 27 0.03703704 -3.2958369
0.1220680
9  7  white oak 5 27 0.18518519 -1.6863990
0.3122961
10 9   black spruce 2 27 0.07407407 -2.6026897
0.1927918
11 9blue spruce 2 27 0.07407407 -2.6026897
0.1927918
12 9missing12 27 0. -0.8109302
0.3604134
13 9  Norway spruce 8 27 0.29629630 -1.2163953
0.3604134
14 9   white spruce 3 27 0. -2.1972246
0.2441361
1512  apple 2 27 0.07407407 -2.6026897
0.1927918
1612   black cherry 1 27 0.03703704 -3.2958369
0.1220680
1712   black locust 1 27 0.03703704 -3.2958369
0.1220680
1812   black walnut 1 27 0.03703704 -3.2958369
0.1220680
1912  lilac 3 27 0. -2.1972246
0.2441361
2012missing 2 27 0.07407407 -2.6026897
0.1927918

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


Re: [R] STAR models estimation with R

2005-06-28 Thread Phineas Campbell
The only STAR model I have come across is Smooth Threshold Autoregressive
time series model, see Tong, Non Linear Time Series.  I am not aware of any
package that has implemented threshold models.

Because statistical techniques are used widely across many different
disciplines it is inevitable that naming conventions will diverge, so the
same technique may have different names in different areas of study.

Perhaps it should be added to the posting guide that most general name of a
technique should be used, and in the case of more obscure techniques a brief
reference to a standard text or paper.

Hamilton, see Time Series Analysis, uses the EM algorithm to estimate such
models so it should be possible to do in R.

HTH

Phineas Campbell



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of noomen ajmi
Sent: Tuesday, June 28, 2005 8:44 AM
To: r-help@stat.math.ethz.ch
Subject: [R] STAR models estimation with R


Hi,

Can you tell me if there are an R package or code for STAR model estimation
and test misspecification. If no, how i could do this.

Thanks in advance
Best regards
AJMI Noomen
Phd student
TUNISIA


-


[[alternative HTML version deleted]]

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

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


[R] where can i download the metrics package?

2005-06-28 Thread ronggui
i learn it from metrics: Towards a package for doing econometrics in Rbut i 
can not find it in cran.


-- 
Department of Sociology
Fudan University,Shanghai
Blog:http://sociology.yculblog.com

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


[R] where can i download the metrics package

2005-06-28 Thread khobson




Look for package Ecdat.

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


[R] Using data frames for EDA: Insert, Change name, delete columns? (Newcomer's question)

2005-06-28 Thread Ben Fairbank
I am finding complex analyses easier than some elementary operations in
R.  In particular I want to do some low level exploratory data analyses
with data in a data frame but cannot find commands to easily insert,
remove (delete), rename, and re-order (arbitrarily, not sort) columns.
I see that the micEcon package has an insertCol command, but that is for
matrices, not data frames.  I have looked through several introductory
texts but all seem to stop short of explaining the commands needed for
the above.  Could a reader provide a reference where such commands are
documented?
 
Thank you,
 
Ben Fairbank

[[alternative HTML version deleted]]

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


Re: [R] STAR models estimation with R

2005-06-28 Thread KAHRA HANNU
It is likely that here STAR means the Smooth Transition Autoregressive model 
which generalizes the Threshold Autoregressive (TAR) model to allow for gradual 
switching between regimes.

The model can be estimated in R by applying maximum likelihood (ML) estimation 
or Monte Carlo Markov Chain (MCMC) estimation. Use Google to find related 
papers.

Regards,
Hannu Kahra

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Phineas Campbell
Sent: 28. kesäkuuta 2005 15:11
To: r-help@stat.math.ethz.ch
Subject: Re: [R] STAR models estimation with R

The only STAR model I have come across is Smooth Threshold Autoregressive
time series model, see Tong, Non Linear Time Series.  I am not aware of any
package that has implemented threshold models.

Because statistical techniques are used widely across many different
disciplines it is inevitable that naming conventions will diverge, so the
same technique may have different names in different areas of study.

Perhaps it should be added to the posting guide that most general name of a
technique should be used, and in the case of more obscure techniques a brief
reference to a standard text or paper.

Hamilton, see Time Series Analysis, uses the EM algorithm to estimate such
models so it should be possible to do in R.

HTH

Phineas Campbell



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of noomen ajmi
Sent: Tuesday, June 28, 2005 8:44 AM
To: r-help@stat.math.ethz.ch
Subject: [R] STAR models estimation with R


Hi,

Can you tell me if there are an R package or code for STAR model estimation
and test misspecification. If no, how i could do this.

Thanks in advance
Best regards
AJMI Noomen
Phd student
TUNISIA


-


[[alternative HTML version deleted]]

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

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

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


[R] factor to character

2005-06-28 Thread Omar Lakkis
Using RODBC, when I select from a table strings (chars and varchars)
come as factors. What is the best way, speed wise, to convert these
columns back to strings (perhaps using as.character).

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


Re: [R] .ts

2005-06-28 Thread Spencer Graves
  R News (www.r-project.org - Documentation:  Newsletter, (4/1) June 
2004, pp. 29-32, and (2/2) June 2002, pp. 2-10 contain excellent 
articles on date-time classes and time series capabilities in R.  In 
addition, I have found ch. 14 in Venables and Ripley (2002) Modern 
Applied Statistics in S, 4th ed. (Springer) and the vignette for the zoo 
package to be excellent.

  Greater flexibility in modeling and analysis are provided with the 
Rmetrics project (www.rmetrics.org or 
http://www.itp.phys.ethz.ch/econophysics/R/), but that also requires 
greater effort to learn.

  spencer graves

Prof Brian Ripley wrote:

 On Tue, 28 Jun 2005, Achim Zeileis wrote:
 
 
On Tue, 28 Jun 2005 10:53:11 +0100 (BST) Prof Brian Ripley wrote:


On Tue, 28 Jun 2005, Achim Zeileis wrote:


On Tue, 28 Jun 2005 09:20:54 +0200 pir2.jv wrote:


Goog morning!
How to construct a time serie in hours or in minuts, ...
The examples are all in years
Excuse for questions so basic!

Look at the zoo package for time series with arbitrary time scale
(e.g.,Date, chron, POSIXct, ...). The zoo vignette also
explains the relation to other irregular time series classes
available in package its, fCalendar and tseries.

However, this might be a regular time series.  For an example, see
example(beav1, package=MASS).  This a series measured every 10 mins.

...which you could handle by creating a regular zoo series (of class
zooreg).
 
 
 Yes, but the standard ts analysis functions are for objects of class ts, 
 and those suffice for regular time series.
 
 Some work for class zooreg and some do not.  (More would if zooreg had a 
 tsp() method.)
 
 
Z


--
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595



 

-- 
Spencer Graves, PhD
Senior Development Engineer
PDF Solutions, Inc.
333 West San Carlos Street Suite 700
San Jose, CA 95110, USA

[EMAIL PROTECTED]
www.pdf.com http://www.pdf.com
Tel:  408-938-4420
Fax: 408-280-7915

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


Re: [R] R demos

2005-06-28 Thread Peter Wolf
Federico Calboli wrote:

Hi All,

I am currently preparing some form of slideshow introducing R and its
capabilities for some colleagues. The thing will be about 30 mins, and
I'd like to have some pretty pictures and some amazing facts (I'm
trying to sell, obviously :)).

Can I ask if it's possible to easily retrieve a gross figure of the
number of functions in R considering the base install and all the
libraries available?

Apart from graphics and lattice, are there any more packages producing
eye catching graphics (possibly with a survival analysis/epidemiological
bend)?

Cheers,

Federico Calboli

  

In the package relax you find the function slider().
The help page of slider shows a nice application: R.veil.in.the.wind()
Here are the definitions of slider and R.veil.in.the.wind:

# definition of slider
slider-function (sl.functions, sl.names, sl.mins, sl.maxs, sl.deltas,
sl.defaults, but.functions, but.names, no, set.no.value,
obj.name, obj.value, reset.function, title)
{
if (!missing(no))
return(as.numeric(tclvalue(get(paste(slider, no, sep = ),
env = slider.env
if (!missing(set.no.value)) {
try(eval(parse(text = paste(tclvalue(slider, set.no.value[1],
)-, set.no.value[2], sep = )), env = slider.env))
return(set.no.value[2])
}
if (!exists(slider.env))
slider.env - new.env()
if (!missing(obj.name)) {
if (!missing(obj.value))
assign(obj.name, obj.value, env = slider.env)
else obj.value - get(obj.name, env = slider.env)
return(obj.value)
}
if (missing(title))
title - slider control widget
require(tcltk)
nt - tktoplevel()
tkwm.title(nt, title)
tkwm.geometry(nt, +0+0)
if (missing(sl.names))
sl.names - NULL
if (missing(sl.functions))
sl.functions - function(...) {
}
for (i in seq(sl.names)) {
eval(parse(text = paste(assign('slider, i, 
',tclVar(sl.defaults[i]),env=slider.env),
sep = )))
tkpack(fr - tkframe(nt))
lab - tklabel(fr, text = sl.names[i], width = 25)
sc - tkscale(fr, from = sl.mins[i], to = sl.maxs[i],
showvalue = T, resolution = sl.deltas[i], orient = horiz)
tkpack(lab, sc, side = right)
assign(sc, sc, env = slider.env)
eval(parse(text = paste(tkconfigure(sc,variable=slider,
i, ), sep = )), env = slider.env)
sl.fun - if (length(sl.functions)  1)
sl.functions[[i]]
else sl.functions
if (!is.function(sl.fun))
sl.fun - eval(parse(text = paste(function(...){,
sl.fun, })))
tkconfigure(sc, command = sl.fun)
}
assign(slider.values.old, sl.defaults, env = slider.env)
tkpack(f.but - tkframe(nt), fill = x)
tkpack(tkbutton(f.but, text = Exit, command = function() 
tkdestroy(nt)),
side = right)
if (missing(reset.function))
reset.function - function(...) print(relax)
if (!is.function(reset.function))
reset.function - eval(parse(text = paste(function(...){,
reset.function, })))
tkpack(tkbutton(f.but, text = Reset, command = function() {
for (i in seq(sl.names)) eval(parse(text = paste(tclvalue(slider,
i, )-, sl.defaults[i], sep = )), env = slider.env)
reset.function()
}), side = right)
if (missing(but.names))
but.names - NULL
for (i in seq(but.names)) {
but.fun - if (length(but.functions)  1)
but.functions[[i]]
else but.functions
if (!is.function(but.fun))
but.fun - eval(parse(text = paste(function(...){,
but.fun, })))
tkpack(tkbutton(f.but, text = but.names[i], command = but.fun),
side = left)
}
invisible(nt)
}
# definition of R.veil.in.the.wind
 R.veil.in.the.wind-function(){
   # Mark Hempelmann / Peter Wolf
   par(bg=blue4, col=white, col.main=white,
   col.sub=white, font.sub=2, fg=white) # set colors and fonts
   samp  - function(N,D) N*(1/4+D)/(1/4+D*N)
   z-outer(seq(1, 800, by=10), seq(.0025, 0.2, .0025)^2/1.96^2, 
samp) # create 3d matrix
   h-100
   z[10:70,20:25]-z[10:70,20:25]+h; z[65:70,26:45]-z[65:70,26:45]+h
   z[64:45,43:48]-z[64:45,43:48]+h; z[44:39,26:45]-z[44:39,26:45]+h
   x-26:59; y-11:38; zz-outer(x,y,+); zz-zz*(65zz)*(zz73)
   cz-10+col(zz)[zz0];rz-25+row(zz)[zz0]; 
z[cbind(cz,rz)]-z[cbind(cz,rz)]+h
   refresh.code-function(...){
 theta-slider(no=1); phi-slider(no=2)
 
persp(x=seq(1,800,by=10),y=seq(.0025,0.2,.0025),z=z,theta=theta,phi=phi,
   scale=T, shade=.9, box=F, ltheta = 45,
   lphi = 45, col=aquamarine, border=NA,ticktype=detailed)
   }
   slider(refresh.code, c(theta, phi), c(0, 0),c(360, 360),c(.2, 
.2),c(85, 270)  )
 }


# now let's  test it!

R.veil.in.the.wind()

__

Re: [R] Using data frames for EDA: Insert, Change name, delete columns? (Newcomer's question)

2005-06-28 Thread Earl F. Glynn
Ben Fairbank [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]

 I ... cannot find commands to easily insert,
 remove (delete), rename, and re-order (arbitrarily, not sort) columns.
...
 Could a reader provide a reference where such commands are
 documented?

There's a lot of info in the old R-Help postings, but searching and finding
an answer for a particular problem can be a bit of a pain.
Here's some info from some old R-Help postings that may help on your
question:

DELETE TWO COLUMNS
---
 I have a dataframe 'd2004' and I want to remove two columns:
'd2004$concentration' and 'd2004$stade.

I could do it just as follows:

 names(d2004)

 [1] Localite   Date   parcelle   maille
presence.plant concentration  stade.culture
 [8] stade  Trou   HorizonProfondeur

 d2004 - d2004[, -c(6, 8)]

but I'd like to use column names (to avoid finding column numbers each
time).

I cannot find an easy way to operate...

I wonder why that works:
 d2004[, concentration]

and this don't:
 d2004 - d2004[, -c(concentration, stade)]



SOLUTIONS:

d2004$concentration - NULL
d2004$stade - NULL

or



Newdata - subset(d2004, select=-c(concentration,stade))







RENAMING COLUMNS
---
This is a sample data frame:

 myData - data.frame( col1 = 1:3, col2 = 2:4, col3 = 3:5 )

 myData

  col1 col2 col3

1123

2234

3345



You can change all names by:

 names( myData )- c( newcol1, newcol2, newcol3 )

 myData

  newcol1 newcol2 newcol3

1   1   2   3

2   2   3   4

3   3   4   5



Or a single name by:

 names( myData )[ 2 ] - newcol2

 myData

  col1 newcol2 col3

11   23

22   34

33   45



Or if you know the name, but not the column number:

 names( myData )[ which( names( myData ) == newcol2 ) ] - verynewcol2

 myData

  col1 verynewcol2 col3

11   23

22   34

33   45



REORDERING COLUMNS
---
I don't have a clipping for this one, but here's what I'd try:

 myData - data.frame( col1 = 1:3, col2 = 2:4, col3 = 3:5 )

 myData
  col1 col2 col3
1123
2234
3345
 MyData - myData[,c(3,1,2)]
 MyData
  col3 col1 col2
1312
2423
3534


--
efg
Earl F. Glynn
Bioinformatics
Stowers Institute for Medical Research

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


Re: [R] where can i download the metrics package?

2005-06-28 Thread Achim Zeileis
On Tue, 28 Jun 2005 20:55:44 +0800 ronggui wrote:

 i learn it from metrics: Towards a package for doing econometrics in
 Rbut i can not find it in cran.

I guess you are referring to the talk of Hiroyuki Kawakatsu at useR!
2004. Contact him directly to ask for a version of the package.

Some of the functionality contained in the package is by now also
provided by some CRAN packages, look at the Econometrics view for
further information:
  http://CRAN.R-project.org/src/contrib/Views/Econometrics.html
Z

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


Re: [R] where can i download the metrics package?

2005-06-28 Thread Spencer Graves
  How about Rmetrics, listed under misc:  related projects on 
www.r-project.org.

  spencer graves

ronggui wrote:

 i learn it from metrics: Towards a package for doing econometrics in Rbut i 
 can not find it in cran.
 
 

-- 
Spencer Graves, PhD
Senior Development Engineer
PDF Solutions, Inc.
333 West San Carlos Street Suite 700
San Jose, CA 95110, USA

[EMAIL PROTECTED]
www.pdf.com http://www.pdf.com
Tel:  408-938-4420
Fax: 408-280-7915

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


Re: [R] function for cumulative occurrence of elements

2005-06-28 Thread Tony Plate
I'm not entirely sure what you want, but is it 9 5 3 for this data? (9 
new species occur at the first point, 5 new at the second, and 3 
new at the third).  If this is right, then to get accumulation curve 
when random Points are considered, you can probably just index rows of 
dt appropriately.

  dd - read.table(clipboard, header=T)
  dd[,1:3]
Pointspecies frequency
1  7   American_elm 7
2  7  apple 2
3  7   black_cherry 8
4  7  black_oak 1
5  7chokecherry 1
6  7 oak_sp 1
7  7 pignut_hickory 1
8  7  red_maple 1
9  7  white_oak 5
10 9   black_spruce 2
11 9blue_spruce 2
12 9missing12
13 9  Norway_spruce 8
14 9   white_spruce 3
1512  apple 2
1612   black_cherry 1
1712   black_locust 1
1812   black_walnut 1
1912  lilac 3
2012missing 2
  # dt: table of which species occur at which Points
  dt - table(dd$Point, dd$species)
  # doc: for each species, the index of the Point where
  # it first occurs
  doc - apply(dt, 2, function(x) which(x==1)[1])
  doc
   American_elm  apple   black_cherry   black_locust  black_oak
  1  1  1  3  1
   black_spruce   black_walnutblue_sprucechokecherry  lilac
  2  3  2  1  3
missing  Norway_spruce oak_sp pignut_hickory  red_maple
  2  2  1  1  1
  white_oak   white_spruce
  1  2
  table(doc)
doc
1 2 3
9 5 3
 

hope this helps,

Tony Plate

Steven K Friedman wrote:
 Hello, 
 
 I have a data set with 9700 records, and 7 parameters. 
 
 The data were collected for a survey of forest communities.  Sample plots 
 (1009) and species (139) are included in this data set. I need to determine 
 how species are accumulated as new plots are considered. Basically, I want 
 to develop a species area curve. 
 
 I've included the first 20 records from the data set.  Point represents the 
 plot id. The other parameters are parts of the information statistic H'. 
 
 Using Table, I can construct a data set that lists the occurrence of a 
 species at any Point (it produces a binary 0/1 data table). From there it 
 get confusing, regarding the most efficient approach to determining the 
 addition of new and or repeated species occurrences. 
 
 ptcount -  table(sppoint.freq$species, sppoint.freq$Point) 
 
  From here I've played around with colSums to calculate the number of species 
 at each Point.  The difficulty is determining if a species is new or 
 repeated.  Also since there are 1009 points a function is needed to screen 
 every Point. 
 
 Two goals are of interest: 1) the species accumulation curve, and 2) an 
 accumulation curve when random Points are considered. 
 
 Any help would be greatly appreciated. 
 
 Thank you
 Steve Friedman 
 
 
  Pointspecies frequency point.list point.prop   log.prop 
 point.hprime
 1  7   American elm 7 27 0.25925926 -1.3499267
 0.3499810
 2  7  apple 2 27 0.07407407 -2.6026897
 0.1927918
 3  7   black cherry 8 27 0.29629630 -1.2163953
 0.3604134
 4  7  black oak 1 27 0.03703704 -3.2958369
 0.1220680
 5  7chokecherry 1 27 0.03703704 -3.2958369
 0.1220680
 6  7 oak sp 1 27 0.03703704 -3.2958369
 0.1220680
 7  7 pignut hickory 1 27 0.03703704 -3.2958369
 0.1220680
 8  7  red maple 1 27 0.03703704 -3.2958369
 0.1220680
 9  7  white oak 5 27 0.18518519 -1.6863990
 0.3122961
 10 9   black spruce 2 27 0.07407407 -2.6026897
 0.1927918
 11 9blue spruce 2 27 0.07407407 -2.6026897
 0.1927918
 12 9missing12 27 0. -0.8109302
 0.3604134
 13 9  Norway spruce 8 27 0.29629630 -1.2163953
 0.3604134
 14 9   white spruce 3 27 0. -2.1972246
 0.2441361
 1512  apple 2 27 0.07407407 -2.6026897
 0.1927918
 1612   black cherry 1 27 0.03703704 -3.2958369
 0.1220680
 1712   black locust 1 27 0.03703704 -3.2958369
 0.1220680
 1812   black walnut 1 27 0.03703704 -3.2958369
 0.1220680
 1912  lilac 3 27 0. -2.1972246
 0.2441361
 2012missing 2 27 0.07407407 -2.6026897
 0.1927918
 
 __
 R-help@stat.math.ethz.ch 

Re: [R] ks.test() output interpretation

2005-06-28 Thread Christoph Buser
Hi

I would recommend graphical methods to compare two samples from 
possible different distributions. See ?qqplot
Since the Kolmogorov-Smirnov test has in many cases very small
power, you can not conclude that two sample come from the same
distribution only because the ks.test is not significant.

The following example shows you one problem:
In a short simulation we generate 1000 times two samples (with
100 observation per sample). The first sample has a standard
normal distribution, the second a t-distribution with 1 degree
of freedom. For each of these 1000 pairs we calculate the
ks.test and save the p.value.

x1 - matrix(nrow = 100, ncol = 1000)
y1 - matrix(nrow = 100, ncol = 1000)
test1 - numeric(1000)
for(i in 1:1000) {
  set.seed(i)
  x1[,i] - rnorm(100)
  y1[,i] - rt(100, df = 1)
  test1[i] - ks.test(x1[,i],y1[,i])$p.value
}
sum(test10.05)


Only in 309 of 1000 cases the test shows a significant
difference of the two samples. In all other cases we would
conclude that the two sample have the same distribution.
This is an example with 100 observation per group. If you have
smaller groups the power is even worse.

If we look at 10 randomly drawn pairs of the 1000 simulations
and plot the qqplot:

par(mfrow = c(3,3))
ind - sample(1:1000, 9)
tmp - sapply(ind, function(j) qqplot(x1[,j],y1[,j], xlab = paste(x1[,,j,]),
  ylab = paste(y1[,,j,])))

In many cases we see that the two distributions are
different. Compare it to the qqplot of two normal distributed
random variables:

x2 - matrix(rnorm(900), nrow = 100, ncol = 9)
y2 - matrix(rnorm(900), nrow = 100, ncol = 9)
par(mfrow = c(3,3))
tmp - sapply(1:9, function(j) qqplot(x2[,j],y2[,j], xlab = paste(x2[,,j,]),
  ylab = paste(y2[,,j,])))

Of course there are situations for which the graphical methods
fail, too, but it becomes apparent that it is a descriptive way
to describe two distributions.
Calculating the Kolmogorov-Smirnov test pretends a clear test
result (that two distribution are the same) which is wrong or at
least misleading.

Best regards,

Christoph Buser

--
Christoph Buser [EMAIL PROTECTED]
Seminar fuer Statistik, LEO C13
ETH (Federal Inst. Technology)  8092 Zurich  SWITZERLAND
phone: x-41-44-632-4673 fax: 632-1228
http://stat.ethz.ch/~buser/
--


kapo coulibaly writes:
  I'm using ks.test() to compare two different
  measurement methods. I don't really know how to
  interpret the output in the absence of critical value
  table of the D statistic. I guess I could use the
  p-value when available. But I also get the message
  cannot compute correct p-values with ties ... does
  it mean I can't use ks.test() for these data or I can
  still use the D statistic computed to make a decision
  whether the two samples come from the same
  distribution.
  
  Thanks!!
  
  
   
   
  
  Rekindle the Rivalries. Sign up for Fantasy Football
  
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

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


Re: [R] How to convert c:\a\b to c:/a/b?

2005-06-28 Thread Henrik Bengtsson
(Ted Harding) wrote:
 On 27-Jun-05 Spencer Graves wrote:
 
Thanks, Dirk, Gabor, Eric:

You all provided appropriate solutions for the stated problem. 
Sadly, I oversimplified the problem I was trying to solve:  I copy a 
character string giving a DOS path from MS Windows Explorer into an R 
script file, and I get something like the following:

D:\spencerg\statmtds\R\Rnews

I want to be able to use this in R with its non-R meaning,
 
 e.g., in 
 
readLine, count.fields, read.table, etc., after appending a file name. 
Your three solutions all work for my oversimplified toy example but are
inadequate for the problem I really want to solve.
 
 
 The various responses show that solving this problem directly within
 R may be, well, problematic!
 
 I'm not a perl user, but possibly Spencer Graves's speculation might
 eventually be brought into a straightforward solution.
 
 Unfortunately, for this query, I'm not a Windows users either, so
 can't be authoritative about how practical the following may be for
 Spencer's problem (and similar).
 
 In the Unix world, the string editor program 'sed' simply mops
 up problems of this kind. For example, I just did:
 
   echo D:\spencerg\statmtds\R\Rnews | sed '[EMAIL PROTECTED]@/@g'
 
 and got the response:
 
   D:/spencerg/statmtds/R/Rnews
 
 Note: the parsing of the 'sed' command is as follows:
 
   [EMAIL PROTECTED]@[EMAIL PROTECTED] means substitute y for every (g = 
 global) occurrence
   of x.
 
   The character to be replaced (x=\) is the escape character so
   needs to be escaped (\\); but apart from this it's straightforward.
 
   The usual separator is / instead of @, but I used @
   to simplify things since the substitute itself is y=/.
 
   An alternative using / as separator would be
 
 echo D:\spencerg\statmtds\R\Rnews | sed 's/\\/\//g'
 D:/spencerg/statmtds/R/Rnews
 
   which is a bit more complicated but still straightforward
   (depending on your eyesight). Here, both x=\ and y=/
   need to be escaped.
 
 'sed', and a lot of other useful stuff, is available as GNU tools
 which can be installed on Windows, and allow this kind of thing to
 be very slickly done, but outside of R of course.
 
 I also make much use of 'awk' (but you can equally use perl) for
 tidying up CSV files exported from Excel, and for all sorts of
 rearrangements and substitutions in data files. While Unix users
 take this sort of thing for granted, I suggest to Windows users
 that it could be well worth installing the GNU tools, since they
 are very useful indeed.
 
 It's not clear from Spencer's follow-up whether doing this kind
 of preliminary work outside of R, and then bringing the results
 into R (e.g. via the clipboard or a file) is practical in his
 context. If not (i.e. all the work has to be done inside R), then
 of course my sugestion above is not helpful in this case!

The closest you can get to the above using R (and on Windows) is

echo D:/spencerg/statmtds/R/Rnews tmp.txt
echo cat(gsub(, /, readLines(tmp.txt))) | R --slave


I do have a question/request to r-devel:  In my example, I ideally would 
like to be able to start an *.R script or alternatively send R 
expression at the prompt, and then read data from stdin. Two examples:

echo D:/spencerg/statmtds/R/Rnews | R --slave --code 'cat(gsub(, 
/, readLines(tmp.txt)))'

or

echo cat(gsub(, /, readLines(tmp.txt)))  main.R
echo D:/spencerg/statmtds/R/Rnews | R --slave --file main.R

Note that R CMD BATCH does not provide this.  Either you send your R 
code via standard input or the data, but you cannot send both.  If you 
want to have and dynamic interaction between two applications via stdin 
and stdout, except from ellaborating with .Rprofile/.First I'm not sure 
how to start my script in the first place.

Henrik

 Best wishes,
 Ted.
 
 
 
 E-Mail: (Ted Harding) [EMAIL PROTECTED]
 Fax-to-email: +44 (0)870 094 0861
 Date: 28-Jun-05   Time: 13:38:37
 -- XFMail --
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 


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


[R] Producing character given i.e. | with plotmath

2005-06-28 Thread Gorjanc Gregor
Hello!

Does someone know how to produce

  L(y|mu)

with plotmath?

Some code with unsuccessfull results:

plot(dnorm(x = seq(from = -4, to = 4, by = 0.1)), type = l)
## Not what I want
legend(legend = c(expression(L(y:mu))), x = topright)

## Strange, is this a bug?
legend(legend = c(expression(L(y|mu))), x = top)

## Group produces an error
legend(legend = c(expression(group(L(y, |, mu, x = topleft)

## Paste keeps commas in expression
legend(legend = c(expression(paste(L(y, |, mu, x = bottomleft)

## This one is OK, but braces are not as they should be 
legend(legend = c(expression(paste(L(y, |, mu, x = bottom)

Thanks!

Lep pozdrav / With regards,
Gregor Gorjanc

--
University of Ljubljana
Biotechnical FacultyURI: http://www.bfro.uni-lj.si/MR/ggorjan
Zootechnical Department mail: gregor.gorjanc at bfro.uni-lj.si
Groblje 3   tel: +386 (0)1 72 17 861
SI-1230 Domzale fax: +386 (0)1 72 17 888
Slovenia, Europe
--
One must learn by doing the thing; for though you think you know it,
 you have no certainty until you try. Sophocles ~ 450 B.C.

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


Re: [R] Producing character given i.e. | with plotmath

2005-06-28 Thread Uwe Ligges
Gorjanc Gregor wrote:

 Hello!
 
 Does someone know how to produce
 
   L(y|mu)
 
 with plotmath?
 
 Some code with unsuccessfull results:
 
 plot(dnorm(x = seq(from = -4, to = 4, by = 0.1)), type = l)
 ## Not what I want
 legend(legend = c(expression(L(y:mu))), x = topright)
 
 ## Strange, is this a bug?
 legend(legend = c(expression(L(y|mu))), x = top)


No, | is a logical Operator that can be rewritten in its original 
function form as follows:

|(FALSE, TRUE)

Hence the result is expected.

 ## Group produces an error
 legend(legend = c(expression(group(L(y, |, mu, x = topleft)

You have not specified any delimiter.


 ## Paste keeps commas in expression
 legend(legend = c(expression(paste(L(y, |, mu, x = bottomleft)

correct

 ## This one is OK, but braces are not as they should be 
 legend(legend = c(expression(paste(L(y, |, mu, x = bottom)

What's wrong with the braces?`


What you really want is:
   legend(legend = c(expression(L(group(, y, |) * mu))),
 x = center)

Uwe Ligges


 Thanks!
 
 Lep pozdrav / With regards,
 Gregor Gorjanc
 
 --
 University of Ljubljana
 Biotechnical FacultyURI: http://www.bfro.uni-lj.si/MR/ggorjan
 Zootechnical Department mail: gregor.gorjanc at bfro.uni-lj.si
 Groblje 3   tel: +386 (0)1 72 17 861
 SI-1230 Domzale fax: +386 (0)1 72 17 888
 Slovenia, Europe
 --
 One must learn by doing the thing; for though you think you know it,
  you have no certainty until you try. Sophocles ~ 450 B.C.
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

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


[R] Possible bug in summary of residuals with lm and weights

2005-06-28 Thread Frank E Harrell Jr
I sent this to r-devel the other day but didn't get any takers.  This 
may not be a bug but rather an inconsistency.
I'm not sure if this is intentional.  summary.lm stores weighted
residuals whereas I think most users will want print.summary.lm to
summarize unweighted ones as if saying summary(resid(fit)).

 set.seed(1)
 dat - data.frame(y = rnorm(15), x = rnorm(15), w = 1:15)
 f - lm(y ~ x, weights = w, data = dat)
 summary(f)
. . . .
Residuals:
Min 1Q Median 3QMax
-8.260 -1.565  0.117  2.105  4.666
. . . .
 resid(f)

   1   2   3   4   5   6
-0.73429677  0.06818092 -1.20558034  1.25783256  0.05231879 -1.18383039
   7   8   9  10  11  12
  0.16034166  0.59880438  0.98337588 -0.58944957  1.40690588  0.31138819
  13  14  15
-0.35111933 -2.20770335  0.89438636

 version
platform i386-pc-linux-gnu
arch i386
os   linux-gnu
system   i386, linux-gnu
status
major2
minor1.0
year 2005
month04
day  18
language R

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

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


Re: [R] Possible bug in summary of residuals with lm and weights

2005-06-28 Thread Prof Brian Ripley
On Tue, 28 Jun 2005, Frank E Harrell Jr wrote:

 I sent this to r-devel the other day but didn't get any takers.  This
 may not be a bug but rather an inconsistency.
 I'm not sure if this is intentional.  summary.lm stores weighted
 residuals whereas I think most users will want print.summary.lm to
 summarize unweighted ones as if saying summary(resid(fit)).

It seems no one agreed with you!

I think most users will want S-compatibility here, and after that
residuals that are in some sense on the same scale (that is taking the
weights into account). In short, the status quo.

I suspect no one wants the definition of the summary.lm class changed.

There is a bug in the print method, which has

 cat(if (!is.null(x$w)  diff(range(x$w)))
 Weighted , Residuals:\n, sep = )

so it is intended to say Weighted Residuals, but w is not in a
summary.lm object.



 set.seed(1)
 dat - data.frame(y = rnorm(15), x = rnorm(15), w = 1:15)
 f - lm(y ~ x, weights = w, data = dat)
 summary(f)
 . . . .
 Residuals:
Min 1Q Median 3QMax
 -8.260 -1.565  0.117  2.105  4.666
 . . . .
 resid(f)

   1   2   3   4   5   6
 -0.73429677  0.06818092 -1.20558034  1.25783256  0.05231879 -1.18383039
   7   8   9  10  11  12
  0.16034166  0.59880438  0.98337588 -0.58944957  1.40690588  0.31138819
  13  14  15
 -0.35111933 -2.20770335  0.89438636

 version
 platform i386-pc-linux-gnu
 arch i386
 os   linux-gnu
 system   i386, linux-gnu
 status
 major2
 minor1.0
 year 2005
 month04
 day  18
 language R

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

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


-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

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


[R] (no subject)

2005-06-28 Thread Martinou, Angeliki
Hello,
 
I was wondering if you can help me
 
I am a final year PhD student and I am trying to do a logistic regression in R 
and look at the sign of the linear coefficient estimated from this regression 
in order to decide which model curve I should fit in my data??
 
How  can I do this??
 
thank you Kelly

[[alternative HTML version deleted]]

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


Re: [R] factor to character

2005-06-28 Thread Prof Brian Ripley
On Tue, 28 Jun 2005, Omar Lakkis wrote:

 Using RODBC, when I select from a table strings (chars and varchars)
 come as factors. What is the best way, speed wise, to convert these
 columns back to strings (perhaps using as.character).

FAQ Q7.10, replacing numeric by character.

You do have control in RODBC, in fact: see ?sqlFetch.

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

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


[R] svm and scaling input

2005-06-28 Thread Arne.Muller
Dear All,

I've a question about scaling the input variables for an analysis with svm 
(package e1071). Most of my variables are factors with 4 to 6 levels but there 
are also some numeric variables.

I'm not familiar with the math behind svms, so my assumtions maybe completely 
wrong ... or obvious. Will the svm automatically expand the factors into a 
binary matrix? If I add numeric variables outside the range of 0 to 1 do I have 
to scale them to have 0 to 1 range?

thanks a lot for help,

+kind regards,

Arne

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


Re: [R] Using data frames for EDA: Insert, Change name, delete columns? (Newcomer's question)

2005-06-28 Thread ronggui
if i want to rename the data frame,say data1,to data2,have i use those
data2-data1
rm(dat1)
or these is simpler way to do this? thank you !

On Tue, 28 Jun 2005 10:08:55 -0500
Earl F. Glynn [EMAIL PROTECTED] wrote:

 Ben Fairbank [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
 
  I ... cannot find commands to easily insert,
  remove (delete), rename, and re-order (arbitrarily, not sort) columns.
 ...
  Could a reader provide a reference where such commands are
  documented?
 
 There's a lot of info in the old R-Help postings, but searching and finding
 an answer for a particular problem can be a bit of a pain.
 Here's some info from some old R-Help postings that may help on your
 question:
 
 DELETE TWO COLUMNS
 ---
  I have a dataframe 'd2004' and I want to remove two columns:
 'd2004$concentration' and 'd2004$stade.
 
 I could do it just as follows:
 
  names(d2004)
 
  [1] Localite   Date   parcelle   maille
 presence.plant concentration  stade.culture
  [8] stade  Trou   HorizonProfondeur
 
  d2004 - d2004[, -c(6, 8)]
 
 but I'd like to use column names (to avoid finding column numbers each
 time).
 
 I cannot find an easy way to operate...
 
 I wonder why that works:
  d2004[, concentration]
 
 and this don't:
  d2004 - d2004[, -c(concentration, stade)]
 
 
 
 SOLUTIONS:
 
 d2004$concentration - NULL
 d2004$stade - NULL
 
 or
 
 
 
 Newdata - subset(d2004, select=-c(concentration,stade))
 
 
 
 
 
 
 
 RENAMING COLUMNS
 ---
 This is a sample data frame:
 
  myData - data.frame( col1 = 1:3, col2 = 2:4, col3 = 3:5 )
 
  myData
 
   col1 col2 col3
 
 1123
 
 2234
 
 3345
 
 
 
 You can change all names by:
 
  names( myData )- c( newcol1, newcol2, newcol3 )
 
  myData
 
   newcol1 newcol2 newcol3
 
 1   1   2   3
 
 2   2   3   4
 
 3   3   4   5
 
 
 
 Or a single name by:
 
  names( myData )[ 2 ] - newcol2
 
  myData
 
   col1 newcol2 col3
 
 11   23
 
 22   34
 
 33   45
 
 
 
 Or if you know the name, but not the column number:
 
  names( myData )[ which( names( myData ) == newcol2 ) ] - verynewcol2
 
  myData
 
   col1 verynewcol2 col3
 
 11   23
 
 22   34
 
 33   45
 
 
 
 REORDERING COLUMNS
 ---
 I don't have a clipping for this one, but here's what I'd try:
 
  myData - data.frame( col1 = 1:3, col2 = 2:4, col3 = 3:5 )
 
  myData
   col1 col2 col3
 1123
 2234
 3345
  MyData - myData[,c(3,1,2)]
  MyData
   col3 col1 col2
 1312
 2423
 3534
 
 
 --
 efg
 Earl F. Glynn
 Bioinformatics
 Stowers Institute for Medical Research
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


-- 
Department of Sociology
Fudan University,Shanghai
Blog:http://sociology.yculblog.com

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


[R] faster algorithm for Kendall's tau

2005-06-28 Thread ferdinand principia
Hi,

I need to calculate Kendall's tau for large data
vectors (length  100'000). 
Is somebody aware of a faster algorithm or package
function than cor(, method=kendall)? 
There are ties in the data to be considered (Kendall's
tau-b).

Any suggestions?

Regards
Ferdinand

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


Re: [R] function for two-part or two-condition models

2005-06-28 Thread Remington, Richard

Two alternatives to the zero inflated Poisson (ZIP) model are mentioned 
in Jung, Jhun, and Lee (Biometrics, vol 61, no 2, June 2005, p626):

Although the ZIP model is more general than the standard Poisson, count 
data with many zeros are often more dispersed than the ZIP model.  In 
this case, the use of a zero-inflated negative binomial (ZINB) 
distribution or a zero-inflated generalized Poisson distribution is a 
good alternative.

best,
Richard

-- 
Richard E. Remington
Statistician
KERN Statistical Services, Inc.
PO Box 1046
Boise, ID 83701
Tel: 208.426.0113
KernStat.com

Andrew Robinson wrote:
 Hi Richard,
 
 I'm not sure that I can imagine how data can have too many zeros to be
 fit well with zero-inflated Poisson models. Won't the excess zeros be
 accommodated by increasing the the inflation?
 
 In any case, if you want a model that separates the zeros from the
 occurrences before fitting a Poisson model to account for variation in
 abundance then it might be safest to do that split manually.
 
 Another angle to try is to treat it as a special case of a finite
 mixture regression.  I think that some of Jim Lindsey's code will fit
 such models. Google can help you find his wbsite.
 
 An MS student of mine explored these models for regeneration modeling.
 I'd be happy to send you a pdf of his thesis if it would help.
 
 Cheers,
 
 Andrew
 
 On Mon, Jun 27, 2005 at 03:35:30PM -0400, Richard Chandler wrote:
 
Hello,

This is an (hopefully) improved question of one I posted several weeks
ago. Does anyone know of a function for fitting two-part models?
These models are designed to handle count data with so many zeroes
that they can't be fit well with zero-inflated Poisson models or other
'typical' GLMs. My understanding is that they work by first fitting a
binomial model to separate the zeros from the occurrences (positive
integers) before fitting a Poisson model to account for variation in
abundance. 

I have tried help.search(two-part) and many other similar guesses.

Thanks,
Richard

-- 
Richard Chandler, M.S. Candidate
Department of Natural Resources Conservation
UMass Amherst
(413)545-1237

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


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


[R] Circular Mean Question

2005-06-28 Thread Michael Peckford

Hi, a question about the circular mean function in the package
CircStats:

Can anyone shed some light on why the circ mean function seems to make
sense for the first 2 set of bearings and then the mean of 225 and 45
degrees gives an unexpected 180 deg. 

 deg(circ.mean(c(rad(222),rad(45%%360
[1] 133.5
 deg(circ.mean(c(rad(224),rad(45%%360
[1] 134.5
 deg(circ.mean(c(rad(225),rad(45%%360
[1] 180
 deg(circ.mean(c(rad(226),rad(45%%360
[1] 315.5

Can anyone explain this???

This problem was first detected when I was trying to take the circ
weighted means of my data:

With 2 groups of bearings:
x - c(270,180)
y - c(45,270)

the circular mean of these bearings gives:
 deg(circ.mean(c(rad(x),rad(y%%360
[1] 257.2356

When finding the weighted means I get this:
 meany - circ.mean(rad(y))
 meanx - circ.mean(rad(x))

 deg(circ.weighted.mean(c(meanx,meany),c(2,2)))%%360
[1] 281.25

The function for weighted mean I am using:

circ.weighted.mean - function (x,w) 
{
sinr - sum(w*sin(x))
cosr - sum(w*cos(x))
circmean - atan(sinr, cosr)
circmean
}

I am assuming that the problem that mention above is the cause of the
different mean bearings.

Am I missing something fundamental here?

Thanks,
Mike

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


[R] Brown-Forsythe Test

2005-06-28 Thread Jose Herrera Bazán
Hi,

do anyone know which statistical software have the Brown-Forsythe Test for 
differences of numerical continue data groups wich variance heterogenity? 
not ofr evaluate the homogenity of variances, for evaluated the differences 
between groups as ANOVA.
thanks

José Herrera
México

_
T1msn Search. Todo lo que buscas ahora más rapido  
http://search.t1msn.com.mx/

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


Re: [R] Brown-Forsythe Test

2005-06-28 Thread Chuck Cleland
?oneway.test

Jose Herrera Bazán wrote:
 Hi,
 
 do anyone know which statistical software have the Brown-Forsythe Test for 
 differences of numerical continue data groups wich variance heterogenity? 
 not ofr evaluate the homogenity of variances, for evaluated the differences 
 between groups as ANOVA.
 thanks
 
 José Herrera
 México
 
 _
 T1msn Search. Todo lo que buscas ahora más rapido  
 http://search.t1msn.com.mx/
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 
 

-- 
Chuck Cleland, Ph.D.
NDRI, Inc.
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 452-1424 (M, W, F)
fax: (917) 438-0894

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


Re: [R] svm and scaling input

2005-06-28 Thread Uwe Ligges
[EMAIL PROTECTED] wrote:
 Dear All,
 
 I've a question about scaling the input variables for an analysis with svm 
 (package e1071). Most of my variables are factors with 4 to 6 levels but 
 there are also some numeric variables.
 
 I'm not familiar with the math behind svms, so my assumtions maybe completely 
 wrong ... or obvious. Will the svm automatically expand the factors into a 
 binary matrix? If I add numeric variables outside the range of 0 to 1 do I 
 have to scale them to have 0 to 1 range?


Well, this depends on the kernel in use.
For radial basis functions (as an example), you do not have to rescale, 
but a transformation of variables might make sense in order to get 
better results, though.

Uwe Ligges


 
 thanks a lot for help,
 
   +kind regards,
 
   Arne
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

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


Re: [R] faster algorithm for Kendall's tau

2005-06-28 Thread Marc Schwartz (via MN)
On Tue, 2005-06-28 at 13:03 -0400, ferdinand principia wrote:
 Hi,
 
 I need to calculate Kendall's tau for large data
 vectors (length  100'000). 
 Is somebody aware of a faster algorithm or package
 function than cor(, method=kendall)? 
 There are ties in the data to be considered (Kendall's
 tau-b).
 
 Any suggestions?
 
 Regards
 Ferdinand


The time intensive part of the process is typically the ranking/ordering
of the vector pairs to calculate the numbers of concordant and
discordant pairs.

If the number of _unique pairs_ in your data is substantially less than
the number of total pairs (in other words, creating a smaller 2d
contingency table from a pair of your vectors makes sense), then the
following may be of help.

# Calculate CONcordant Pairs in a table
# cycle through x[r, c] and multiply by
# sum(x elements below and to the right of x[r, c])
# x = table
concordant - function(x)
{
  x - matrix(as.numeric(x), dim(x))
  
  # get sum(matrix values  r AND  c)
  # for each matrix[r, c]
  mat.lr - function(r, c)
  { 
lr - x[(r.x  r)  (c.x  c)]
sum(lr)
  }

  # get row and column index for each
  # matrix element
  r.x - row(x)
  c.x - col(x)

  # return the sum of each matrix[r, c] * sums
  # using mapply to sequence thru each matrix[r, c]
  sum(x * mapply(mat.lr, r = r.x, c = c.x))
}

# Calculate DIScordant Pairs in a table
# cycle through x[r, c] and multiply by
# sum(x elements below and to the left of x[r, c])
# x = table
discordant - function(x)
{
  x - matrix(as.numeric(x), dim(x))
  
  # get sum(matrix values  r AND  c)
  # for each matrix[r, c]
  mat.ll - function(r, c)
  { 
ll - x[(r.x  r)  (c.x  c)]
sum(ll)
  }

  # get row and column index for each
  # matrix element
  r.x - row(x)
  c.x - col(x)

  # return the sum of each matrix[r, c] * sums
  # using mapply to sequence thru each matrix[r, c]
  sum(x * mapply(mat.ll, r = r.x, c = c.x))
}


# Calculate Kendall's Tau-b
# x = table
calc.KTb - function(x)
{
  x - matrix(as.numeric(x), dim(x))
  
  c - concordant(x)
  d - discordant(x)

  n - sum(x)
  SumR - rowSums(x)
  SumC - colSums(x)

  KTb - (2 * (c - d)) / sqrt(((n ^ 2) -
 (sum(SumR ^ 2))) * ((n ^ 2) -
 (sum(SumC ^ 2

  KTb
}


Note that I made some modifications of the above, relative to prior
versions that I have posted to handle large numbers of pairs to avoid
integer overflows in summations. Hence the:

  x - matrix(as.numeric(x), dim(x))

conversion in each function.

Now, create some random test data, with 100,000 elements in each vector,
sampling from 'letters', which would yield a 26 x 26 table:

 a - sample(letters, 10, replace = TRUE)
 b - sample(letters, 10, replace = TRUE)
 
  dim(table(a, b))
 [1] 26 26

  system.time(print(calc.KTb(table(a, b
[1] 0.0006906088
[1] 0.77 0.02 0.83 0.00 0.00

Note that in the above, the initial table takes most of the time:

 system.time(table(a, b))
[1] 0.55 0.00 0.56 0.00 0.00

Hence:

 tab.ab - table(a, b)
 system.time(print(calc.KTb(tab.ab)))
[1] 0.0006906088
[1] 0.25 0.01 0.27 0.00 0.00


I should note that I also ran:

 system.time(print(cor(a, b, method = kendall)))
[1] 0.0006906088 
[1] 694.80   7.72 931.89   0.00   0.00 

Nice to know the results work out at least...  :-)


I have not tested with substantially larger 2d matrices, but would
envision that as the dimensions of the resultant tabulation increases,
my method probably approaches and may even become less efficient than
the approach implemented in cor(). Some testing would validate this and
perhaps point to coding the concordant() and discordant() functions in C
for improvement in timing.

HTH,

Marc Schwartz

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


[R] 3D ellipsoid confidence region

2005-06-28 Thread Melanie Edwards
I am curious if there is code developed to plot confidence regions in 3D.
The scatterplot3d function generates the plot I want, but would like an 3D
equivalent to the data.ellipse function.

Any help in this direction would be appreciated, be it theoretical,
graphical, or otherwise.

Melanie Edwards
Senior Statistician

Exponent
15375 SE 30th PL, Suite 250
Bellevue, WA  98007
Tel:  (425) 519-8714
Fax:  (425) 643-9827
Cell:  (206) 852-5739
www.exponent.com

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


[R] Course***R/S-plus Fundamentals and Programming Techinques: Seattle July 11-12

2005-06-28 Thread sue
XLSolutions Corporation (www.xlsolutions-corp.com) is proud to
announce  2-day R/S-plus Fundamentals and Programming
Techniques at 4 locations nationwide.
www.xlsolutions-corp.com/Rfund.htm

Seattle, WA - July 11th-12th, 2005


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

Course Description:

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

With the following outline:

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

Interested in R/Splus Advanced course? email us.

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

Interested in R/Splus Advanced course? email us.


Cheers,
Elvis Miller, PhD
Manager Training.
XLSolutions Corporation
206 686 1578
www.xlsolutions-corp.com
[EMAIL PROTECTED]

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


Re: [R] Circular Mean Question

2005-06-28 Thread Ravi Varadhan
Hi Mike,

You should think of vector sums rather than arithmetic sum.  So the mean
is really the direction of the resultant vector of all the unit vectors.
When two unit vectors are exactly opposing each other (as in your example
with angles 45 and 225 degrees), they cancel each other out and the
resultant vector has length zero, and hence the direction is arbitrary and
undefined.  However, there are two issues which give rise to seemingly
anomalous results:  (1) due to finite numerical precision in computing the
sines and cosines, exact cancellation does not happen, and (2) discontinuity
in atan function due to branch-point (0, 0) and a branch cut along negative
real axis.

For example,
 deg(circ.mean(c(rad(30),rad(210
[1] -56.30993247402022
 sx - sin(rad(210)) + sin(rad(30))
 cx - cos(rad(210)) + cos(rad(30))
 sx
[1] -1.665334536937735e-16
 cx
[1] 1.110223024625157e-16
 atan(sx,cx)  # this should really be 0
[1] -0.9827937232473291

If you now look at the resultant vector it has components (sin(-0.9828),
cos(-0.9828)) = (-0.83,0.55), which is completely wrong.  

However, the above example is only a minor perturbation away from the
following (where the resultant vector is not zero):
 deg(circ.mean(c(rad(211),rad(30 # note 211 = -149 (mod 360)
[1] -59.46
which is perfectly alright.

Hope this helps,
Ravi.

--
Ravi Varadhan, Ph.D.
Assistant Professor,  The Center on Aging and Health
Division of Geriatric Medicine and Gerontology
Johns Hopkins University
Ph: (410) 502-2619
Fax: (410) 614-9625
Email:  [EMAIL PROTECTED]
--

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:r-help-
 [EMAIL PROTECTED] On Behalf Of Michael Peckford
 Sent: Tuesday, June 28, 2005 1:35 PM
 To: r-help@stat.math.ethz.ch
 Subject: [R] Circular Mean Question
 
 
 Hi, a question about the circular mean function in the package
 CircStats:
 
 Can anyone shed some light on why the circ mean function seems to make
 sense for the first 2 set of bearings and then the mean of 225 and 45
 degrees gives an unexpected 180 deg.
 
  deg(circ.mean(c(rad(222),rad(45%%360
 [1] 133.5
  deg(circ.mean(c(rad(224),rad(45%%360
 [1] 134.5
  deg(circ.mean(c(rad(225),rad(45%%360
 [1] 180
  deg(circ.mean(c(rad(226),rad(45%%360
 [1] 315.5
 
 Can anyone explain this???
 
 This problem was first detected when I was trying to take the circ
 weighted means of my data:
 
 With 2 groups of bearings:
 x - c(270,180)
 y - c(45,270)
 
 the circular mean of these bearings gives:
  deg(circ.mean(c(rad(x),rad(y%%360
 [1] 257.2356
 
 When finding the weighted means I get this:
  meany - circ.mean(rad(y))
  meanx - circ.mean(rad(x))
 
  deg(circ.weighted.mean(c(meanx,meany),c(2,2)))%%360
 [1] 281.25
 
 The function for weighted mean I am using:
 
 circ.weighted.mean - function (x,w)
 {
 sinr - sum(w*sin(x))
 cosr - sum(w*cos(x))
 circmean - atan(sinr, cosr)
 circmean
 }
 
 I am assuming that the problem that mention above is the cause of the
 different mean bearings.
 
 Am I missing something fundamental here?
 
 Thanks,
 Mike
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-
 guide.html

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


[R] lattice graph background

2005-06-28 Thread Juan Carlos Quiroz Espinosa
Hi user's

How to modify the color background on lattice plot. I am trying to
plotting histogram from lattice package.

Thank very much

*
Juan Carlos Quiroz
Instituto de Fomento Pesquero
CHILE

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


Re: [R] lattice graph background

2005-06-28 Thread Sundar Dorai-Raj


Juan Carlos Quiroz Espinosa wrote:
 Hi user's
 
 How to modify the color background on lattice plot. I am trying to
 plotting histogram from lattice package.
 
 Thank very much
 

Try:

trellis.par.set(theme = col.whitebg())

or create your own theme.

See ?trellis.par.set.

HTH,

--sundar

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


[R] How to extract the within group correlation structure matrix in lme

2005-06-28 Thread liqiu jiang
Dear R users,
 I fitted a repeated measure model without random effects by using lme. I will 
use the estimates from that model as an initial estimates to do multiple 
imputation for missing values of the response variable in the model.  I am 
trying to extract the within group correlation matrix or covariance matrix. 
 
here is my code:
f = lme(y ~x0+x1+trt+tim+x1:tim +tim:trt,random=~-1|subj, data=dat,corr 
=corAR1())
 f$sigma
[1] 2.330854

b=summary(f)$modelStruct$corStruct
 b
Correlation structure of class corAR1 representing
  Phi 
0.8518711 

I think  0.8518711 and f$sigma is what I need to reconstruct the 
variance-cavariance matrix. So, How can I extract 0.8518711 so that I can 
assign it to a variable? Also, I don't understand what the following parameters 
estimates mean?  
 
 summary(f)$modelStruct
reStruct  parameters:
 subj 
-20.15833 
corStruct  parameters:
[1] 2.525869
 
I appreciate your time on this. 
 
Best wishes,
Liqiu 
 
 
 
 
 
 


-

 Rekindle the Rivalries. Sign up for Fantasy Football
[[alternative HTML version deleted]]

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


Re: [R] 3D ellipsoid confidence region

2005-06-28 Thread John Fox
Dear Melanie,

I think that you're referring to the data.ellipse function in the car
package. What you're suggesting is a nice idea but I haven't done it. I
think that it might be easier to draw the ellipsoid using the rgl
package rather than scatterplot3d. (See, e.g., the scatter3d function
in the Rcmdr package.)

Regards,
 John

On Tue, 28 Jun 2005 12:35:35 -0700
 Melanie Edwards [EMAIL PROTECTED] wrote:
 I am curious if there is code developed to plot confidence regions in
 3D.
 The scatterplot3d function generates the plot I want, but would like
 an 3D
 equivalent to the data.ellipse function.
 
 Any help in this direction would be appreciated, be it theoretical,
 graphical, or otherwise.
 
 Melanie Edwards
 Senior Statistician
 
 Exponent
 15375 SE 30th PL, Suite 250
 Bellevue, WA  98007
 Tel:  (425) 519-8714
 Fax:  (425) 643-9827
 Cell:  (206) 852-5739
 www.exponent.com
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide!
 http://www.R-project.org/posting-guide.html


John Fox
Department of Sociology
McMaster University
Hamilton, Ontario, Canada
http://socserv.mcmaster.ca/jfox/

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


Re: [R] How to extract the within group correlation structure matrix in lme

2005-06-28 Thread Spencer Graves
  Have you tried VarCorr(f)?

  spencer graves

liqiu jiang wrote:

 Dear R users,
  I fitted a repeated measure model without random effects by using lme. I 
 will use the estimates from that model as an initial estimates to do multiple 
 imputation for missing values of the response variable in the model.  I am 
 trying to extract the within group correlation matrix or covariance matrix. 
  
 here is my code:
 f = lme(y ~x0+x1+trt+tim+x1:tim +tim:trt,random=~-1|subj, data=dat,corr 
 =corAR1())
 
f$sigma
 
 [1] 2.330854
 
 b=summary(f)$modelStruct$corStruct
 
b
 
 Correlation structure of class corAR1 representing
   Phi 
 0.8518711 
 
 I think  0.8518711 and f$sigma is what I need to reconstruct the 
 variance-cavariance matrix. So, How can I extract 0.8518711 so that I can 
 assign it to a variable? Also, I don't understand what the following 
 parameters estimates mean?  
  
  summary(f)$modelStruct
 reStruct  parameters:
  subj 
 -20.15833 
 corStruct  parameters:
 [1] 2.525869
  
 I appreciate your time on this. 
  
 Best wishes,
 Liqiu 
  
  
  
  
  
  
 
   
 -
 
  Rekindle the Rivalries. Sign up for Fantasy Football
   [[alternative HTML version deleted]]
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

-- 
Spencer Graves, PhD
Senior Development Engineer
PDF Solutions, Inc.
333 West San Carlos Street Suite 700
San Jose, CA 95110, USA

[EMAIL PROTECTED]
www.pdf.com http://www.pdf.com
Tel:  408-938-4420
Fax: 408-280-7915

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


[R] JGR font rendering on Windows

2005-06-28 Thread Mike Prager
JGR users on Windows may be interested that Sun has released a preview 
of its latest Java development kit and runtime engine at

http://www.java.net/download/jdk6/binaries/

This removes the main problem I have had with JGR and other Java 
programs on Windows: poor font rendering.  On Windows XP with an LCD 
display, the improvement is striking, as this uses Windows native font 
smoothing (CoolType).  I believe it uses the default Windows font 
smoothing on other versions of Windows or other displays.

MHP

-- 
Michael Prager, Ph.D.
NOAA Center for Coastal Fisheries and Habitat Research
Beaufort, North Carolina  28516
http://shrimp.ccfhrb.noaa.gov/~mprager/
*** Opinions are personal, not official. No government endorsement
is made of any commercial or noncommercial product. ***

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


[R] conversion

2005-06-28 Thread Anna Oganyan
Dear List,
How can I convert a list with elements being character strings, like: 
c(1,2,3,4), “c(1,3,4,2) … to a list with elements as numerical 
vectors: c(1,2,3,4), c(1,3,4,2)…?
Thanks!
Anna

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


[R] Reference Card (especially useful for Newbies)

2005-06-28 Thread Berton Gunter
 

Newbies (and others!) may find useful the R Reference Card made available by
Tom Short and Rpad at http://www.rpad.org/Rpad/Rpad-refcard.pdf  or through
the Contributed link on CRAN (where some other reference cards are also
linked). It categorizes and organizes a bunch of R's basic, most used
functions so that they can be easily found. For example, paste() is under
the Strings heading and expand.grid() is under Data Creation. For
newbies struggling to find the right R function as well as veterans who
can't quite remember the function name, it's very handy.
 
-- Bert Gunter
Genentech Non-Clinical Statistics
South San Francisco, CA
 
The business of the statistician is to catalyze the scientific learning
process.  - George E. P. Box

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

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


Re: [R] test of hazard ratios

2005-06-28 Thread Spencer Graves
  Can you fit a single model that includes the two classifiers from 
which the model with one classifier could be obtained as a special case? 
  If yes (and if neither parameter was at a boundary crudely similar to 
a zero variance component in lme), then you could use the theory that 
2*ln(likelihood ratio) is approximately chi-square.  For many 
capabilities in R, this is implemented as a function anova(fit2, fit1) 
where fit2 and fit1 are the results of fitting the general and the 
specialized models.

  If you don't see how to make this work, PLEASE do read the posting 
guide! http://www.R-project.org/posting-guide.html;.  It might help you 
find a better answer.  Failing that, if you submit another post after 
following the process described therein, it should increase the chances 
that you will get a useful reply.

  spencer graves

Steve Adams wrote:

 Hi,
 
 Is there a R test available that tests whether 2
 hazard ratios obtained from Cox regressions on the
 same patient sample by 2 different classifiers are
 significantly different?
 
 Thanks
 
 Steve
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

-- 
Spencer Graves, PhD
Senior Development Engineer
PDF Solutions, Inc.
333 West San Carlos Street Suite 700
San Jose, CA 95110, USA

[EMAIL PROTECTED]
www.pdf.com http://www.pdf.com
Tel:  408-938-4420
Fax: 408-280-7915

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


[R] Help with stripplot

2005-06-28 Thread Ghosh, Sandeep
For the following code is there a way to make the jitter all line up 
horizontally, instead of them being just randomly spread around a value. So for 
ex if there are multiple values at 63 for genotype wt then all the values 
should be plotted on the same y value of 63 but spaced apart by a certain 
factor or noise..

library(lattice);

dataFrame - as.data.frame(t(structure(c(
64,'wt',
62,'wt',
66,'wt',
65,'wt',
60,'wt',
61,'wt',
65,'wt',
66,'wt',
65,'wt',
63,'wt',
67,'wt',
65,'wt',
62,'wt',
65,'wt',
68,'wt',
65,'wt',
63,'wt',
65,'wt',
62,'wt',
65,'wt',
66,'wt',
62,'wt',
65,'wt',
65,'wt',
66,'wt',
65,'wt',
62,'wt',
65,'wt',
66,'wt',
65,'wt',
61,'wt',
65,'wt',
66,'wt',
65,'wt',
62,'wt',
63,'het',
67,'het',
60,'het',
67,'het',
66,'het',
62,'het',
65,'het',
62,'het',
61,'het',
62,'het',
66,'het',
60,'het',
65,'het',
65,'het',
61,'het',
64,'het',
68,'het',
64,'het',
63,'het',
62,'het',
64,'het',
62,'het',
64,'het',
65,'het',
60,'het',
65,'het',
70,'het',
63,'het',
67,'het',
66,'het',
65,'hom',
62,'hom',
68,'hom',
67,'hom',
67,'hom',
63,'hom',
67,'hom',
66,'hom',
63,'hom',
72,'hom',
62,'hom',
61,'hom',
66,'hom',
64,'hom',
60,'hom',
61,'hom',
66,'hom',
66,'hom',
66,'hom',
62,'hom',
70,'hom',
65,'hom',
64,'hom',
63,'hom',
65,'hom',
69,'hom',
61,'hom',
66,'hom',
65,'hom',
61,'hom',
63,'hom',
64,'hom',
67,'hom'), .Dim=c(2,98;

colnames(dataFrame) - c('marbles_buried', 'genotype');

dataFrame[c(marbles_buried)] - lapply(dataFrame[c(marbles_buried)], 
function(x) as.numeric(levels(x)[x]));

trellis.par.set(theme = col.whitebg());

stripplot(jitter(marbles_buried) ~ genotype, data = dataFrame, aspect = 1, 
jitter = TRUE, xlab='Genotype', ylab = Marbles Buried, main='MBA WTs Vs 
HOMs');

Thanks,
Sandeep Kumar Ghosh
Lexicon Genetics, Inc.,
8800 Technology Forest,
The Woodlands, TX  77380
(281) 863-3479
Internal Extension - 3479



[[alternative HTML version deleted]]

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


Re: [R] conversion

2005-06-28 Thread Sundar Dorai-Raj


Anna Oganyan wrote:
 Dear List,
 How can I convert a list with elements being character strings, like: 
 c(1,2,3,4), “c(1,3,4,2) … to a list with elements as numerical 
 vectors: c(1,2,3,4), c(1,3,4,2)…?
 Thanks!
 Anna
 

Try:

x - list(c(1,2,3,4), c(1,3,4,2))
lapply(x, function(x) eval(parse(text = x)))

HTH,

--sundar

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


[R] sample R code for multiple imputation

2005-06-28 Thread David Hwang
Hi,

I have a big dataset which has many missing values and want to implement 
Multiple imputation via Monte carlo markov chain by following J Schafer's 
Analysis of incomplete multivariate data. I don't know where to begin 
and is looking for a sample R code that implements multiple imputation 
with EM, MCMC, etc

Any help / suggestion will be greatly appreciated.

David

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


Re: [R] conversion

2005-06-28 Thread Marc Schwartz (via MN)
On Tue, 2005-06-28 at 17:23 -0400, Anna Oganyan wrote:
 Dear List,
 How can I convert a list with elements being character strings, like: 
 c(1,2,3,4), “c(1,3,4,2) … to a list with elements as numerical 
 vectors: c(1,2,3,4), c(1,3,4,2)…?
 Thanks!
 Anna

 l - list(c(1,2,3,4), c(1,3,4,2))

 l
[[1]]
[1] c(1,2,3,4)

[[2]]
[1] c(1,3,4,2)

Now use lapply() over each list element in 'l', converting the character
vectors to R expressions and then evaluating them:

 lapply(l, function(x) eval(parse(text = x)))
[[1]]
[1] 1 2 3 4

[[2]]
[1] 1 3 4 2


See ?lapply, ?eval and ?parse.

HTH,

Marc Schwartz

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

[R] How to sort a dataframe by one variable

2005-06-28 Thread Lisa Wang
Hi there,

Could anybody help me on how to sort a dataframe by one variable in the 
dataframe?

Thank you

Lisa Wang
Princess Margaret Hospital
Toronto, Ca
tel: 416 946 4501

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


Re: [R] conversion

2005-06-28 Thread Spencer Graves
  as.numeric?

  spencer graves

Anna Oganyan wrote:

 Dear List,
 How can I convert a list with elements being character strings, like: 
 c(1,2,3,4), “c(1,3,4,2) … to a list with elements as numerical 
 vectors: c(1,2,3,4), c(1,3,4,2)…?
 Thanks!
 Anna
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

-- 
Spencer Graves, PhD
Senior Development Engineer
PDF Solutions, Inc.
333 West San Carlos Street Suite 700
San Jose, CA 95110, USA

[EMAIL PROTECTED]
www.pdf.com http://www.pdf.com
Tel:  408-938-4420
Fax: 408-280-7915

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


Re: [R] Help with stripplot

2005-06-28 Thread Sundar Dorai-Raj


Ghosh, Sandeep wrote:
 For the following code is there a way to make the jitter all line up 
 horizontally, instead of them being just randomly spread around a value. So 
 for ex if there are multiple values at 63 for genotype wt then all the values 
 should be plotted on the same y value of 63 but spaced apart by a certain 
 factor or noise..
 
snip
 

Yes, remove the jitter function call:

stripplot(marbles_buried ~ genotype, data = dataFrame, aspect = 1,
   jitter = TRUE, xlab='Genotype', ylab = Marbles Buried,
   main='MBA WTs Vs HOMs')


--sundar

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


Re: [R] R-help Digest, Vol 28, Issue 28

2005-06-28 Thread A. Mani
On Tuesday 28 June 2005 15:30, [EMAIL PROTECTED] wrote:
Re :   37. Re: A. Mani : colours in Silhouette (Mulholland, Tom)
   
 Message: 37
 Date: Tue, 28 Jun 2005 09:08:24 +0800
 From: Mulholland, Tom [EMAIL PROTECTED]
 Subject: Re: [R] A. Mani : colours in Silhouette
 To: [EMAIL PROTECTED], r-help@stat.math.ethz.ch
 Message-ID:
  [EMAIL PROTECTED]
 Content-Type: text/plain; charset=iso-8859-1

 It's not so much a problem, as not working the way you expected.
 cluster:::plot.partition is used to do the plotting. If you look at the
 code for this you can see the difficulty in putting every possible
 permutation into the code. If for example you want the silhouette plot to
 be red using col = red is not intuitive as the cluster plot (which comes
 up first) has more than one colour. If you have a look at methods(plot)
 (assuming that you have loaded the cluster package) you will see that there
 is a specific piece of code in the form of plot.silhouette. It has an
 asterisk next to it so you need to use cluster:::plot.silhouette to see the
 code. It has what you need.

 args(cluster:::plot.silhouette)

  function (x, nmax.lab = 40, max.strlen = 5, main = NULL, sub = NULL,

 xlab = expression(Silhouette width  * s[i]), col = gray,
 do.col.sort = length(col)  1, border = 0, cex.names = par(cex.axis),
 do.n.k = TRUE, do.clus.stat = TRUE, ...)


  data(ruspini)
   pr4 - pam(ruspini, 4)
   si - silhouette(pr4)
   plot(si,col = red)

I tried that before with many more options and got a blank image. It must have 
been due to the options.
 The issue is that whenever code is written there is always a choice as to
 what functionality is put in place. Just because something can be done,
 does not mean it will or in some cases should be done. In this case the
 help for plot.partition notes that For more flexibility, use
 'plot(silhouette(x), ...)', see 'plot.silhouette'.

 Tom

 Thanks for that I found out something I will find useful in the future.

  -Original Message-
  From: [EMAIL PROTECTED]
  [mailto:[EMAIL PROTECTED] Behalf Of A. Mani
  Sent: Tuesday, 28 June 2005 4:30 AM
  To: r-help@stat.math.ethz.ch
  Subject: [R] A. Mani : colours in Silhouette
 
 
  Hello,
 In cluster analysis with cluster, how does one colour
  the silhouette
  plots ? For example in using pam. There seems to be some
  problem there.
  Everything else can be coloured.
 
  Thanks,
 

 A. Mani
 Member, Cal. Math. Soc

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


Re: [R] How to sort a dataframe by one variable

2005-06-28 Thread Sundar Dorai-Raj


Lisa Wang wrote:
 Hi there,
 
 Could anybody help me on how to sort a dataframe by one variable in the 
 dataframe?
 
 Thank you
 

See ?order.

x - data.frame(a = runif(10), b = 1:10)
x[order(x$a), ]


--sundar

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


Re: [R] How to sort a dataframe by one variable

2005-06-28 Thread Francisco J. Zagmutt
Try RSiteSearch(Sort data frame).

Anyhow, use order() or sort.list() as follows:

dat[order(dat[,'myColumn']),]#Sorts data.frame dat by column myColumn
dat-dat[sort.list(dat$myColumn, decreasing = T),] #Another option to do the 
same.  You can specify decreasing or increasing within both function

Cheers

Francisco

From: Lisa Wang [EMAIL PROTECTED]
To: R-Help r-help@stat.math.ethz.ch
Subject: [R] How to sort a dataframe by one variable
Date: Tue, 28 Jun 2005 17:39:40 -0400

Hi there,

Could anybody help me on how to sort a dataframe by one variable in the
dataframe?

Thank you

Lisa Wang
Princess Margaret Hospital
Toronto, Ca
tel: 416 946 4501

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

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


Re: [R] faster algorithm for Kendall's tau

2005-06-28 Thread ferdinand principia
Sorry,

I should specifiy in more detail what my data looks
like. The data vectors (simulations) are mostly
composed of floats (for which it's pretty unlikely to
produce ties), but there are integer values to be
found as well (up to 10% of vector elements). 
As I undestand, Marc's algo is not suited for this
case. 

Is there another solution?

Thanks
Ferdinand


--- Marc Schwartz (via MN) [EMAIL PROTECTED]
wrote:

 On Tue, 2005-06-28 at 13:03 -0400, ferdinand
 principia wrote:
  Hi,
  
  I need to calculate Kendall's tau for large data
  vectors (length  100'000). 
  Is somebody aware of a faster algorithm or package
  function than cor(, method=kendall)? 
  There are ties in the data to be considered
 (Kendall's
  tau-b).
  
  Any suggestions?
  
  Regards
  Ferdinand
 
 
 The time intensive part of the process is typically
 the ranking/ordering
 of the vector pairs to calculate the numbers of
 concordant and
 discordant pairs.
 
 If the number of _unique pairs_ in your data is
 substantially less than
 the number of total pairs (in other words, creating
 a smaller 2d
 contingency table from a pair of your vectors makes
 sense), then the
 following may be of help.
 
 # Calculate CONcordant Pairs in a table
 # cycle through x[r, c] and multiply by
 # sum(x elements below and to the right of x[r, c])
 # x = table
 concordant - function(x)
 {
   x - matrix(as.numeric(x), dim(x))
   
   # get sum(matrix values  r AND  c)
   # for each matrix[r, c]
   mat.lr - function(r, c)
   { 
 lr - x[(r.x  r)  (c.x  c)]
 sum(lr)
   }
 
   # get row and column index for each
   # matrix element
   r.x - row(x)
   c.x - col(x)
 
   # return the sum of each matrix[r, c] * sums
   # using mapply to sequence thru each matrix[r, c]
   sum(x * mapply(mat.lr, r = r.x, c = c.x))
 }
 
 # Calculate DIScordant Pairs in a table
 # cycle through x[r, c] and multiply by
 # sum(x elements below and to the left of x[r, c])
 # x = table
 discordant - function(x)
 {
   x - matrix(as.numeric(x), dim(x))
   
   # get sum(matrix values  r AND  c)
   # for each matrix[r, c]
   mat.ll - function(r, c)
   { 
 ll - x[(r.x  r)  (c.x  c)]
 sum(ll)
   }
 
   # get row and column index for each
   # matrix element
   r.x - row(x)
   c.x - col(x)
 
   # return the sum of each matrix[r, c] * sums
   # using mapply to sequence thru each matrix[r, c]
   sum(x * mapply(mat.ll, r = r.x, c = c.x))
 }
 
 
 # Calculate Kendall's Tau-b
 # x = table
 calc.KTb - function(x)
 {
   x - matrix(as.numeric(x), dim(x))
   
   c - concordant(x)
   d - discordant(x)
 
   n - sum(x)
   SumR - rowSums(x)
   SumC - colSums(x)
 
   KTb - (2 * (c - d)) / sqrt(((n ^ 2) -
  (sum(SumR ^ 2))) * ((n ^ 2) -
  (sum(SumC ^ 2
 
   KTb
 }
 
 
 Note that I made some modifications of the above,
 relative to prior
 versions that I have posted to handle large numbers
 of pairs to avoid
 integer overflows in summations. Hence the:
 
   x - matrix(as.numeric(x), dim(x))
 
 conversion in each function.
 
 Now, create some random test data, with 100,000
 elements in each vector,
 sampling from 'letters', which would yield a 26 x 26
 table:
 
  a - sample(letters, 10, replace = TRUE)
  b - sample(letters, 10, replace = TRUE)
  
   dim(table(a, b))
  [1] 26 26
 
   system.time(print(calc.KTb(table(a, b
 [1] 0.0006906088
 [1] 0.77 0.02 0.83 0.00 0.00
 
 Note that in the above, the initial table takes most
 of the time:
 
  system.time(table(a, b))
 [1] 0.55 0.00 0.56 0.00 0.00
 
 Hence:
 
  tab.ab - table(a, b)
  system.time(print(calc.KTb(tab.ab)))
 [1] 0.0006906088
 [1] 0.25 0.01 0.27 0.00 0.00
 
 
 I should note that I also ran:
 
  system.time(print(cor(a, b, method = kendall)))
 [1] 0.0006906088 
 [1] 694.80   7.72 931.89   0.00   0.00 
 
 Nice to know the results work out at least...  :-)
 
 
 I have not tested with substantially larger 2d
 matrices, but would
 envision that as the dimensions of the resultant
 tabulation increases,
 my method probably approaches and may even become
 less efficient than
 the approach implemented in cor(). Some testing
 would validate this and
 perhaps point to coding the concordant() and
 discordant() functions in C
 for improvement in timing.
 
 HTH,
 
 Marc Schwartz
 
 


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


Re: [R] the function of mle

2005-06-28 Thread Liaw, Andy
I'd guess Jun meant the mle() in the stats4 package.  It comes with R, but
is not loaded by default, so one would need to do library(stats4) first.

Andy

 From: Spencer Graves
 
 Did you do install.packages('nlme') and then 
 'library(nlme)' before
 trying to use 'lme'?
 
 spencer graves
 
 Liu Jun wrote:
  Hi,
  I am a user of R computer language.Several days ago,I download 
  R-2.1.0.From the help manual,I saw there is a function 
 mle to find the 
  maximum likelihood estimators.But when I try to use this 
 function,there 
  is no this function.Could you help me to solve this problem?
  I am looking forward to your answer.
  
  Thank you.
  
  Jun Liu
  
  _
  免费下载 MSN Explorer:   http://explorer.msn.com/lccn/
  
  
  
 --
 --
  
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide! 
 http://www.R-project.org/posting-guide.html
 
 -- 
 Spencer 
 Graves, PhD
 Senior Development Engineer
 PDF Solutions, Inc.
 333 West San Carlos Street Suite 700
 San Jose, CA 95110, USA
 
 [EMAIL PROTECTED]
 www.pdf.com http://www.pdf.com
 Tel:  408-938-4420
 Fax: 408-280-7915
 


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

[R] setting yranges of boxplots

2005-06-28 Thread Adrian L. Garcia-Lomana
Hi all,

I was wondering how to create a graph (boxplot) setting the y range of the
graph manually. Something like this:

x - c(1:100)
boxplot(x, yrange(0, 1000))


Thanks for your time,

Adrian

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


Re: [R] setting yranges of boxplots

2005-06-28 Thread Liaw, Andy
Something like this?

boxplot(runif(100, 0, 100), ylim=c(0, 1000))

Andy

 From: Adrian L. Garcia-Lomana
 
 Hi all,
 
 I was wondering how to create a graph (boxplot) setting the y 
 range of the
 graph manually. Something like this:
 
 x - c(1:100)
 boxplot(x, yrange(0, 1000))
 
 
 Thanks for your time,
 
 Adrian
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! 
 http://www.R-project.org/posting-guide.html
 
 


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


[R] looking for the source

2005-06-28 Thread Philip Bermingham
I'm working with the kmeans function in the stats package.  This
function calls complied fortran program:

 

.Fortran(kmns, as.double(x).)

 

Is there a way to get the source code for this compiled program kmns??

 

Philip Bermingham


[[alternative HTML version deleted]]

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


[R] Random Forests theoretical question

2005-06-28 Thread David L. Van Brunt, Ph.D.
I feel like a dope for asking this, but after reading various articles I'm 
still not quite sure I get it. What is the relationship or similarity 
between a probability prediction from a classfication random forest and a 
Bayesian posterior probability? Can they be considered similar, or would I 
need to take that probability and project it through a likelihood (I'm 
thinking, perhaps wrongly, of computing this from the confusion matrix) to 
get a posterior probability?

Something about that feels wrong, and not being a real statistician (Just a 
shrink with some applied stat training) I can't quite connect the dots. 

Before, this, I've been playing with RF as a way to get a feel for what's 
going on in the data, rather than for making any real-world predictions. I 
just don't want to over-interpret (or misinterpret) those probabilities. 
From Breiman's site, this is probably clear to a real statistician, but 
someone like me needs to be clobbered over the head with it :-/.

Wisdom Welcome!

Humbly, 

DVB

[[alternative HTML version deleted]]

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


[R] quick way to construct formula

2005-06-28 Thread Luke
Dear R users,

I have a data with 1000 variables named x1, x2, ..., x1000, and
I want to construct a formula like this format:

~x1+x2+...+x1000+x1:x2+x1:x3+x999:x1000+log(x1)+...+log(x1000)

That is: the base variables followed by all interaction terms and all
base feature log-transformations. I know I can use several paste
functions to construct it. But is there any other handy way to do it?

-Luke

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


Re: [R] looking for the source

2005-06-28 Thread Francisco J. Zagmutt
Off course.  That's the beauty of open source :)
You will find the source code at http://cran.r-project.org/ under R 
Sources.

Cheers

Francisco

From: Philip Bermingham [EMAIL PROTECTED]
To: r-help@stat.math.ethz.ch
Subject: [R] looking for the source
Date: Tue, 28 Jun 2005 22:36:04 -0400

I'm working with the kmeans function in the stats package.  This
function calls complied fortran program:



.Fortran(kmns, as.double(x).)



Is there a way to get the source code for this compiled program kmns??



Philip Bermingham


   [[alternative HTML version deleted]]

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

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


Re: [R] How to convert c:\a\b to c:/a/b

2005-06-28 Thread David Duffy
I couldn't resist adding a more literal answer

unback - function(x) {
  chars - unlist(strsplit(deparse(x),))
  chars - chars[-c(1,length(chars))]
  paste(gsub(,/,chars),collapse=)
}

unback(\n)


| David Duffy (MBBS PhD) ,-_|\
| email: [EMAIL PROTECTED]  ph: INT+61+7+3362-0217 fax: -0101  / *
| Epidemiology Unit, Queensland Institute of Medical Research   \_,-._/
| 300 Herston Rd, Brisbane, Queensland 4029, Australia  GPG 4D0B994A v

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


Re: [R] How to convert c:\a\b to c:/a/b

2005-06-28 Thread Spencer Graves
  Close, but does not work generally with RGui 2.1.1 patched, Windows 
XP:

  unback(x=n\o)
[1] no

  I'm also unable to parse echo, suggested by Ten Harding and Henrik 
Bengtsson:

  echo D:/spencerg/statmtds/R/Rnews tmp.txt
Error: syntax error
  echo cat(gsub(, /, readLines(tmp.txt))) | R --slave
Error: syntax error

  Earlier today, Sundar Dorai-Raj helped me with the following:

  (File0 - file.choose())
[1] D:\\spencerg\\dataPOWER\\stats\\Tukey\\Boxplot_missing_Tukey2.txt
  strsplit(File0, )
[[1]]
[1] D: spencerg
[3] dataPOWER  stats
[5] Tukey  Boxplot_missing_Tukey2.txt

  fp. - strsplit(File0, )[[1]]
  (path - paste(fp.[-length(fp.)], collapse=/))
[1] D:/spencerg/dataPOWER/stats/Tukey
  setwd(path)
  getwd()
[1] D:/spencerg/dataPOWER/stats/Tukey
  File - fp.[length(fp.)]
  File
[1] Boxplot_missing_Tukey2.txt

  Thanks to everyone who has contributed (or even read) this thread. 
I'm confident that a better method exists.

  Best Wishes,
  Spencer Graves

David Duffy wrote:

 I couldn't resist adding a more literal answer
 
 unback - function(x) {
   chars - unlist(strsplit(deparse(x),))
   chars - chars[-c(1,length(chars))]
   paste(gsub(,/,chars),collapse=)
 }
 
 unback(\n)
 
 
 | David Duffy (MBBS PhD) ,-_|\
 | email: [EMAIL PROTECTED]  ph: INT+61+7+3362-0217 fax: -0101  / *
 | Epidemiology Unit, Queensland Institute of Medical Research   \_,-._/
 | 300 Herston Rd, Brisbane, Queensland 4029, Australia  GPG 4D0B994A v
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

-- 
Spencer Graves, PhD
Senior Development Engineer
PDF Solutions, Inc.
333 West San Carlos Street Suite 700
San Jose, CA 95110, USA

[EMAIL PROTECTED]
www.pdf.com http://www.pdf.com
Tel:  408-938-4420
Fax: 408-280-7915

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


Re: [R] sample R code for multiple imputation

2005-06-28 Thread Simon Blomberg
There is also the mice package at http://www.multiple-imputation.com/
which uses mcmc but is different to Schafer's packages.

Simon.

At 09:30 AM 29/06/2005, James Reilly wrote:

Schafer's functions have been ported to R in the packages norm, cat, mix
and pan. Their documentation includes sample code illustrating how to
use them.

The aregImpute function in Hmisc provides a range of other imputation
models, if you're not set on using MCMC. The mitools package might also
be useful for dealing with the imputed values.

Hope this helps,
James

On 29/06/2005 9:32 a.m., David Hwang wrote:
  Hi,
 
  I have a big dataset which has many missing values and want to implement
  Multiple imputation via Monte carlo markov chain by following J Schafer's
  Analysis of incomplete multivariate data. I don't know where to begin
  and is looking for a sample R code that implements multiple imputation
  with EM, MCMC, etc
 
  Any help / suggestion will be greatly appreciated.
 
  David

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

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