Re: [R] Error setting rowname if rowname currently NULL

2009-03-03 Thread Wacek Kusnierczyk
snubian wrote:

snip

 I've noticed a behaviour when using rownames() that I think is odd,
 wondering if I'm doing something wrong.

 To illustrate, say I create a very simple matrix (called fred):

 fred-matrix(,4,2)

 It looks like this:

  [,1] [,2]
 [1,]   NA   NA
 [2,]   NA   NA
 [3,]   NA   NA
 [4,]   NA   NA
   

... and

rownames(fred)
# NULL


 If I now try and set a row name for one of the rows (say the first row) to
 APPLE, by doing this:

 rownames(fred)[1] - APPLE
   

... so now rownames(fred) would have to become a vector of length one,
and you're trying to use a vector of length one to name rows in a matrix
with four rows.  (in principle, you could argue that the vector should
be recycled on such an occassion, as it happens in many other situations.)

hence

 I get an error:

 Error in dimnames(x) - dn : 
   length of 'dimnames' [1] not equal to array extent
   

... because 1 != 4


 However, I found that if I first set all the rownames to anything at all, by
 using say:

 rownames(fred) - c(1:4)
   

... so that length(rownames(fred)) == 4


 Which gives me:

   [,1] [,2]
 1   NA   NA
 2   NA   NA
 3   NA   NA
 4   NA   NA

 Then my desired command works, and thus:

 rownames(fred)[1] - APPLE
   

... whereby you change one element in rownames(fred) and it still has 4
elements


 Gives me what I want:

   [,1] [,2]
 APPLE   NA   NA
 2   NA   NA
 3   NA   NA
 4   NA   NA

 So, what this says to me is that to set the row names INDIVIDUALLY, they
 first need to be set to something (anything!).
   

not exactly true:

fred = matrix(, 4, 2)
rownames(fred)[4] = 'foo'

here you'd set the 4th element of rownames(fred), which fill the first
three with NA, and rownames(fred) has length 4, as needed.


 For what I am doing, I need to set the row names one at a time, as I iterate
 through a loop. 

is it possible that you don't really need it?

vQ

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] [R-pkgs] package ltm -- version 0.9-0

2009-03-03 Thread Dimitris Rizopoulos

Dear R-users,

I'd like to announce the release of the new version of package 'ltm' 
(i.e., ltm_0.9-0 soon available from CRAN) for Item Response Theory 
analyses. This package provides a flexible framework for analyzing 
dichotomous and polytomous data under various IRT models. Furthermore, 
supporting functions for descriptive statistics, goodness-of-fit, 
ability estimation and plotting are available.


New features include:

 * function gpcm() (along with supporting methods, for the generic 
functions, anova, plot, margins, factor.scores, summary, vcov) has been 
added for fitting the Generalized Partial Credit Model. The 'constraint' 
argument of gpcm() can be used to specify constrained versions of the 
model. Options are:


   - 'constraint = rasch' that fits the partial credit model (i.e., 
discrimination parameter fixed at one)


   - 'constraint = 1PL' that specifies a single discrimination 
parameter, equal among items, and


   - 'constraint = gpcm' that specifies a different discrimination 
parameter per item.


 * gpcm() also allows for mixed type items, i.e., dichotomous and 
polytomous; however, for data sets with only dichotomous items, 
functions rasch() and ltm() are more efficient.


 * The new function GoF.gpcm() calculates the Pearson chi-squared 
statistic for Generalized Partial Credit models. A p-value can be also 
produced either using the asymptotic chi-squared distribution or a 
parametric Bootstrap approach.


 * The new function rmvordlogis() can be used to simulate ordinal data 
under the Graded Response and the Generalized Partial Credit models.


 * for more details and other new features check the NEWS file that 
ships with the package.


More information as well as *.R files illustrating the capabilities of 
the package can be found in the R-wiki page of 'ltm' available at: 
http://wiki.r-project.org/rwiki/doku.php?id=packages:cran:ltm.



As always, any kind of feedback (e.g., questions, suggestions, 
bug-reports, etc.) is more than welcome.


Best,
Dimitris

--
Dimitris Rizopoulos
Assistant Professor
Department of Biostatistics
Erasmus University Medical Center

Address: PO Box 2040, 3000 CA Rotterdam, the Netherlands
Tel: +31/(0)10/7043478
Fax: +31/(0)10/7043014

___
R-packages mailing list
r-packa...@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-packages

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Goldbach partitions code

2009-03-03 Thread Robin Hankin

Hi

interesting blog!

not strictly relevant, but there are various
number-theoretic functions implemented
in the elliptic package which
you might find useful.

best wishes

Robin

murali.me...@fortisinvestments.com wrote:

Folks,
 
I put up a brief note describing my naive attempts to compute Goldbach

partitions, starting with a brute-force approach and refining
progressively. 
 
http://jostamon.blogspot.com/2009/02/goldbachs-comet.html
 
I'd welcome your suggestions on improvements, alternatives, other
optimisations, esp. to do with space vs time tradeoffs. 
 
Is this an example interesting enough for pedagogical purposes, do you
think? 
 
Please advise. 
 
Cheers,
 
MM
 


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
  



--
Robin K. S. Hankin
Uncertainty Analyst
University of Cambridge
19 Silver Street
Cambridge CB3 9EP
01223-764877

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Help with Wilcoxon Test

2009-03-03 Thread Jim Lemon

Amit Patel wrote:

Hi
I have 2 sets of data that I want to do a Wilcoxon test on. They are of the 
same dimension. One has 4 zero values and the other has 5.
  

dim(SampA)


[1]  1 10
  

dim(SampV)


[1]  1 10
 
I get the folowing error 

Error in wilcox.test.default(SampA, SampV, na.rm = TRUE, paired = FALSE,  : 
  'x' must be numeric




I am using the function
wilcox.test(SampA, SampV, na.rm=TRUE, paired=FALSE, conf.level=0.95)
  

Hi Amit,
This is probably due to the fact that SampA is not numeric (SampB may be 
the same). When you say zero values, I suspect you may mean NAs, and 
SampA and SampB are read in from a data file of some sort. It's quite 
common for users to assume that an empty field (or even a space or a 
period .) will be read as NA. If this sounds like it may be the 
problem, check the function that you are using to read in the data for 
an na.strings argument, and see if it is what you think it is. If it 
isn't, any column of a resulting data frame will usually come in as a 
factor.


Jim

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Characters To Matrix

2009-03-03 Thread Bob Roberts
Hi,
   I have a data set that I read in using readLines, but R classes it as a 
character string. The data set has multiple columns and rows, but I only want 
the first 2 columns in the form of a matrix. Thanks for the help.



  
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Error loading packages at sprintf()

2009-03-03 Thread Prof Brian Ripley
This is a Mac-specific issue, as you are installing binary packages. 
The real error message was



/bin/sh: line 1: tar: command not found


so the problem is that tar is not in your path.  I've no idea how that 
would come to be (all Macs I have used had /usr/bin/tar), so please 
ask on R-sig-mac.


As far as I can tell, the sprintf message also comes from Mac-specific 
code and I thnk I know how to correct that.  But the real error was 
the one about 'tar'.


On Mon, 2 Mar 2009, Andrew J. Rominger wrote:


Hello all,

I'm running R2.8.1 on a Mac OS 10.4.11.  While trying to install the package 
gdata, I was presented with the following (error at end of report):

R  install.packages(gdata)
also installing the dependency ‘gtools’

trying URL 
'http://cran.stat.ucla.edu/bin/macosx/universal/contrib/2.8/gtools_2.5.0-1.tgz'
Content type 'application/x-tar' length 85484 bytes (83 Kb)
opened URL
==
downloaded 83 Kb

trying URL 
'http://cran.stat.ucla.edu/bin/macosx/universal/contrib/2.8/gdata_2.4.2.tgz'
Content type 'application/x-tar' length 539301 bytes (526 Kb)
opened URL
==
downloaded 526 Kb

/bin/sh: line 1: tar: command not found
2009-03-02 20:42:06.081 R[357] tossing reply message sequence 3 on thread 
0x1ce3ae0
Error in sprintf(gettext(fmt, domain = domain), ...) :
 argument is missing, with no default


I can't figure out why this error is occurring [the error in 
sprintf(gettext(fmt, domain = domain), ...].  I've never been prompted to 
supply arguments to sprintf before.  Upon trying to install various other 
packages (e.g. 'vegan', 'ade4', 'ads'...) I get the same error message 
regarding sprintf.  I recently removed many old data objects from my workspace, 
could I have accidentally messed with sprintf?

In a previous R-help post a similar error resulted while trying to install a package from source, 
and was corrected by specifying type=source, but I'm not really sure how to properly 
specify the argument 'lib' and so leave it as it's default value.  Without specifying 'lib' is it 
appropriate to call type=source?

Thanks in advance for any help--
Andy Rominger

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



--
Brian D. Ripley,  rip...@stats.ox.ac.uk
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@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] regular expression question

2009-03-03 Thread Wacek Kusnierczyk
markle...@verizon.net wrote:
 can someone show me how to use a regular expression to break the
 string at the bottom up into its three components :

 (-0.791,-0.263]
 (-38,-1.24]
 (0.96,2.43]

 I tried to use strplit because of my regexpitis ( it's not curable.
 i've been to many doctors all over NYC. they tell me there's no cure 
 )  but it doesn't work because there also dots inside  the brackets.
 Thanks.

 (-0.791,-0.263].(-38,-1.24].(0.96,2.43]


here's one way to get a matrix of numeric values:
   
text = (-0.791,-0.263].(-38,-1.24].(0.96,2.43]
values = matrix(ncol=2, byrow=TRUE,
as.numeric(
   grep(pattern='.', value=TRUE,
  x=strsplit(x=text, split=']\\.\\(|\\(|]|,')[[1]])))

modify any of the steps according to your needs.

vQ

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Characters To Matrix

2009-03-03 Thread Dieter Menne
Bob Roberts quagmire54321 at yahoo.com writes:

I have a data set that I read in using readLines, but R classes it as a
character string. The data set has
 multiple columns and rows, but I only want the first 2 columns in the form of
a matrix. Thanks for the help.

data(CO2)
str(CO2)
col2 = as.matrix(CO2[,1:2])
str(col2)


Dieter

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] RWeka dataset running

2009-03-03 Thread Dieter Menne
ahmet kocyigit kh3l at hotmail.com writes:
 
 I'm a newbie to R and will work on it from now. I'm preparing my thesis based
on rpart and RWeka. 
 I've managed to run already existing test data but couldn't import a data set
from out of R.
 

There is a special Export/Import manual R-data.pdf in Rxxx/doc/manual.

Dieter

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] regular expression question

2009-03-03 Thread Romain Francois

Wacek Kusnierczyk wrote:

markle...@verizon.net wrote:
  

can someone show me how to use a regular expression to break the
string at the bottom up into its three components :

(-0.791,-0.263]
(-38,-1.24]
(0.96,2.43]

I tried to use strplit because of my regexpitis ( it's not curable.
i've been to many doctors all over NYC. they tell me there's no cure 
)  but it doesn't work because there also dots inside  the brackets.

Thanks.

(-0.791,-0.263].(-38,-1.24].(0.96,2.43]




here's one way to get a matrix of numeric values:
   
text = (-0.791,-0.263].(-38,-1.24].(0.96,2.43]

values = matrix(ncol=2, byrow=TRUE,
as.numeric(
   grep(pattern='.', value=TRUE,
  x=strsplit(x=text, split=']\\.\\(|\\(|]|,')[[1]])))

modify any of the steps according to your needs.

vQ
  

Here is another way with the gsubfn package:

 require( gsubfn )
 strapply( text, \\(.*?,.*?], perl = T )[[1]]
1] (-0.791,-0.263] (-38,-1.24] (0.96,2.43]

Note that gregexpr would also help you here:

 g - gregexpr( \\(.*?,.*?], text, perl = T )[[1]]
 g
[1]  1 17 29
attr(,match.length)
[1] 15 11 11

But there is always the missing part of extracting the match from the 
result of (g)regexpr


 substring( text, g, g + attr(g, match.length ) - 1 )
[1] (-0.791,-0.263] (-38,-1.24] (0.96,2.43]

Romain

--
Romain Francois
Independent R Consultant
+33(0) 6 28 91 30 30
http://romainfrancois.blog.free.fr

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] New mailing list: R-help-es

2009-03-03 Thread UsuarioR España

Hi all, 

I am writing to announce the creation of a new R
mailing list: R-help-es. It is going to be a list for spanish speakers
users of R so I am sorry to write the rest of the email in spanish.




Os escribo para anunciaros que hemos creado una nueva
lista de correo llamada R-help-es para usuarios de R hispanohablantes
en respuesta a la creciente comunidad de usuarios en España y
Latinoamérica.


La lista está orientada aquellas noticias, acontecimientos, ofertas
laborales, etc. de interés para la comunidad hispanoparlante únicamente
y para aquellos que necesiten ayuda y tengan dificultades con el
ingles. No se trata de solapar contenidos con ninguna de las otras
listas que ya existen. 


Somos conscientes de que existe un creciente interés por R en todo
el mundo y creemos que la descentralización de alguna información como
ofertas de empleo locales, y cursos en castellano puede ser muy
interesante para alguno de nosotros y para el mejor funcionamiento de
la comunidad de R. 


Se va a abrir un hilo en la nueva lista para plantear posibilidades
mas ambiciosas la como creación de un portal para la comunidad de
usuarios de R en español, con el objetivo
de conocernos, intercambiar recursos y en definitiva dar apoyo y ser un
referente de usuarios en España y Latinoamérica.

Para subscribiros a la nueva lista, tan solo tenéis que ir a este enlace: 
https://stat.ethz.ch/mailman/listinfo/r-help-es


Os esperamos ahí, un saludo a todos.
_
Descubre todas las formas en que puedes estar en contacto con amigos y 
familiares.

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Inefficiency of SAS Programming

2009-03-03 Thread Gerard M. Keogh
Ajay,

I think this is somewhat unnecessary!

For regular SAS users PROC SUMMARY/MEANS is the data manipulation staple. A
SAS user interested in R will look at Intro to R and find it recommends
tapply for data manipulation jobs. This is a problem - tapply just isn't
simple and obvious.

A better option would be for the Intro to R to link to Bob Muenchen's
original 80-page document R for SAS and SPSS users, page 52 where the
summarize function is described.

Gerard



   
 Ajay ohri 
 ohri2...@gmail.c 
 omTo 
   Greg Snow greg.s...@imail.org 
 03/03/2009 04:58   cc 
   Gerard M. Keogh   
   gmke...@justice.ie,   
   r-help-boun...@r-project.org  
   r-help-boun...@r-project.org, R   
   list r-h...@stat.math.ethz.ch 
   Subject 
   Re: [R] Inefficiency of SAS 
   Programming 
   
   
   
   
   
   




for an  inefficient  language , it sure has dominated the predictive
analytics world for 3 plus decades.

I referred once to intellectual jealousy between newton and liebnitz.

i am going ahead and creating the R package called Anne.

It basically is meant only for SAS users who want to learn R ,
without upsetting the schedule of the corporate users.

Simply put , it is a wrapper on SAS language using the function
command...ie procunivariate function in Anne package would call the
summary function and so on...

Regards,

Ajay

www.decisionstats.com

On Tue, Mar 3, 2009 at 9:20 AM, Greg Snow greg.s...@imail.org wrote:
  This does not really address my point.  Yes, if the few nerds who want to
  do funny stuff are the ones making the purchase, then there is a good
  chance (but still not guaranteed) that they will get IML, but do all
  companies that buy SAS actually think about that, or do they just see the
  extra price (no matter how low), or not even think to look at that piece
  because the person making the purchase does not really the funny things
  you can do with it.

  If you want your SAS code to be able to be run by anyone with SAS, you
  cannot assume that they have IML.  If you want your R code to be run by
  anyone, you cannot make your code dependent on packages/tools that are
  not available for all platforms.

  --
  Gregory (Greg) L. Snow Ph.D.
  Statistical Data Center
  Intermountain Healthcare
  greg.s...@imail.org
  801.408.8111


   -Original Message-
   From: Gerard M. Keogh [mailto:gmke...@justice.ie]
   Sent: Monday, March 02, 2009 3:22 AM
   To: Greg Snow
   Cc: Frank E Harrell Jr; R list; r-help-boun...@r-project.org
   Subject: Re: [R] Inefficiency of SAS Programming
  
   Yes Greg,
  
   but if you're buying SAS they'll throw in IML pretty cheaply - SAS
   think
   it's only for a few nerds out there who wan to do funny stuff.
  
   G
  
  
  
                Greg Snow
                greg.s...@imail.
                org
   To
                Sent by:                  Gerard M. Keogh
                r-help-boun...@r-         gmke...@justice.ie, Frank E
                project.org               Harrell Jr
                                          f.harr...@vanderbilt.edu
  
   cc
                27/02/2009 19:05          r-help-boun...@r-project.org
                                          r-help-boun...@r-project.org,
   R
                                          list r-h...@stat.math.ethz.ch
  
   Subject
                                          Re: [R] Inefficiency of SAS
                                          Programming
  
  
  
  
  
  
  
  
  
  
   But SAS/IML is not part of base SAS, it costs extra, so there is a good
   chance that a user that has SAS will not be able to run code that uses
   SAS/IML.
  
   I have known of SAS programmers who know IML well that still write
   matrix/vector tools using macros or proc transpose so that a user
   without
   IML can still use the code (the fact that the code that 

Re: [R] Inefficiency of SAS Programming

2009-03-03 Thread Jim Lemon

Ajay ohri wrote:

for an  inefficient  language , it sure has dominated the predictive
analytics world for 3 plus decades.
I referred once to intellectual jealousy between newton and liebnitz.

i am going ahead and creating the R package called Anne.
  

If you want to market this, Ajay, I'd suggest a name like SASsieR.

Jim

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Inefficiency of SAS Programming

2009-03-03 Thread Ajay ohri
Ok. Basically everything that SAS can do, R can do, but vice versa isnt
true.
using the Anne package just renames the functions into standardized data
and proc steps for user comfort.

Once SAS user finds that R is productive , and useful and even more powerful
for even less money, he can unload the Anne Package , and move straight
away into R like intro of R'


It is also a good personal exercise for me to learn how to create R
packages.


 Jai ho !!!

Ajay

You can read more on this concept idea here  (note

it is an idea not a package now-- and so i have posted on it)

http://www.decisionstats.com/2009/03/an-r-package-only-for-sas-users/






On Tue, Mar 3, 2009 at 10:28 AM, Ajay ohri ohri2...@gmail.com wrote:

 for an  inefficient  language , it sure has dominated the predictive
 analytics world for 3 plus decades.
 I referred once to intellectual jealousy between newton and liebnitz.

 i am going ahead and creating the R package called Anne.

 It basically is meant only for SAS users who want to learn R ,
 without upsetting the schedule of the corporate users.

 Simply put , it is a wrapper on SAS language using the function
 command...ie procunivariate function in Anne package would call the
 summary function and so on...

 Regards,

 Ajay

 www.decisionstats.com- Show quoted text -


 On Tue, Mar 3, 2009 at 9:20 AM, Greg Snow greg.s...@imail.org wrote:

 This does not really address my point.  Yes, if the few nerds who want to
 do funny stuff are the ones making the purchase, then there is a good chance
 (but still not guaranteed) that they will get IML, but do all companies that
 buy SAS actually think about that, or do they just see the extra price (no
 matter how low), or not even think to look at that piece because the person
 making the purchase does not really the funny things you can do with it.

 If you want your SAS code to be able to be run by anyone with SAS, you
 cannot assume that they have IML.  If you want your R code to be run by
 anyone, you cannot make your code dependent on packages/tools that are not
 available for all platforms.

 --
 Gregory (Greg) L. Snow Ph.D.
 Statistical Data Center
 Intermountain Healthcare
 greg.s...@imail.org
 801.408.8111


  -Original Message-
  From: Gerard M. Keogh [mailto:gmke...@justice.ie]
  Sent: Monday, March 02, 2009 3:22 AM
  To: Greg Snow
  Cc: Frank E Harrell Jr; R list; r-help-boun...@r-project.org
  Subject: Re: [R] Inefficiency of SAS Programming
 
  Yes Greg,
 
  but if you're buying SAS they'll throw in IML pretty cheaply - SAS
  think
  it's only for a few nerds out there who wan to do funny stuff.
 
  G
 
 
 
   Greg Snow
   greg.s...@imail.
   org
  To
   Sent by:  Gerard M. Keogh
   r-help-boun...@r- gmke...@justice.ie, Frank E
   project.org   Harrell Jr
 f.harr...@vanderbilt.edu
 
  cc
   27/02/2009 19:05  r-help-boun...@r-project.org
 r-help-boun...@r-project.org,
  R
 list r-h...@stat.math.ethz.ch
 
  Subject
 Re: [R] Inefficiency of SAS
 Programming
 
 
 
 
 
 
 
 
 
 
  But SAS/IML is not part of base SAS, it costs extra, so there is a good
  chance that a user that has SAS will not be able to run code that uses
  SAS/IML.
 
  I have known of SAS programmers who know IML well that still write
  matrix/vector tools using macros or proc transpose so that a user
  without
  IML can still use the code (the fact that the code that started this
  thread
  was found on a website, suggests that it was meant for general use
  rather
  than something only used internally where you know what add-ons will be
  available).
 
  Just another way that R makes life easier for both programmer and user.
 
 
  --
  Gregory (Greg) L. Snow Ph.D.
  Statistical Data Center
  Intermountain Healthcare
  greg.s...@imail.org
  801.408.8111
 
 
   -Original Message-
   From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
   project.org] On Behalf Of Gerard M. Keogh
   Sent: Friday, February 27, 2009 7:19 AM
   To: Frank E Harrell Jr
   Cc: r-help-boun...@r-project.org; R list
   Subject: Re: [R] Inefficiency of SAS Programming
  
   Yes Frank, I accept your point but nevertheless IML is the proper
  place
   for
   matrix work in SAS - mixing macro-level logic and computation is
   another
   question - R is certainly more seemless in this respect.
  
   Gerard
  
  
  
Frank E Harrell
Jr
f.harr...@vander
   To
bilt.edu Gerard M. Keogh
  gmke...@justice.ie
27/02/2009 13:55
   cc
  R list r-
   h...@stat.math.ethz.ch,
   

[R] select nls starting values from list was: nls does not accept start values

2009-03-03 Thread Petr PIKAL
Hallo

Here is my final solution, but i still wonder if it could not be 
improved somehow.

fit - modely(fol, data.frame(x=x, y=y1)
fit
or 
fit - modely(fol, data.frame(x=x, y=y2)
fit

shows that it arrives to some results. However selection starting values 
as means of response variable seems to me suboptimal.
Is it possible to have some list of functions which will for each item in 
formula list  compute starting values for nls? Or is it this mean guess as 
good as any other?

Petr
petr.pi...@precheza.cz


# formulas
fol - list(y~1/(a-x), y~a*x^2+b*log(x))
set.seed(111)
x-1:10
y1 - 1/(0.5-x) +rnorm(length(x))/10
y2 - 2*x^2 + 3*log(x) + rnorm(length(x))

# here is a function

modely - function(formula, data, ...){
ll - length(formula) # no of items in formula list

# initiation of vectors
result2 - vector(list, ll)
result1 - rep(NA, ll)

for(i in 1:ll) {

# some start values ***this shall be improved somehow***
n - length(all.vars(fol[[i]])) - 2
start - as.list(rep(mean(data[,2]),n))
names(start) - letters[1:n]

# fit
fit-try(nls(formula[[i]], data, start))
if( class(fit)==try-error) result1[i] - NA  else result1[i] - 
sum(resid(fit)^2)
if( class(fit)==try-error) result2[[i]] - NA  else result2[[i]] - 
coef(fit)
}

# ordering and combining results
ooo-order(result1)
result - mapply(c, sq.resid = result1, result2)
names(result) - as.character(formula)
result[ooo]
}


Uwe Ligges lig...@statistik.tu-dortmund.de napsal dne 02.03.2009 
10:54:16:

 
 
 Petr PIKAL wrote:
  Thank you
  
  It was simplified version of my problem. I want to elaborate a 
function 
  which can take predefined list of formulas, some data and evaluate 
which 
  formulas can fit the data. I was inspired by some article in Chemical 
  engineering in which some guy used excel solver for such task. I was 
  curious if I can do it in R too. I am not sure if nls is appropriate 
tool 
  for such task but I had to start somewhere.
  
  Here is a function which takes list of formulas and data and gives a 
  result for each formula.
  
  modely - function(formula, data, ...){
  ll - length(formula)   #no of items in formula list
  result2 - vector(list, ll) #prepare results
  result1 - rep(NA, ll)
  for(i in 1:ll) {
  fit-try(nls(formula[[i]], data))
  if( class(fit)==try-error) result1[i] - NA  else result1[i] - 
  sum(resid(fit)^2)
  if( class(fit)==try-error) result2[[i]] - NA  else result2[[i]] - 
  coef(fit)
  }
  
  ooo-order(result1) #order results according to residual sum
  
  #combine results into one list together with functions used
  
  result - mapply(c, sq.resid = result1, result2) 
  names(result) - as.character(formula)
  # output
  result[ooo]
  }
  
  # data
  x -1:10
  y -1/(.5-x)+rnorm(10)/100
  
  # list of formulas
  fol - structure(list(a = y ~ 1/(a - x), b = y ~ a * x^2 + b * log(x), 

  c = y ~ x^a), .Names = c(a, b, c))
  
  modely(fol, data.frame(x=x, y=y)
  
  does not use correct model because when using default start values 
it 
  results in
  
  nls(fol[[1]], data.frame(x=x, y=y))
  Error in numericDeriv(form[[3]], names(ind), env) : 
Missing value or an infinity produced when evaluating the model
  
  however
  
   nls(fol[[1]], data.frame(x=x, y=y), start=list(a=mean(y)))
  
  gives correct result. Therefore I started think about how to add a 
  better starting value for some fits as a second part of my formula 
list 
  to define structure like
  
  list(a= formula1, start.formula1, b=formula2, start.formula2, )
  
  I wonder If you can push me to better direction.
 
 
 You can make up a list of lists (each containing one formula and its 
 starting values) or specify formulas in one list and starting values in 
 a corresponding second list.
 You need just the corresponding subsetting in your call to nls such as 
 in the simple case I suggested already.
 
 Best,
 Uwe
 
 
 
  Thanks again
  Best regards
  Petr
  
  
  
  
  Uwe Ligges lig...@statistik.tu-dortmund.de napsal dne 02.03.2009 
  09:41:45:
  
  Petr PIKAL wrote:
  Hi to all
 
  OK as I did not get any response and I really need some insight I 
try 
  again with different subject line
 
  I have troubles with correct evaluating/structure of nls input
 
  Here is an example
 
  # data
  x -1:10
  y -1/(.5-x)+rnorm(10)/100
 
  # formula list
  form - structure(list(a = list(quote(y ~ 1/(a - x)), 
  list(a=mean(y, 
   .Names = a)
 
  # This gives me an error due to not suitable default starting value
 
  fit - nls(form [[1]] [[1]], data.frame(x=x, y=y))
 
  # This works and gives me a result
 
  fit - nls(form [[1]] [[1]], data.frame(x=x, y=y), 
  start=list(a=mean(y)))
  *** How to organise list form and call to nls to enable to use 
other 
  
  then default starting values***.
 
  I thought about something like
 
  fit - nls(form [[1]] [[1]], data.frame(x=x, y=y), start=get(form 
  [[1]] 
  [[2]]))
  ^^^ 
  but this gives me an error so it is not correct syntax. (BTW I tried 

  eval, 
  assign, sustitute, 

Re: [R] Inefficiency of SAS Programming

2009-03-03 Thread Ajay ohri
no market for R packages exists in true economic sense
 as there is demand and supply and utility but no price

Ajay

Did Tom Sawyer create the first collaborative project ever ( to paint the
fence ?)



On Tue, Mar 3, 2009 at 4:24 PM, Jim Lemon j...@bitwrit.com.au wrote:

 Ajay ohri wrote:

 for an  inefficient  language , it sure has dominated the predictive
 analytics world for 3 plus decades.
 I referred once to intellectual jealousy between newton and liebnitz.

 i am going ahead and creating the R package called Anne.


 If you want to market this, Ajay, I'd suggest a name like SASsieR.

 Jim



[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Arbirtrary column names with write.csv

2009-03-03 Thread Rafael Laboissiere
Is there a way to prevent write.csv to transform the column names a la
make.names?  I mean, if I write the code:

x - structure (NULL)
x [[a+b]] - c (1,2)
write.csv (x, file = foo.csv, row.names = FALSE, quote = FALSE)

I get in foo.csv:

a.b
1
2

but I want:

a+b
1
2

Any suggestions?

Cheers,

-- 
Rafael Laboissiere

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] monotonic GAM with more than one term

2009-03-03 Thread Simon Wood
There's an example at the end of the pcls help file in version 1.5-0 --- just 
submitted to CRAN.

best,
Simon

On Wednesday 25 February 2009 18:48, Benjamin Tyner wrote:
 Hi,

 Does anyone know how to fit a GAM where one or more smooth terms are
 constrained to be monotonic, in the presence of by variables or
 other terms? I looked at the example in ?pcls but so far have not been
 able to adapt it to the case where there is more than one predictor.
 For example,

 require(mgcv)

 set.seed(0)
 n-100


 # Generate data from a monotonic truth.
 x-runif(100)*4-1
 x-sort(x)

 m - structure(rep(1:2,50), .Label=c(one,two), class=factor)

 f-as.integer(m) * exp(4*x)/(1+exp(4*x))
 y-f+rnorm(100)*0.1
 plot(x,y,xlim=c(min(x), max(x)*2))
 dat-data.frame(x=x,m=m,y=y)



 # Show regular spline fit (and save fitted object)
 f.ug-gam(y~m+s(x,k=10,by=m,bs=cr))

 bool - m==one
 yhat - fitted(f.ug)

 lines(x[bool],yhat[bool])
 lines(x[!bool],yhat[!bool])

 xx - seq(max(x), 2*max(x), length=100)
 mm - structure(rep(1:2,50), .Label=c(one,two), class=factor)
 yy - predict(f.ug, newdata=data.frame(m=mm,x=xx))

 bool - mm==one

 lines(xx[bool],yy[bool], lty=2) # show effect of extrapolation
 lines(xx[!bool],yy[!bool], lty=2)


 # this is where I start running into trouble
sm-smoothCon(s(x,k=10,by=m,bs=cr),dat,knots=NULL)[[1]]
FF-mono.con(sm$xp);   # get constraints
G-list(y=y,
w=rep(1, n),
X=sm$X,
C=matrix(0,0,0),
S = sm$S,
off = 0,
sp=f.ug$sp,
p=sm$xp,
Ain = FF$A,
bin = FF$b
)


 p-pcls(G)  # fit spline (using s.p. from unconstrained fit)
 fv-Predict.matrix(sm,data.frame(x=x))%*%p

 # can we do this without calling smoothCon directly ?
 # also having trouble here.
f.nofit-gam(y~m+s(x,k=10,by=m,bs=cr),fit=FALSE)
FF2 - mono.con(f.nofit$smooth[[1]]$xp)

stopifnot(identical(FF, FF2))

G2 - list(y = f.nofit$y,
   w = f.nofit$w,
   X = f.nofit$X,
   C = f.nofit$C,
   S = f.nofit$smooth[[1]]$S,
   off = f.nofit$off,
   sp = f.ug$sp,
   p = f.nofit$smooth[[1]]$xp,
   Ain = FF2$A,
   bin = FF2$b
   )

 p2 - pcls(G2)
 fv2-Predict.matrix(f.nofit$smooth[[1]],data.frame(x=x))%*%p2



 Many thanks
 -Ben

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html and provide commented, minimal,
 self-contained, reproducible code.

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

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] barplot with specific order of x axis labels

2009-03-03 Thread Paul Hiemstra

sort.df() in the reshape packge.

cheers,
Paul

R User R User wrote:

Hi all,
I'd appreciate your help with this problem.

I need to plot a barplot with the categories in a specific order. My data
might be:

hours Freq
AN 10
MO 14
LU  30

I need the categories to be in the order:
MO LU AN

Is there some way to pass sort the dataset into this order so that it plots
correctly when passed to barplot()?

Thanks very much,
Richie

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
  



--
Drs. Paul Hiemstra
Department of Physical Geography
Faculty of Geosciences
University of Utrecht
Heidelberglaan 2
P.O. Box 80.115
3508 TC Utrecht
Phone:  +3130 274 3113 Mon-Tue
Phone:  +3130 253 5773 Wed-Fri
http://intamap.geo.uu.nl/~paul

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] R - MATLAB apply like function

2009-03-03 Thread ARDIA David
Dear all,
I very often use the R function apply, for speedup purposes. I am now also 
using MATLAB, and would like to use the same kind of function.
I have already asked MATLAB people, and the answer is : vectorize... but of 
course, this is not always possible. So, instead of using
a FOR loop all the time, I tried using the bsxfun. So you R people, who might 
also use MATLAB, do you have any solution? Are you also nervous 
about this fact (maybe also because of this R-MATLAB question).
Thanks for your help,
Dave 

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Self-Organizing Map analysis

2009-03-03 Thread glaporta

Dear list,
I read the SOM package manual but I don't understand how to perform (for
example) 1) the SOM analysis on Iris data 2) with a visualization similar to
that of figure 7 in
http://www.cis.hut.fi/projects/somtoolbox/package/papers/techrep.pdf

Any suggestion? Thanks in advance,
Gianandrea
-- 
View this message in context: 
http://www.nabble.com/Self-Organizing-Map-analysis-tp22306689p22306689.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] survival::survfit,plot.survfit

2009-03-03 Thread Bernhard Reinhardt
You are right. In my case it doesn´t make much difference since the mean 
of my covariates is about 0.


I made some more plots and again I´m confused. I thought when forcing 
all covariates via the newdata  argument to be zero I would get the 
baseline function since the linear predictor is then zero, too.


As I pointed out in another post I´m trying out models with different 
number of covariates on the same data. For example I use a model with 
only one covariate. The mean of this covariate is 0.01. So the curves of


surv - survfit(coxsst4_full)
and

attach(nino4)
newS4 - data.frame(S5=0.)
detach()
new_surv - survfit(coxsst4, newdata=newS4)

differ very slightly.

Of course also the mean curves for models with more then one covariate 
differe slightly from the Zero-curve.


BUT shouldn´t the Zero-curves for all models be the same?

#Two models
coxsst4 - coxph(Surv(schaeden)~ S5, data=nino4)
coxsst4_full  - coxph(Surv(schaeden)~ 0+S1+S2+S3+S4+S5+S6+S7+S8+S9+S10, 
data=nino4)


#Set all covariates 0
attach(nino4)
newS4 - data.frame(S0=0., S1=0., S2=0., S3=0., S4=0., S5=0., S6=0., 
S7=0., S8=0., S9=0., S10=0.)

detach()

new_surv1 - survfit(coxsst4, newdata=newS4)
new_surv2 - survfit(coxsst4_full, newdata=newS4)

Yields two different curves. What did I get wrong?

Regards

Bernhard


Terry Therneau wrote:

plot(survfit(fit)) should plot the survival-function for x=0 or 
equivalently beta'=0. This curve is independent of any covariates.


  This is not correct.  It plots the curve for a hypothetical subject with x= 
mean of each covariate.  
  This is NOT the average survival of the data set.  Imagine a cohort made up 
of 60 year old men and their 10 year old grandsons: the expected survival of 
this cohort does not look that for a 35 year old male.
  
  	Terry T




__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Inefficiency of SAS Programming

2009-03-03 Thread Barry Rowlingson
2009/3/3 Jim Lemon j...@bitwrit.com.au:
 Ajay ohri wrote:

 for an  inefficient  language , it sure has dominated the predictive
 analytics world for 3 plus decades.
 I referred once to intellectual jealousy between newton and liebnitz.

 i am going ahead and creating the R package called Anne.


 If you want to market this, Ajay, I'd suggest a name like SASsieR.

 Nice name. I'd call it 'Ursas', which works on several levels:

 1. U-R-SAS.  (pun on You Are SAS, or You R-SAS)

 2. Ur-SAS. (Germanic prefix Ur- meaning 'proto' or 'primitive')[1]

 3. Ursas (from Latin 'Ursa' meaning 'bear', because it seems very few
R users can bear SAS)

Barry

[1] http://en.wiktionary.org/wiki/ur-

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] regular expression question

2009-03-03 Thread Gabor Grothendieck
Here are two solutions using gsubfn package.
strapply works by matching the what you want
rather than what you don't want which may make
it easier in this case.  The two solutions are the
same except we use \\ escapes in the first and
[ ... ] in the second, i.e. \\( has the same effect
as [(].   In each case we first match the ( then
a sequence of characters that is not ] and finally
we match the terminating ].

 library(gsubfn)
 x - (-0.791,-0.263].(-38,-1.24].(0.96,2.43]

 strapply(x, \\([^]]+[]])[[1]]
[1] (-0.791,-0.263] (-38,-1.24] (0.96,2.43]

 strapply(x, [(][^]]+[]])[[1]]
[1] (-0.791,-0.263] (-38,-1.24] (0.96,2.43]


On Tue, Mar 3, 2009 at 1:16 AM,  markle...@verizon.net wrote:
 can someone show me how to use a regular expression to break the string at
 the bottom up into its three components :

 (-0.791,-0.263]
 (-38,-1.24]
 (0.96,2.43]

 I tried to use strplit because of my regexpitis ( it's not curable. i've
 been to many doctors all over NYC. they tell me there's no cure  )  but it
 doesn't work because there also dots inside  the brackets. Thanks.

 (-0.791,-0.263].(-38,-1.24].(0.96,2.43]

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Question about multiple plots of zoo objects

2009-03-03 Thread Sergey Goriatchev
Hello, everyone

I have a zoo object containing several time series of daily frequency.
One of these timeseries is an indicator function with value (-1) at
certain times, and (+1) at the other.
I do a plot of several of the timeseries in one go (a multiple plot).
I wonder if I can automatically in EACH plot color the area where
indicator variable is (-1)?

Of course, I could do it simply with layout() and then for each
timeseries do plot and a color overlay, but I wonder if with
plot.zoo() simething similar is possible to do automatically.

Thanks in advance for help!

Best,
Sergey

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] calculating standard deviation and variance

2009-03-03 Thread johnhj

Hiii,

I have some problems to plot standard deviation and variance from a
texfile.

Ich have the following code so far:

x -read.table(file=new.txt)   

x$gruppe - 100*rep(1:36, each=20)

png(filename = D:/Uni/new.png, width = 640, height = 480,pointsize = 12,
bg = white)

boxplot(V3 ~ gruppe, data = x, col = blue,boxwex=0.7,ylab
=Datenrate(MBit(sec)),xlab = Zeit(sec))

dev.off() 

My question is, how can I plot the standard deviation and variance of
x$gruppe - 100*rep(1:36, each=20)

Can anybody help me please ?

greetings,
johnh
-- 
View this message in context: 
http://www.nabble.com/calculating-standard-deviation-and-variance-tp22306851p22306851.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] xlsReadWrite package repository for Ubuntu

2009-03-03 Thread Ben Bolker



reverend33 wrote:
 
 I'm sorry, maybe i didn't explain clearly: i'm trying to install
 xlsReadWrite on a Linux-type OS (Ubuntu)...
 

I think you didn't understand the answers: the package is only available
under Windows.

  cheers
   Ben Bolker
-- 
View this message in context: 
http://www.nabble.com/xlsReadWrite-package-repository-for-Ubuntu-tp22283704p22308383.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Characters To Matrix

2009-03-03 Thread jim holtman
Why aren't you using 'read.table'?

On Tue, Mar 3, 2009 at 3:47 AM, Bob Roberts quagmire54...@yahoo.com wrote:
 Hi,
   I have a data set that I read in using readLines, but R classes it as a 
 character string. The data set has multiple columns and rows, but I only want 
 the first 2 columns in the form of a matrix. Thanks for the help.




        [[alternative HTML version deleted]]

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.




-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Question about multiple plots of zoo objects

2009-03-03 Thread Gabor Grothendieck
Are you trying to color the points themselves?   This plots the
first two series in frame 1 (they are the same but one is plotted
as points and the  other as a line) and the third series is shown
in frame 2 and for the series of points it colors them green or red.
The lines are all colored black:

library(zoo)
set.seed(1)
x - zoo(rnorm(10))
s - sign(x)

plot(cbind(x, x, s), screen = c(1, 1, 2), type = c(p, l, l),
  col = list(ifelse(s  0, green, red), 1, 1), pch = 20)



On Tue, Mar 3, 2009 at 7:48 AM, Sergey Goriatchev serg...@gmail.com wrote:
 Hello, everyone

 I have a zoo object containing several time series of daily frequency.
 One of these timeseries is an indicator function with value (-1) at
 certain times, and (+1) at the other.
 I do a plot of several of the timeseries in one go (a multiple plot).
 I wonder if I can automatically in EACH plot color the area where
 indicator variable is (-1)?

 Of course, I could do it simply with layout() and then for each
 timeseries do plot and a color overlay, but I wonder if with
 plot.zoo() simething similar is possible to do automatically.

 Thanks in advance for help!

 Best,
 Sergey

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] xlsReadWrite package repository for Ubuntu

2009-03-03 Thread Gabor Grothendieck
If your purpose is to read Excel spreadsheets on Linux read.xls in the gdata
packages can do that.  It uses perl software underneath which is portable
across systems.

On Tue, Mar 3, 2009 at 7:38 AM, reverend33 periac_r...@hotmail.com wrote:

 I'm sorry, maybe i didn't explain clearly: i'm trying to install xlsReadWrite
 on a Linux-type OS (Ubuntu)...





 Uwe Ligges-3 wrote:



 reverend33 wrote:
 Hi,

 I'm trying to install R on Ubuntu.
 I succeeded at installing the r-recommended package that is present in
 the
 synaptics, but i can't find the xlsReadWrite package in the repositories
 included in my synaptics manager.
 Does anybody know a liable repository in which this package is present.

 If you consider the CRAN master to be liable, it tells you for
 xlsReadWrite:

 OS_type:      windows

 Moreover it tells you that the package's status for R-devel is ERROR.


 Uwe Ligges



 Thanks in advance

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.



 --
 View this message in context: 
 http://www.nabble.com/xlsReadWrite-package-repository-for-Ubuntu-tp22283704p22307883.html
 Sent from the R help mailing list archive at Nabble.com.

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Question about multiple plots of zoo objects

2009-03-03 Thread Sergey Goriatchev
Hi, Gabor

No, what I am trying to do is similar to:
abline(v=time(spread)[spread[,Indicator]==(-1)], col=yellow),

where spread is the multivariate zoo object (say, 5 timeseries).

That is, I want to color parts of the plots where indicator==(-1), but
do the coloring
without using layout() and then repeating plot() and abline() for each
of the 5 timeseries.

Best,
Sergey


On Tue, Mar 3, 2009 at 14:22, Gabor Grothendieck
ggrothendi...@gmail.com wrote:
 Are you trying to color the points themselves?   This plots the
 first two series in frame 1 (they are the same but one is plotted
 as points and the  other as a line) and the third series is shown
 in frame 2 and for the series of points it colors them green or red.
 The lines are all colored black:

 library(zoo)
 set.seed(1)
 x - zoo(rnorm(10))
 s - sign(x)

 plot(cbind(x, x, s), screen = c(1, 1, 2), type = c(p, l, l),
  col = list(ifelse(s  0, green, red), 1, 1), pch = 20)



 On Tue, Mar 3, 2009 at 7:48 AM, Sergey Goriatchev serg...@gmail.com wrote:
 Hello, everyone

 I have a zoo object containing several time series of daily frequency.
 One of these timeseries is an indicator function with value (-1) at
 certain times, and (+1) at the other.
 I do a plot of several of the timeseries in one go (a multiple plot).
 I wonder if I can automatically in EACH plot color the area where
 indicator variable is (-1)?

 Of course, I could do it simply with layout() and then for each
 timeseries do plot and a color overlay, but I wonder if with
 plot.zoo() simething similar is possible to do automatically.

 Thanks in advance for help!

 Best,
 Sergey

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.





-- 
I'm not young enough to know everything. /Oscar Wilde
Experience is one thing you can't get for nothing. /Oscar Wilde
When you are finished changing, you're finished. /Benjamin Franklin
Tell me and I forget, teach me and I remember, involve me and I learn.
/Benjamin Franklin
Luck is where preparation meets opportunity. /George Patten

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] xlsReadWrite package repository for Ubuntu

2009-03-03 Thread Marc Schwartz
You perhaps missed the key point in Uwe's response, which is that the
package is only available under Windows, as it depends upon Windows
specific functionality (MS Office API via a third party library which is
available for Windows only) to natively read and write Excel files.
Thus, there is no package version available for Linux, or OSX for that
matter.

If you need to read Excel files under Linux, you could look at the
read.xls() function in the 'gdata' CRAN package. This package requires
that Perl be installed, as it calls a Perl routine (xls2csv) for
converting the Excel file to a CSV file, which can then be read into R.

If you need to write Excel files under Linux, you can use a Perl routine
that I had posted back in 2007:

  https://stat.ethz.ch/pipermail/r-help/2007-July/135968.html

and have updated since then to handle Unicode issues. I am attaching a
2k text file here with the updated routine.

HTH,

Marc Schwartz

on 03/03/2009 06:38 AM reverend33 wrote:
 I'm sorry, maybe i didn't explain clearly: i'm trying to install xlsReadWrite
 on a Linux-type OS (Ubuntu)...
 
 
 
 
 
 Uwe Ligges-3 wrote:


 reverend33 wrote:
 Hi,

 I'm trying to install R on Ubuntu.
 I succeeded at installing the r-recommended package that is present in
 the
 synaptics, but i can't find the xlsReadWrite package in the repositories
 included in my synaptics manager.
 Does anybody know a liable repository in which this package is present.
 If you consider the CRAN master to be liable, it tells you for
 xlsReadWrite:

 OS_type: windows

 Moreover it tells you that the package's status for R-devel is ERROR.


 Uwe Ligges
#!/usr/bin/perl -w

# Called as: WriteXLS.pl [--CSVpath] [--CSVfiles] ExcelFileName

# Spreadsheet::WriteExcel 
# 
http://search.cpan.org/~jmcnamara/Spreadsheet-WriteExcel/lib/Spreadsheet/WriteExcel.pm

# Excel 2007specifications and limitations
# http://office.microsoft.com/en-us/excel/HP100738491033.aspx

# For unicode issues:
# http://www.ahinea.com/en/tech/perl-unicode-struggle.html

use strict;

use Spreadsheet::WriteExcel;
use Getopt::Long;
use File::Glob;
use File::Basename;
use Text::CSV_XS;
use Encode;


# Initialize and get command line arguments
my $CSVPath = '.';
my $CSVFiles = *.csv;

GetOptions ('CSVpath=s' = \$CSVPath, 
'CSVfiles=s' = \$CSVFiles);

my $ExcelFileName = $ARGV[0];


# Create Excel XLS File
print Creating Excel File: $ExcelFileName\n\n;
my $XLSFile  = Spreadsheet::WriteExcel-new($ExcelFileName);


# Glob file path and names
my @FileNames = $CSVPath/$CSVFiles;


foreach my $FileName (@FileNames) {

  print Reading: $FileName\n;

  # Open CSV File
  my $csv = Text::CSV_XS-new ({ binary = 1 });
  open (CSVFILE, $FileName) || die ERROR: cannot open $FileName. $!\n;

  # Create new sheet with filename prefix
  # ($base, $dir, $ext) = fileparse ($FileName, '..*');
  my $FName = (fileparse ($FileName, '\..*'))[0];

  # Only take the first 31 chars, which is the
  # limit for a worksheet name
  my $SheetName = substr($FName, 0, 31);

  print Creating New WorkSheet: $SheetName\n\n;

  my $WorkSheet = $XLSFile-add_worksheet($SheetName);

  # Rows and columns are zero indexed
  my $Row = 0;

  # Write to Sheet
  while (CSVFILE) {

if ($csv-parse($_)) {
  my @Fields = $csv-fields();

  my $Col = 0;

  foreach my $Fld (@Fields) {
 $WorkSheet-write($Row, $Col, decode_utf8($Fld));
 $Col++;
 }
$Row++;
   }
 }

  close CSVFILE;
}
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] R - need more memory, or rejection sampling algorithm doesn't work?

2009-03-03 Thread Ben Bolker



ekwaters wrote:
 
 b12=log(.4/.6)
 b13=log(.85/.15)
 
 Can you point out the syntax errors in the first one?
 
 

  You have a double caret (^^). 
  f(k) should be f[k]

  Watch out for raising numbers to such large powers
(although to my surprise things didn't over/underflow
when I tried your code).

  Ben Bolker

-- 
View this message in context: 
http://www.nabble.com/R---need-more-memory%2C-or-rejection-sampling-algorithm-doesn%27t-work--tp22302800p22308778.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Inefficiency of SAS Programming

2009-03-03 Thread Frank E Harrell Jr

Ajay ohri wrote:

for an  inefficient  language , it sure has dominated the predictive
analytics world for 3 plus decades.
I referred once to intellectual jealousy between newton and liebnitz.

i am going ahead and creating the R package called Anne.

It basically is meant only for SAS users who want to learn R ,
without upsetting the schedule of the corporate users.

Simply put , it is a wrapper on SAS language using the function command...ie
procunivariate function in Anne package would call the summary function
and so on...


Go ahead and add to the confusion.  You've already created some by using 
 summary for procunivariate.  I created the describe function in the 
Hmisc package to replace univariate.


Frank



Regards,

Ajay

www.decisionstats.com

On Tue, Mar 3, 2009 at 9:20 AM, Greg Snow greg.s...@imail.org wrote:


This does not really address my point.  Yes, if the few nerds who want to
do funny stuff are the ones making the purchase, then there is a good chance
(but still not guaranteed) that they will get IML, but do all companies that
buy SAS actually think about that, or do they just see the extra price (no
matter how low), or not even think to look at that piece because the person
making the purchase does not really the funny things you can do with it.

If you want your SAS code to be able to be run by anyone with SAS, you
cannot assume that they have IML.  If you want your R code to be run by
anyone, you cannot make your code dependent on packages/tools that are not
available for all platforms.

--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111



-Original Message-
From: Gerard M. Keogh [mailto:gmke...@justice.ie]
Sent: Monday, March 02, 2009 3:22 AM
To: Greg Snow
Cc: Frank E Harrell Jr; R list; r-help-boun...@r-project.org
Subject: Re: [R] Inefficiency of SAS Programming

Yes Greg,

but if you're buying SAS they'll throw in IML pretty cheaply - SAS
think
it's only for a few nerds out there who wan to do funny stuff.

G



 Greg Snow
 greg.s...@imail.
 org
To
 Sent by:  Gerard M. Keogh
 r-help-boun...@r- gmke...@justice.ie, Frank E
 project.org   Harrell Jr
   f.harr...@vanderbilt.edu

cc
 27/02/2009 19:05  r-help-boun...@r-project.org
   r-help-boun...@r-project.org,
R
   list r-h...@stat.math.ethz.ch

Subject
   Re: [R] Inefficiency of SAS
   Programming










But SAS/IML is not part of base SAS, it costs extra, so there is a good
chance that a user that has SAS will not be able to run code that uses
SAS/IML.

I have known of SAS programmers who know IML well that still write
matrix/vector tools using macros or proc transpose so that a user
without
IML can still use the code (the fact that the code that started this
thread
was found on a website, suggests that it was meant for general use
rather
than something only used internally where you know what add-ons will be
available).

Just another way that R makes life easier for both programmer and user.


--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111



-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
project.org] On Behalf Of Gerard M. Keogh
Sent: Friday, February 27, 2009 7:19 AM
To: Frank E Harrell Jr
Cc: r-help-boun...@r-project.org; R list
Subject: Re: [R] Inefficiency of SAS Programming

Yes Frank, I accept your point but nevertheless IML is the proper

place

for
matrix work in SAS - mixing macro-level logic and computation is
another
question - R is certainly more seemless in this respect.

Gerard



 Frank E Harrell
 Jr
 f.harr...@vander
To
 bilt.edu Gerard M. Keogh
   gmke...@justice.ie
 27/02/2009 13:55
cc
   R list r-
h...@stat.math.ethz.ch,
   r-help-boun...@r-project.org

Subject
   Re: [R] Inefficiency of SAS
   Programming










Gerard M. Keogh wrote:

Frank,

I can't see the code you mention - Web marshall at work - but I

don't

think

you should be too quick to run down SAS - it's a powerful and

flexible

language but unfortunately very expensive.

Your example mentions doing a vector product in the macro language

-

this

only suggest to me that those people writing the code need a crash

course

in SAS/IML (the matrix language). SAS is designed to work on

records

and
so

is inapproprorriate for matrices - macros are only an efficient

code

copying device. Doing matrix 

Re: [R] Question about multiple plots of zoo objects

2009-03-03 Thread Gabor Grothendieck
Do you mean you want to shade a portion of the plot?

There are two examples of that in the examples section of ?plot.zoo
and a further example using xyplot.zoo in the examples section of
?xyplot.zoo

On Tue, Mar 3, 2009 at 8:37 AM, Sergey Goriatchev serg...@gmail.com wrote:
 Hi, Gabor

 No, what I am trying to do is similar to:
 abline(v=time(spread)[spread[,Indicator]==(-1)], col=yellow),

 where spread is the multivariate zoo object (say, 5 timeseries).

 That is, I want to color parts of the plots where indicator==(-1), but
 do the coloring
 without using layout() and then repeating plot() and abline() for each
 of the 5 timeseries.

 Best,
 Sergey


 On Tue, Mar 3, 2009 at 14:22, Gabor Grothendieck
 ggrothendi...@gmail.com wrote:
 Are you trying to color the points themselves?   This plots the
 first two series in frame 1 (they are the same but one is plotted
 as points and the  other as a line) and the third series is shown
 in frame 2 and for the series of points it colors them green or red.
 The lines are all colored black:

 library(zoo)
 set.seed(1)
 x - zoo(rnorm(10))
 s - sign(x)

 plot(cbind(x, x, s), screen = c(1, 1, 2), type = c(p, l, l),
  col = list(ifelse(s  0, green, red), 1, 1), pch = 20)



 On Tue, Mar 3, 2009 at 7:48 AM, Sergey Goriatchev serg...@gmail.com wrote:
 Hello, everyone

 I have a zoo object containing several time series of daily frequency.
 One of these timeseries is an indicator function with value (-1) at
 certain times, and (+1) at the other.
 I do a plot of several of the timeseries in one go (a multiple plot).
 I wonder if I can automatically in EACH plot color the area where
 indicator variable is (-1)?

 Of course, I could do it simply with layout() and then for each
 timeseries do plot and a color overlay, but I wonder if with
 plot.zoo() simething similar is possible to do automatically.

 Thanks in advance for help!

 Best,
 Sergey

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.





 --
 I'm not young enough to know everything. /Oscar Wilde
 Experience is one thing you can't get for nothing. /Oscar Wilde
 When you are finished changing, you're finished. /Benjamin Franklin
 Tell me and I forget, teach me and I remember, involve me and I learn.
 /Benjamin Franklin
 Luck is where preparation meets opportunity. /George Patten


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] SPSS data import: problems work arounds for GSS surveys

2009-03-03 Thread John Fox
Dear Paul,

I encountered this problem the other day, and it went away when I updated
the foreign package from version 0.8-32 to 0.8-33.

I hope this helps,
 John

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


 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
On
 Behalf Of Paul Johnson
 Sent: March-02-09 10:58 PM
 To: R-help
 Subject: [R] SPSS data import: problems  work arounds for GSS surveys
 
 I'm using R 2.8.1 on Ubuntu 8.10.  I'm writing partly to ask what's
 wrong, partly to tell other users who search that there is a work
 around.
 
 The General Social Survey is a long standing series of surveys
 provided by NORC (National Opinion Research Center).  I have
 downloaded some years of the survey data in SPSS format (here's the
 site: http://www.norc.org/GSS+Website/Download/SPSS+Format/).  When I
 try to import using foreign, I get an error like so:
 
  library(foreign)
  dat - read.spss(gss2006.sav, to.data.frame=T, trim.factor.names=T)
 Error in inherits(x, factor) : object cp not found
 In addition: Warning messages:
 1: In read.spss(gss2006.sav, to.data.frame = T, trim.factor.names = T) :
   gss2006.sav: File contains duplicate label for value 99.9 for variable
 TVRELIG
 2: In read.spss(gss2006.sav, to.data.frame = T, trim.factor.names = T) :
   gss2006.sav: File contains duplicate label for value 99.9 for variable
SEI
 3: In read.spss(gss2006.sav, to.data.frame = T, trim.factor.names = T) :
   gss2006.sav: File contains duplicate label for value 99.9 for
 variable FIRSTSEI
 4: In read.spss(gss2006.sav, to.data.frame = T, trim.factor.names = T) :
   gss2006.sav: File contains duplicate label for value 99.9 for variable
 PASEI
 5: In read.spss(gss2006.sav, to.data.frame = T, trim.factor.names = T) :
   gss2006.sav: File contains duplicate label for value 99.9 for variable
 MASEI
 6: In read.spss(gss2006.sav, to.data.frame = T, trim.factor.names = T) :
   gss2006.sav: File contains duplicate label for value 99.9 for variable
 SPSEI
 7: In read.spss(gss2006.sav, to.data.frame = T, trim.factor.names = T) :
   gss2006.sav: File contains duplicate label for value 0.75 for
 variable YEARSJOB
 8: In read.spss(gss2006.sav, to.data.frame = T, trim.factor.names = T) :
   gss2006.sav: File-indicated character representation code (1252)
 looks like a Windows codepage
 
 No dat object is created from this.
 
 
 I have found a work around.  I installed PSPP version 0.6.0 and used
 it to open the sav file, and then re-save it in SPSS sav  format.
 That creates an SPSS file that foreign's function can open.
 
 I still see the warnings about redundant value labels, but as far as I
 can see these are harmless.  A working object is obtained like so:
 
  dat - read.spss(gss-pspp.sav)
 Warning messages:
 1: In read.spss(gss-pspp.sav) :
   gss-pspp.sav: File contains duplicate label for value 99.9 for
 variable TVRELIG
 2: In read.spss(gss-pspp.sav) :
   gss-pspp.sav: File contains duplicate label for value 0.75 for
 variable YEARSJOB
 3: In read.spss(gss-pspp.sav) :
   gss-pspp.sav: File contains duplicate label for value 99.9 for variable
SEI
 4: In read.spss(gss-pspp.sav) :
   gss-pspp.sav: File contains duplicate label for value 99.9 for
 variable FIRSTSEI
 5: In read.spss(gss-pspp.sav) :
   gss-pspp.sav: File contains duplicate label for value 99.9 for variable
 PASEI
 6: In read.spss(gss-pspp.sav) :
   gss-pspp.sav: File contains duplicate label for value 99.9 for variable
 MASEI
 7: In read.spss(gss-pspp.sav) :
   gss-pspp.sav: File contains duplicate label for value 99.9 for variable
 SPSEI
 
 
 There is still some trouble with the importation of this SPSS file,
 however.  It has the symptoms of being a non-rectangular data array, I
 think.  What do you think about these warnings:
 
  dat - read.spss(gss-pspp.sav,to.data.frame=T)
 There were 22 warnings (use warnings() to see them)
  warnings()
 Warning messages:
 1: In read.spss(gss-pspp.sav, to.data.frame = T) :
   gss-pspp.sav: File contains duplicate label for value 99.9 for
 variable TVRELIG
 2: In read.spss(gss-pspp.sav, to.data.frame = T) :
   gss-pspp.sav: File contains duplicate label for value 0.75 for
 variable YEARSJOB
 3: In read.spss(gss-pspp.sav, to.data.frame = T) :
   gss-pspp.sav: File contains duplicate label for value 99.9 for variable
SEI
 4: In read.spss(gss-pspp.sav, to.data.frame = T) :
   gss-pspp.sav: File contains duplicate label for value 99.9 for
 variable FIRSTSEI
 5: In read.spss(gss-pspp.sav, to.data.frame = T) :
   gss-pspp.sav: File contains duplicate label for value 99.9 for variable
 PASEI
 6: In read.spss(gss-pspp.sav, to.data.frame = T) :
   gss-pspp.sav: File contains duplicate label for value 99.9 for variable
 MASEI
 7: In read.spss(gss-pspp.sav, to.data.frame = T) :
   gss-pspp.sav: File contains duplicate label for value 99.9 for variable
 SPSEI
 8: In xi = z[1L] 

Re: [R] FW: partial residual plots

2009-03-03 Thread John Fox
Dear Dwayne,

I didn't see your post until now, because our email system was down all day
yesterday.

Mark Difford has already pointed your towards the cr.plots() and
ceres.plots() functions in the car package.

In your description of what you want to do, you mention the adjusted
explanatory variable. This sounds more like an added-variable plot than a
component + residual plot (although the vertical axis of the AV is not the
partial residual). In any event, AV plots are not recommended as diagnostics
for nonlinearity.

I hope this helps,
 John 

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


 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
On
 Behalf Of Culp, Dwayne
 Sent: March-02-09 9:42 AM
 To: R-help@r-project.org
 Subject: [R] FW: partial residual plots
 
 I was advised someone might be able to help me with this.
 
 Very truly yours,
 
 Dwayne E. Culp, P.E., CFM
 
 Effective February 8,  2009, my contact information becomes:
 Dwayne E. Culp, P.E., CFM | JACOBS  ENGINEERING GROUP : North American
 Infrastructure | Manager: Hydrology  Hydraulics Section  | 5995 Rogerdale
 Road- B2047B | Houston, TX 77072 | 281-776-2109 | 832.351.7766 Fax |
 713.898.1977 Mobile | dwayne.c...@jacobs.com
mailto:dwayne.c...@jacobs.com
 |
 
 
 
 
 From: Culp, Dwayne
 Sent: Friday, February 27, 2009 3:04 PM
 To: Ted Cleveland; r-c...@r-project.org
 Subject: partial residual plots
 
 
 Is it possible to produce partial residual plots in R?
 
 I am trying to plot the partial residual vs the adjusted explanatory
variable
 in a multiple linear regression to determine if a transformation should be
 done in the explanatory variable.
 
 
 
 Very truly yours,
 
 Dwayne E. Culp, P.E., CFM | Jacobs North American Infrastructure  | Senior
 Project Manager- Land Development | 5995 Rogerdale Road | Houston, TX
77072|
 281.776.2109 | 713.898.1977 Mobile | dwayne.c...@jacobs.com
 
 NOTICE - This communication may contain confidential and privileged
 information that is for the sole use of the intended recipient. Any
viewing,
 copying or distribution of, or reliance on this message by unintended
 recipients is strictly prohibited. If you have received this message in
 error, please notify us immediately by replying to the message and
deleting
 it from your computer.
 
   [[alternative HTML version deleted]]
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] RES: xlsReadWrite package repository for Ubuntu

2009-03-03 Thread Leandro Marino
I think in this case its better use the write.csv. Microsoft Excel reads csv 
files normally. 

Atenciosamente,
Leandro Lins Marino
Centro de Avaliação
Fundação CESGRANRIO
Rua Santa Alexandrina, 1011 - 2º andar
Rio de Janeiro, RJ - CEP: 20261-903
R (21) 2103-9600 R.:236 
( (21) 8777-7907
( lean...@cesgranrio.org.br

Aquele que suporta o peso da sociedade
é precisamente aquele que obtém
 as menores vantagens. (SMITH, Adam)

  Antes de imprimir pense em sua responsabilidade e compromisso com o MEIO 
AMBIENTE 

-Mensagem original-
De: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Em nome 
de Marc Schwartz
Enviada em: terça-feira, 3 de março de 2009 10:38
Para: reverend33
Cc: r-help@r-project.org
Assunto: Re: [R] xlsReadWrite package repository for Ubuntu

You perhaps missed the key point in Uwe's response, which is that the package 
is only available under Windows, as it depends upon Windows specific 
functionality (MS Office API via a third party library which is available for 
Windows only) to natively read and write Excel files.
Thus, there is no package version available for Linux, or OSX for that matter.

If you need to read Excel files under Linux, you could look at the
read.xls() function in the 'gdata' CRAN package. This package requires that 
Perl be installed, as it calls a Perl routine (xls2csv) for converting the 
Excel file to a CSV file, which can then be read into R.

If you need to write Excel files under Linux, you can use a Perl routine that I 
had posted back in 2007:

  https://stat.ethz.ch/pipermail/r-help/2007-July/135968.html

and have updated since then to handle Unicode issues. I am attaching a 2k text 
file here with the updated routine.

HTH,

Marc Schwartz

on 03/03/2009 06:38 AM reverend33 wrote:
 I'm sorry, maybe i didn't explain clearly: i'm trying to install 
 xlsReadWrite on a Linux-type OS (Ubuntu)...
 
 
 
 
 
 Uwe Ligges-3 wrote:


 reverend33 wrote:
 Hi,

 I'm trying to install R on Ubuntu.
 I succeeded at installing the r-recommended package that is present 
 in the synaptics, but i can't find the xlsReadWrite package in the 
 repositories included in my synaptics manager.
 Does anybody know a liable repository in which this package is present.
 If you consider the CRAN master to be liable, it tells you for
 xlsReadWrite:

 OS_type: windows

 Moreover it tells you that the package's status for R-devel is ERROR.


 Uwe Ligges

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Reshape

2009-03-03 Thread Usuario R
Hi all,

I would like to transform to long format a matrix  which has only
information about individuals and a value for each individual. I would like
to have it in ling format with more information related to groups, so ell
values and individuals are repeated for each group. Let me show the example:

matrix in wide format:

IndividualsValue
A3
B4
C5
D2

And long format would be like:

IndividualsValueGroup
A3Group1
B4Group1
C5Group1
D2Group1
A3Group2
B4Group2
C5Group2
D2Group2

My case is of course very large so i thought this could be possible with
reshape function by adding a vector with the names of the groups or
something like that.

Thanks in advance.

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] RES: xlsReadWrite package repository for Ubuntu

2009-03-03 Thread Marc Schwartz
That is fine if you only have one or two R objects to write out to CSV
files and then read them into Excel. It becomes rapidly tedious as the
number of objects increases.

If you go back and read my original post, the incentive for me to write
the Perl routine was that I had to create an Excel file for clients that
contained a large number of tabs, each tab containing data from an R
data frame. My clients are on Windows, I have been on Linux.

In many cases, the number of data frames was 20. Thus, creating that
number of CSV files, importing each one into a separate tab into a
single Excel and naming each tab appropriately (in my case, using
OO.org's Calc) became very tedious.

The Perl routing automates that process, saving a great deal of time and
reducing the potential for error.

Regards,

Marc

on 03/03/2009 07:53 AM Leandro Marino wrote:
 I think in this case its better use the write.csv. Microsoft Excel reads csv 
 files normally. 

 -Mensagem original-
 De: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Em 
 nome de Marc Schwartz
 Enviada em: terça-feira, 3 de março de 2009 10:38
 Para: reverend33
 Cc: r-help@r-project.org
 Assunto: Re: [R] xlsReadWrite package repository for Ubuntu
 
 You perhaps missed the key point in Uwe's response, which is that the package 
 is only available under Windows, as it depends upon Windows specific 
 functionality (MS Office API via a third party library which is available for 
 Windows only) to natively read and write Excel files.
 Thus, there is no package version available for Linux, or OSX for that matter.
 
 If you need to read Excel files under Linux, you could look at the
 read.xls() function in the 'gdata' CRAN package. This package requires that 
 Perl be installed, as it calls a Perl routine (xls2csv) for converting the 
 Excel file to a CSV file, which can then be read into R.
 
 If you need to write Excel files under Linux, you can use a Perl routine that 
 I had posted back in 2007:
 
   https://stat.ethz.ch/pipermail/r-help/2007-July/135968.html
 
 and have updated since then to handle Unicode issues. I am attaching a 2k 
 text file here with the updated routine.
 
 HTH,
 
 Marc Schwartz
 
 on 03/03/2009 06:38 AM reverend33 wrote:
 I'm sorry, maybe i didn't explain clearly: i'm trying to install 
 xlsReadWrite on a Linux-type OS (Ubuntu)...





 Uwe Ligges-3 wrote:

 reverend33 wrote:
 Hi,

 I'm trying to install R on Ubuntu.
 I succeeded at installing the r-recommended package that is present 
 in the synaptics, but i can't find the xlsReadWrite package in the 
 repositories included in my synaptics manager.
 Does anybody know a liable repository in which this package is present.
 If you consider the CRAN master to be liable, it tells you for
 xlsReadWrite:

 OS_type:windows

 Moreover it tells you that the package's status for R-devel is ERROR.


 Uwe Ligges

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Question about multiple plots of zoo objects

2009-03-03 Thread Sergey Goriatchev
Gabor, yes, I want to color portions of EACH plot of the MULTIPLE plot
done with plot.zoo()
I tried to do:
 plot(multivariate zoo object)
abline(v=...)

but that does not work.

I will check your suggestions of the examples.
Thank you for your help, as always!

Best,
Sergey

On Tue, Mar 3, 2009 at 14:44, Gabor Grothendieck
ggrothendi...@gmail.com wrote:
 Do you mean you want to shade a portion of the plot?

 There are two examples of that in the examples section of ?plot.zoo
 and a further example using xyplot.zoo in the examples section of
 ?xyplot.zoo

 On Tue, Mar 3, 2009 at 8:37 AM, Sergey Goriatchev serg...@gmail.com wrote:
 Hi, Gabor

 No, what I am trying to do is similar to:
 abline(v=time(spread)[spread[,Indicator]==(-1)], col=yellow),

 where spread is the multivariate zoo object (say, 5 timeseries).

 That is, I want to color parts of the plots where indicator==(-1), but
 do the coloring
 without using layout() and then repeating plot() and abline() for each
 of the 5 timeseries.

 Best,
 Sergey


 On Tue, Mar 3, 2009 at 14:22, Gabor Grothendieck
 ggrothendi...@gmail.com wrote:
 Are you trying to color the points themselves?   This plots the
 first two series in frame 1 (they are the same but one is plotted
 as points and the  other as a line) and the third series is shown
 in frame 2 and for the series of points it colors them green or red.
 The lines are all colored black:

 library(zoo)
 set.seed(1)
 x - zoo(rnorm(10))
 s - sign(x)

 plot(cbind(x, x, s), screen = c(1, 1, 2), type = c(p, l, l),
  col = list(ifelse(s  0, green, red), 1, 1), pch = 20)



 On Tue, Mar 3, 2009 at 7:48 AM, Sergey Goriatchev serg...@gmail.com wrote:
 Hello, everyone

 I have a zoo object containing several time series of daily frequency.
 One of these timeseries is an indicator function with value (-1) at
 certain times, and (+1) at the other.
 I do a plot of several of the timeseries in one go (a multiple plot).
 I wonder if I can automatically in EACH plot color the area where
 indicator variable is (-1)?

 Of course, I could do it simply with layout() and then for each
 timeseries do plot and a color overlay, but I wonder if with
 plot.zoo() simething similar is possible to do automatically.

 Thanks in advance for help!

 Best,
 Sergey

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide 
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.





 --
 I'm not young enough to know everything. /Oscar Wilde
 Experience is one thing you can't get for nothing. /Oscar Wilde
 When you are finished changing, you're finished. /Benjamin Franklin
 Tell me and I forget, teach me and I remember, involve me and I learn.
 /Benjamin Franklin
 Luck is where preparation meets opportunity. /George Patten





-- 
I'm not young enough to know everything. /Oscar Wilde
Experience is one thing you can't get for nothing. /Oscar Wilde
When you are finished changing, you're finished. /Benjamin Franklin
Tell me and I forget, teach me and I remember, involve me and I learn.
/Benjamin Franklin
Luck is where preparation meets opportunity. /George Patten

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Reshape

2009-03-03 Thread stephen sefick
check out the melt function in the reshape package.

On Tue, Mar 3, 2009 at 8:53 AM, Usuario R r.user.sp...@gmail.com wrote:
 Hi all,

 I would like to transform to long format a matrix  which has only
 information about individuals and a value for each individual. I would like
 to have it in ling format with more information related to groups, so ell
 values and individuals are repeated for each group. Let me show the example:

 matrix in wide format:

 Individuals    Value
 A    3
 B    4
 C    5
 D    2

 And long format would be like:

 Individuals    Value    Group
 A    3    Group1
 B    4    Group1
 C    5    Group1
 D    2    Group1
 A    3    Group2
 B    4    Group2
 C    5    Group2
 D    2    Group2

 My case is of course very large so i thought this could be possible with
 reshape function by adding a vector with the names of the groups or
 something like that.

 Thanks in advance.

        [[alternative HTML version deleted]]

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.




-- 
Stephen Sefick

Let's not spend our time and resources thinking about things that are
so little or so large that all they really do for us is puff us up and
make us feel like gods.  We are mammals, and have not exhausted the
annoying little problems of being mammals.

-K. Mullis

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] RES: xlsReadWrite package repository for Ubuntu

2009-03-03 Thread Gabor Grothendieck
There is a recently updated review of the alternatives on the R Wiki:

http://wiki.r-project.org/rwiki/doku.php?id=tips:data-io:ms_windows

On Tue, Mar 3, 2009 at 9:00 AM, Marc Schwartz marc_schwa...@comcast.net wrote:
 That is fine if you only have one or two R objects to write out to CSV
 files and then read them into Excel. It becomes rapidly tedious as the
 number of objects increases.

 If you go back and read my original post, the incentive for me to write
 the Perl routine was that I had to create an Excel file for clients that
 contained a large number of tabs, each tab containing data from an R
 data frame. My clients are on Windows, I have been on Linux.

 In many cases, the number of data frames was 20. Thus, creating that
 number of CSV files, importing each one into a separate tab into a
 single Excel and naming each tab appropriately (in my case, using
 OO.org's Calc) became very tedious.

 The Perl routing automates that process, saving a great deal of time and
 reducing the potential for error.

 Regards,

 Marc

 on 03/03/2009 07:53 AM Leandro Marino wrote:
 I think in this case its better use the write.csv. Microsoft Excel reads csv 
 files normally.

 -Mensagem original-
 De: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Em 
 nome de Marc Schwartz
 Enviada em: terça-feira, 3 de março de 2009 10:38
 Para: reverend33
 Cc: r-help@r-project.org
 Assunto: Re: [R] xlsReadWrite package repository for Ubuntu

 You perhaps missed the key point in Uwe's response, which is that the 
 package is only available under Windows, as it depends upon Windows specific 
 functionality (MS Office API via a third party library which is available 
 for Windows only) to natively read and write Excel files.
 Thus, there is no package version available for Linux, or OSX for that 
 matter.

 If you need to read Excel files under Linux, you could look at the
 read.xls() function in the 'gdata' CRAN package. This package requires that 
 Perl be installed, as it calls a Perl routine (xls2csv) for converting the 
 Excel file to a CSV file, which can then be read into R.

 If you need to write Excel files under Linux, you can use a Perl routine 
 that I had posted back in 2007:

   https://stat.ethz.ch/pipermail/r-help/2007-July/135968.html

 and have updated since then to handle Unicode issues. I am attaching a 2k 
 text file here with the updated routine.

 HTH,

 Marc Schwartz

 on 03/03/2009 06:38 AM reverend33 wrote:
 I'm sorry, maybe i didn't explain clearly: i'm trying to install
 xlsReadWrite on a Linux-type OS (Ubuntu)...





 Uwe Ligges-3 wrote:

 reverend33 wrote:
 Hi,

 I'm trying to install R on Ubuntu.
 I succeeded at installing the r-recommended package that is present
 in the synaptics, but i can't find the xlsReadWrite package in the
 repositories included in my synaptics manager.
 Does anybody know a liable repository in which this package is present.
 If you consider the CRAN master to be liable, it tells you for
 xlsReadWrite:

 OS_type:    windows

 Moreover it tells you that the package's status for R-devel is ERROR.


 Uwe Ligges

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] xlsReadWrite package repository for Ubuntu

2009-03-03 Thread Dirk Eddelbuettel

On 3 March 2009 at 07:38, Marc Schwartz wrote:
| You perhaps missed the key point in Uwe's response, which is that the
| package is only available under Windows, as it depends upon Windows
| specific functionality (MS Office API via a third party library which is
| available for Windows only) to natively read and write Excel files.
| Thus, there is no package version available for Linux, or OSX for that
| matter.
| 
| If you need to read Excel files under Linux, you could look at the
| read.xls() function in the 'gdata' CRAN package. This package requires
| that Perl be installed, as it calls a Perl routine (xls2csv) for
| converting the Excel file to a CSV file, which can then be read into R.

Also,   'sudo apt-get install r-cran-gdata'   installs that package on Ubuntu.
The package contains the Perl code.  Years ago, I also added the appropriate
Perl modules to read and write xls files to Debian, these are still available
in Ubuntu so one could write a matching write.xls and contribute it back to
the gdata package.

Finally, note that there is an entire R manual devoted to Data Import questions.

Dirk

-- 
Three out of two people have difficulties with fractions.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Inefficiency of SAS Programming

2009-03-03 Thread Girish A.R.
On Mar 3, 9:58 am, Ajay ohri ohri2...@gmail.com wrote:
 for an  inefficient  language , it sure has dominated the predictive
 analytics world for 3 plus decades.
 I referred once to intellectual jealousy between newton and liebnitz.

 i am going ahead and creating the R package called Anne.

 It basically is meant only for SAS users who want to learn R ,
 without upsetting the schedule of the corporate users.

 Simply put , it is a wrapper on SAS language using the function command...ie
 procunivariate function in Anne package would call the summary function
 and so on...

 Regards,

 Ajay

 www.decisionstats.com
=
Bob Muenchen's book R for SAS and SPSS users provides a systematic
transition plan (if I may use that term) for SAS and SPSS users
intending to work on/migrate to R. Having been a newly transformed R
user myself, I'm inclined to believe that creating yet another package
that just houses some SAS procedures--sounding names for data
manipulation/summarization would add to fair bit of confusion.

my $.02..

-Girish

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Arbirtrary column names with write.csv

2009-03-03 Thread Rafael Laboissiere
* Uwe Ligges lig...@statistik.tu-dortmund.de [2009-03-03 15:27]:

 Rafael Laboissiere wrote:
 Is there a way to prevent write.csv to transform the column names a la
 make.names?  I mean, if I write the code:

 x - structure (NULL)
 x [[a+b]] - c (1,2)
 write.csv (x, file = foo.csv, row.names = FALSE, quote = FALSE)


 your x is not a data.frame, hence write.csv() (or better, write.table())  
 converts your *list* x to a data.frame implicitly by using as.data.frame  
 (and this tries to convert names to more regular names by make.names()).  
 You can avoid it by either working on data.frames or stop the  
 make.names() conversion by forcing the data.frame in advance as in:

  write.csv (as.data.frame(x, optional=TRUE), file = foo.csv,  
 row.names = FALSE, quote = FALSE)

Great, it works.  Thanks!

-- 
Rafael Laboissiere

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Reshape

2009-03-03 Thread baptiste auguie
If you have many such repetitions it can be annoying to type the  
rbind(cbind ... sequence. Perhaps this would help,




m - read.table(textConnection(
IndividualsValue
A3
B4
C5
D2), head=T)

data.frame(groups= rep(c(group1, group2, group3),  
each=nrow(m)), Ind=m[, 1], val=m[, 2])



You could also try Hadley's plyr package,

rdply(3,m) # you might want to rename the column name and make(.n) a  
factor with adequate levels




baptiste

On 3 Mar 2009, at 14:28, David Winsemius wrote:


Your data objects could not be matrices with that composition of
values. Let's use the correct data type:


df - data.frame(Ind = letters[1:4], val = sample(1:4, 4))
df

  Ind val
1   a   4
2   b   2
3   c   3
4   d   1

rbind(cbind(df,GruppeEin),cbind(df,GruppeZwei))  #v ariable

recycling
  Ind val  y
1   a   4  GruppeEin
2   b   2  GruppeEin
3   c   3  GruppeEin
4   d   1  GruppeEin
5   a   4 GruppeZwei
6   b   2 GruppeZwei
7   c   3 GruppeZwei
8   d   1 GruppeZwei


is.data.frame(rbind(cbind(df,GruppeEin),cbind(df,GruppeZwei)))

[1] TRUE

--
David Winsemius

On Mar 3, 2009, at 8:53 AM, Usuario R wrote:


Hi all,

I would like to transform to long format a matrix  which has only
information about individuals and a value for each individual. I
would like
to have it in ling format with more information related to groups,
so ell
values and individuals are repeated for each group. Let me show the
example:

matrix in wide format:

IndividualsValue
A3
B4
C5
D2

And long format would be like:

IndividualsValueGroup
A3Group1
B4Group1
C5Group1
D2Group1
A3Group2
B4Group2
C5Group2
D2Group2

My case is of course very large so i thought this could be possible
with
reshape function by adding a vector with the names of the groups or
something like that.

Thanks in advance.

 [[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


_

Baptiste Auguié

School of Physics
University of Exeter
Stocker Road,
Exeter, Devon,
EX4 4QL, UK

Phone: +44 1392 264187

http://newton.ex.ac.uk/research/emag

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Question about multiple plots of zoo objects

2009-03-03 Thread Sergey Goriatchev
Supreme!
Thanks Gabor!

On Tue, Mar 3, 2009 at 15:20, Gabor Grothendieck
ggrothendi...@gmail.com wrote:
 If you want to use abline on a multivariate plot it must be issued
 within a panel function like this:

 # same set up as in prior email
 p - function(x, y, ...) { points(x, y); lines(x, y); abline(v =
 time(s)[s  0], col = green) }
 plot(cbind(x, s), panel = p)

 There are further examples of panel functions in the examples section
 of ?plot.zoo
 in case what you want is a variation of the above.


 On Tue, Mar 3, 2009 at 9:04 AM, Sergey Goriatchev serg...@gmail.com wrote:
 Gabor, yes, I want to color portions of EACH plot of the MULTIPLE plot
 done with plot.zoo()
 I tried to do:
  plot(multivariate zoo object)
 abline(v=...)

 but that does not work.

 I will check your suggestions of the examples.
 Thank you for your help, as always!

 Best,
 Sergey

 On Tue, Mar 3, 2009 at 14:44, Gabor Grothendieck
 ggrothendi...@gmail.com wrote:
 Do you mean you want to shade a portion of the plot?

 There are two examples of that in the examples section of ?plot.zoo
 and a further example using xyplot.zoo in the examples section of
 ?xyplot.zoo

 On Tue, Mar 3, 2009 at 8:37 AM, Sergey Goriatchev serg...@gmail.com wrote:
 Hi, Gabor

 No, what I am trying to do is similar to:
 abline(v=time(spread)[spread[,Indicator]==(-1)], col=yellow),

 where spread is the multivariate zoo object (say, 5 timeseries).

 That is, I want to color parts of the plots where indicator==(-1), but
 do the coloring
 without using layout() and then repeating plot() and abline() for each
 of the 5 timeseries.

 Best,
 Sergey


 On Tue, Mar 3, 2009 at 14:22, Gabor Grothendieck
 ggrothendi...@gmail.com wrote:
 Are you trying to color the points themselves?   This plots the
 first two series in frame 1 (they are the same but one is plotted
 as points and the  other as a line) and the third series is shown
 in frame 2 and for the series of points it colors them green or red.
 The lines are all colored black:

 library(zoo)
 set.seed(1)
 x - zoo(rnorm(10))
 s - sign(x)

 plot(cbind(x, x, s), screen = c(1, 1, 2), type = c(p, l, l),
  col = list(ifelse(s  0, green, red), 1, 1), pch = 20)



 On Tue, Mar 3, 2009 at 7:48 AM, Sergey Goriatchev serg...@gmail.com 
 wrote:
 Hello, everyone

 I have a zoo object containing several time series of daily frequency.
 One of these timeseries is an indicator function with value (-1) at
 certain times, and (+1) at the other.
 I do a plot of several of the timeseries in one go (a multiple plot).
 I wonder if I can automatically in EACH plot color the area where
 indicator variable is (-1)?

 Of course, I could do it simply with layout() and then for each
 timeseries do plot and a color overlay, but I wonder if with
 plot.zoo() simething similar is possible to do automatically.

 Thanks in advance for help!

 Best,
 Sergey

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide 
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.





 --
 I'm not young enough to know everything. /Oscar Wilde
 Experience is one thing you can't get for nothing. /Oscar Wilde
 When you are finished changing, you're finished. /Benjamin Franklin
 Tell me and I forget, teach me and I remember, involve me and I learn.
 /Benjamin Franklin
 Luck is where preparation meets opportunity. /George Patten





 --
 I'm not young enough to know everything. /Oscar Wilde
 Experience is one thing you can't get for nothing. /Oscar Wilde
 When you are finished changing, you're finished. /Benjamin Franklin
 Tell me and I forget, teach me and I remember, involve me and I learn.
 /Benjamin Franklin
 Luck is where preparation meets opportunity. /George Patten





-- 
I'm not young enough to know everything. /Oscar Wilde
Experience is one thing you can't get for nothing. /Oscar Wilde
When you are finished changing, you're finished. /Benjamin Franklin
Tell me and I forget, teach me and I remember, involve me and I learn.
/Benjamin Franklin
Luck is where preparation meets opportunity. /George Patten

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] REMINDER: DSC 2009 abstract submission before March 15

2009-03-03 Thread Peter Dalgaard
Just a friendly reminder that the closing date for abstract submissions
for the DSC conference in Copenhagen is next Sunday.

See

http://www.r-project.org/dsc-2009

Notice that the website has been revised since we decided to engage a
professional convention bureau. The good news is that payment by credit
card is now possible. The slightly bad news is that there are now two
separate registration paths: one for participation and one for abstracts.

-- 
   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - (p.dalga...@biostat.ku.dk)  FAX: (+45) 35327907

___
r-annou...@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-announce
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] New R mailing list: R-SIG-insurance

2009-03-03 Thread Vincent Goulet

Dear useRs,

Over the last few years R has gained a significant momentum in the  
insurance industry. Dedicated packages have been written, numerous  
presentations given, courses held, businesses set up, and IT  
departments convinced. ;-)


Therefore, together with Markus Gesmann of Lloyd's of London, we  
created a Special Interest Group mailing list to discuss R usage in  
actuarial science, insurance (life and non-life) and risk analysis and  
assessment in general. (With thanks to Diego Mazzeo for the idea and  
to Martin Maechler for the technical help and list creation.)


To subscribe to the list please visit:

https://stat.ethz.ch/mailman/listinfo/r-sig-insurance

For the posting guide see:

http://www.r-project.org/posting-guide.html

We hope that this new list will foster discussions and the transfer of  
knowledge. Please pass the word and participate, your contributions  
are most welcome!


--
Vincent Goulet, Associate Professor
École d'actuariat
Université Laval, Québec
vincent.gou...@act.ulaval.ca   http://vgoulet.act.ulaval.ca

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Inefficiency of SAS Programming

2009-03-03 Thread Ajay ohri
why didnt you call it procunivariate if that was exactly what you wanted to
do .

On Tue, Mar 3, 2009 at 7:11 PM, Frank E Harrell Jr f.harr...@vanderbilt.edu
 wrote:

 Ajay ohri wrote:

 for an  inefficient  language , it sure has dominated the predictive
 analytics world for 3 plus decades.
 I referred once to intellectual jealousy between newton and liebnitz.

 i am going ahead and creating the R package called Anne.

 It basically is meant only for SAS users who want to learn R ,
 without upsetting the schedule of the corporate users.

 Simply put , it is a wrapper on SAS language using the function
 command...ie
 procunivariate function in Anne package would call the summary function
 and so on...


 Go ahead and add to the confusion.  You've already created some by using
  summary for procunivariate.  I created the describe function in the Hmisc
 package to replace univariate.

 Frank


 Regards,

 Ajay

 www.decisionstats.com

 On Tue, Mar 3, 2009 at 9:20 AM, Greg Snow greg.s...@imail.org wrote:

  This does not really address my point.  Yes, if the few nerds who want to
 do funny stuff are the ones making the purchase, then there is a good
 chance
 (but still not guaranteed) that they will get IML, but do all companies
 that
 buy SAS actually think about that, or do they just see the extra price
 (no
 matter how low), or not even think to look at that piece because the
 person
 making the purchase does not really the funny things you can do with it.

 If you want your SAS code to be able to be run by anyone with SAS, you
 cannot assume that they have IML.  If you want your R code to be run by
 anyone, you cannot make your code dependent on packages/tools that are
 not
 available for all platforms.

 --
 Gregory (Greg) L. Snow Ph.D.
 Statistical Data Center
 Intermountain Healthcare
 greg.s...@imail.org
 801.408.8111


  -Original Message-
 From: Gerard M. Keogh [mailto:gmke...@justice.ie]
 Sent: Monday, March 02, 2009 3:22 AM
 To: Greg Snow
 Cc: Frank E Harrell Jr; R list; r-help-boun...@r-project.org
 Subject: Re: [R] Inefficiency of SAS Programming

 Yes Greg,

 but if you're buying SAS they'll throw in IML pretty cheaply - SAS
 think
 it's only for a few nerds out there who wan to do funny stuff.

 G



 Greg Snow
 greg.s...@imail.
 org
 To
 Sent by:  Gerard M. Keogh
 r-help-boun...@r- gmke...@justice.ie, Frank E
 project.org   Harrell Jr
   f.harr...@vanderbilt.edu

 cc
 27/02/2009 19:05  r-help-boun...@r-project.org
   r-help-boun...@r-project.org,
 R
   list r-h...@stat.math.ethz.ch

 Subject
   Re: [R] Inefficiency of SAS
   Programming










 But SAS/IML is not part of base SAS, it costs extra, so there is a good
 chance that a user that has SAS will not be able to run code that uses
 SAS/IML.

 I have known of SAS programmers who know IML well that still write
 matrix/vector tools using macros or proc transpose so that a user
 without
 IML can still use the code (the fact that the code that started this
 thread
 was found on a website, suggests that it was meant for general use
 rather
 than something only used internally where you know what add-ons will be
 available).

 Just another way that R makes life easier for both programmer and user.


 --
 Gregory (Greg) L. Snow Ph.D.
 Statistical Data Center
 Intermountain Healthcare
 greg.s...@imail.org
 801.408.8111


  -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
 project.org] On Behalf Of Gerard M. Keogh
 Sent: Friday, February 27, 2009 7:19 AM
 To: Frank E Harrell Jr
 Cc: r-help-boun...@r-project.org; R list
 Subject: Re: [R] Inefficiency of SAS Programming

 Yes Frank, I accept your point but nevertheless IML is the proper

 place

 for
 matrix work in SAS - mixing macro-level logic and computation is
 another
 question - R is certainly more seemless in this respect.

 Gerard



 Frank E Harrell
 Jr
 f.harr...@vander
 To
 bilt.edu Gerard M. Keogh
   gmke...@justice.ie
 27/02/2009 13:55
 cc
   R list r-
 h...@stat.math.ethz.ch,
   r-help-boun...@r-project.org

 Subject
   Re: [R] Inefficiency of SAS
   Programming










 Gerard M. Keogh wrote:

 Frank,

 I can't see the code you mention - Web marshall at work - but I

 don't

 think

 you should be too quick to run down SAS - it's a powerful and

 flexible

 language but unfortunately very expensive.

 Your example mentions doing a vector product in the macro language

 -

 

[R] SAS Macros for R Users Only

2009-03-03 Thread Ajay ohri
I think SAS Macros has capability to call R, and execute it  without it
being in the picture anywhere.
So you can use SAS Macros in a file called R.sas

In this you can create a macro called %Describe that can call R , load Hmisc
,run the describe function




Note you will need repeated use of %put in this  %describe for the mapping
to take place


Use %INCLUDE to include that file in all SAS Programs

In fact there is a 50 dollar program written by Phil Rack at
www.minequest.com which does exactly that

see more here

http://www.decisionstats.com/2009/02/interview-phil-rack/


On Tue, Mar 3, 2009 at 8:53 PM, Ajay ohri ohri2...@gmail.com wrote:


 why didnt you call it procunivariate if that was exactly what you wanted to
 do .


 On Tue, Mar 3, 2009 at 7:11 PM, Frank E Harrell Jr 
 f.harr...@vanderbilt.edu wrote:

 Ajay ohri wrote:

 for an  inefficient  language , it sure has dominated the predictive
 analytics world for 3 plus decades.
 I referred once to intellectual jealousy between newton and liebnitz.

 i am going ahead and creating the R package called Anne.

 It basically is meant only for SAS users who want to learn R ,
 without upsetting the schedule of the corporate users.

 Simply put , it is a wrapper on SAS language using the function
 command...ie
 procunivariate function in Anne package would call the summary function
 and so on...


 Go ahead and add to the confusion.  You've already created some by using
  summary for procunivariate.  I created the describe function in the Hmisc
 package to replace univariate.

 Frank


 Regards,

 Ajay

 www.decisionstats.com

 On Tue, Mar 3, 2009 at 9:20 AM, Greg Snow greg.s...@imail.org wrote:

  This does not really address my point.  Yes, if the few nerds who want
 to
 do funny stuff are the ones making the purchase, then there is a good
 chance
 (but still not guaranteed) that they will get IML, but do all companies
 that
 buy SAS actually think about that, or do they just see the extra price
 (no
 matter how low), or not even think to look at that piece because the
 person
 making the purchase does not really the funny things you can do with it.

 If you want your SAS code to be able to be run by anyone with SAS, you
 cannot assume that they have IML.  If you want your R code to be run by
 anyone, you cannot make your code dependent on packages/tools that are
 not
 available for all platforms.

 --
 Gregory (Greg) L. Snow Ph.D.
 Statistical Data Center
 Intermountain Healthcare
 greg.s...@imail.org
 801.408.8111


  -Original Message-
 From: Gerard M. Keogh [mailto:gmke...@justice.ie]
 Sent: Monday, March 02, 2009 3:22 AM
 To: Greg Snow
 Cc: Frank E Harrell Jr; R list; r-help-boun...@r-project.org
 Subject: Re: [R] Inefficiency of SAS Programming

 Yes Greg,

 but if you're buying SAS they'll throw in IML pretty cheaply - SAS
 think
 it's only for a few nerds out there who wan to do funny stuff.

 G



 Greg Snow
 greg.s...@imail.
 org
 To
 Sent by:  Gerard M. Keogh
 r-help-boun...@r- gmke...@justice.ie, Frank E
 project.org   Harrell Jr
   f.harr...@vanderbilt.edu

 cc
 27/02/2009 19:05  r-help-boun...@r-project.org
   r-help-boun...@r-project.org,
 R
   list r-h...@stat.math.ethz.ch

 Subject
   Re: [R] Inefficiency of SAS
   Programming










 But SAS/IML is not part of base SAS, it costs extra, so there is a good
 chance that a user that has SAS will not be able to run code that uses
 SAS/IML.

 I have known of SAS programmers who know IML well that still write
 matrix/vector tools using macros or proc transpose so that a user
 without
 IML can still use the code (the fact that the code that started this
 thread
 was found on a website, suggests that it was meant for general use
 rather
 than something only used internally where you know what add-ons will be
 available).

 Just another way that R makes life easier for both programmer and user.


 --
 Gregory (Greg) L. Snow Ph.D.
 Statistical Data Center
 Intermountain Healthcare
 greg.s...@imail.org
 801.408.8111


  -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
 project.org] On Behalf Of Gerard M. Keogh
 Sent: Friday, February 27, 2009 7:19 AM
 To: Frank E Harrell Jr
 Cc: r-help-boun...@r-project.org; R list
 Subject: Re: [R] Inefficiency of SAS Programming

 Yes Frank, I accept your point but nevertheless IML is the proper

 place

 for
 matrix work in SAS - mixing macro-level logic and computation is
 another
 question - R is certainly more seemless in this respect.

 Gerard



 Frank E Harrell
 Jr
 f.harr...@vander
 To
 bilt.edu Gerard M. Keogh
 

[R] spatial markov chain methods

2009-03-03 Thread Torsten Lange

Hello,

can any one point me to R-packages (if available) which include spatial 
Markov Chain methods?
My second question is more general but hopefully not OT: Currently we 
are using the software TPROGS, which let people simulate property 
distributions in space by some Markov Chain approaches. We face some 
problems due to the lack of information between distances of samples 
along borehole path and among boreholes. Is there any way to trick it 
like for instants in variogram modeling were one might use nested 
variograms...?


Thank you, Torsten

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] xlsReadWrite package repository for Ubuntu

2009-03-03 Thread reverend33


Thanks a lot for all your answers.
Indeed, i hadn't understood the previous answers.
I just downloaded the gdata package and it works perfectly now.
Thanks again.





Gabor Grothendieck wrote:
 
 If your purpose is to read Excel spreadsheets on Linux read.xls in the
 gdata
 packages can do that.  It uses perl software underneath which is portable
 across systems.
 
 On Tue, Mar 3, 2009 at 7:38 AM, reverend33 periac_r...@hotmail.com
 wrote:

 I'm sorry, maybe i didn't explain clearly: i'm trying to install
 xlsReadWrite
 on a Linux-type OS (Ubuntu)...





 Uwe Ligges-3 wrote:



 reverend33 wrote:
 Hi,

 I'm trying to install R on Ubuntu.
 I succeeded at installing the r-recommended package that is present in
 the
 synaptics, but i can't find the xlsReadWrite package in the
 repositories
 included in my synaptics manager.
 Does anybody know a liable repository in which this package is present.

 If you consider the CRAN master to be liable, it tells you for
 xlsReadWrite:

 OS_type:      windows

 Moreover it tells you that the package's status for R-devel is ERROR.


 Uwe Ligges



 Thanks in advance

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.



 --
 View this message in context:
 http://www.nabble.com/xlsReadWrite-package-repository-for-Ubuntu-tp22283704p22307883.html
 Sent from the R help mailing list archive at Nabble.com.

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 
 

-- 
View this message in context: 
http://www.nabble.com/xlsReadWrite-package-repository-for-Ubuntu-tp22283704p22309785.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] PLS regression on near infrared (NIR) spectra data

2009-03-03 Thread Paulo Ricardo Gherardi Hein
Dear collegues,

I´ ve worked with near infrared (NIR) spectroscopy to assess chemical,
physical, mechanical and anatomical properties of wood.

I use The Unscrambler software to correlate the matrix of dependent
variables (Y) with the matrix of spectral data (X) and I would like to
migrate to R. The matrix of spectral variables is very large (2345 columns
and n lines, where n = samples), so we used Partial Least Squares Regression
to predict a variable y (content of cellulose, for instance) based on the
spectral variables, which are the NIR wavelengths.

I am new here (since jan2009) and up to now, I not seen anyone commenting
about principal component analysis and regression PLS to analyze spectral
information in R system. Sorry, I am a R starter...

Anybody have any package, or trick to suggest me?

Grateful for yours information!
 --
Paulo Ricardo Gherardi Hein
PhD candidate at University of Montpellier 2
CIRAD - PERSYST Department
Research unit: Production and Processing of Tropical Woods - TA B-40/16
73 rue Jean-François Breton 34398 Montpellier Cedex 5, France
phone: +33 4 67 61 44 51
skype: paulo_hein
email: paulo.h...@cirad.fr

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] behavior of squishplot in TeachingDemos

2009-03-03 Thread Stephen Tucker
Hi list,
I wonder if anyone has had this experience with squishplot() in the 
TeachingDemos package. 

Taking the example from the ?image help page,

library(TeachingDemos)
x - 10*(1:nrow(volcano))
y - 10*(1:ncol(volcano))

layout(matrix(c(1,2,3,4),ncol=2,byrow=TRUE),height=c(2,1))
## 1st plot
op - squishplot(range(x),range(y),1)
image(x, y, volcano, col = terrain.colors(100))
par(op)
## 2nd plot
op - squishplot(range(x),range(y),1)
image(x, y, volcano, col = terrain.colors(100))
par(op)

The second plot comes out looking as expected, but the first plot is not 
squished in the desired proportions. I tried tracking the modifications to 
par('pin') and par('plt') in the function but gave up midway through in desire 
for haste - not sure what is going on but I did find that taking advantage of 
the behavior above, calling 
plot.new(); par(new=TRUE)
before the first plot makes things work as expected. So the full code would be

layout(matrix(c(1,2,3,4),ncol=2,byrow=TRUE),height=c(2,1))
## 1st plot
op - squishplot(range(x),range(y),1)
plot.new()
par(new=TRUE)
image(x, y, volcano, col = terrain.colors(100))
par(op)
## 2nd plot
op - squishplot(range(x),range(y),1)
image(x, y, volcano, col = terrain.colors(100))
par(op)

+++

I wonder if this behavior is not surprising? It is a great function overall 
though - thanks for the contribution.

Stephen

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Mantel test!

2009-03-03 Thread Jason Sexton

Dear Gavin,

What is the interpretation of a simulated p-value of 1 in a mantel  
test and how is the p-value derived?  When we run two highly  
negatively correlated matrices we get this result:  r: -1, simulated p  
value: 1


I would expect the high p-value of 1 to mean not significant.  Could  
you clarify?


Thank you,

Jason


Jason P. Sexton
Graduate Group in Ecology
University of California, Davis
(530) 752-1701
jpsex...@ucdavis.edu

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Comparing two matrices

2009-03-03 Thread Koen Hufkens

Hi List,

I would like to compare two (confusion) matrices. I ended up with the  
ade4 mantel.rtest function as my best option. However it seems that my  
data is non-euclidean in nature (is.euclid gives a FALSE). I attached  
both matrices at the end of the document.


Are there any tools to transform these matrices into an euclidean form  
so I can use mantel.rtest with confidence.


Other suggestions are also welcome.

Kind regards,
Koen

--

matrix 1

   V1 V2 V3 V4 V5 V6 V7 V8 V9 V10 V11
1   0 60  5  0  9  3  3  0 18   1   1
2  30  0 12  0  2 45  1  0  5   4   1
3   8 32  0  1 19  5  4  0 27   1   3
4   0  0  3  0 67  1  3  0  0   0  25
5  12  3 13 26  0 12 27  0  3   2   2
6   1 72  1  0  4  0 11  0  0  10   1
7   3  2  9  0 45 40  0  0  0   0   0
8  13  3  0  0  0  1  0  0 10   0  72
9  24 26 34  0  6  2  0  2  0   2   4
10  2 21  1  0  1 67  0  0  1   0   6
11  2  2 28 11 10 10  0 22  3  13   0

matrix 2

   V1 V2 V3 V4 V5 V6 V7 V8 V9 V10 V11
1   0 66  0 10  9  5  0  3  7   0   0
2  43  0  0 14  2 32  0  1  5   3   0
3  11 32  4  0 19 10  1  7 13   2   0
4   0  0  0  0  0  0  0  0  0   0   0
5  11  6  4 18  0 15 18 22  4   1   0
6   2 40  3  3 12  0  1 24  1  14   0
7   4  5  0  8 32 49  2  0  0   0   0
8   0  0  0  0  0  0  0  0  0   0   0
9  19 23  2 42  8  2  0  0  0   3   1
10  1 16  3  3  3 73  0  0  2   0   0
11  2  4  0 20 15 10 15  0 10   7  17

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Mantel test!

2009-03-03 Thread Sarah Goslee
I'm not Gavin, but since you posted this to the R-help list I assume you
are open to other respondents.

Since you are asking Gavin, I assume you are using mantel() from the
vegan package (it's a good idea to specify, as there are other possibilities).

The help for that function explains the permutation test briefly, and gives
a citation for more information.

As for why you are getting p=1, I'd look into what hypothesis you are
actually testing - quite possibly the null hypothesis that r = 0.

The mantel() function in the ecodist package offers three different
hypothesis tests:
r = 0
r = 0
r == 0

Sarah

On Tue, Mar 3, 2009 at 11:24 AM, Jason Sexton sexton...@gmail.com wrote:
 Dear Gavin,

 What is the interpretation of a simulated p-value of 1 in a mantel test and
 how is the p-value derived?  When we run two highly negatively correlated
 matrices we get this result:  r: -1, simulated p value: 1

 I would expect the high p-value of 1 to mean not significant.  Could you
 clarify?

 Thank you,

 Jason



-- 
Sarah Goslee
http://www.functionaldiversity.org

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Comparing two matrices

2009-03-03 Thread Sarah Goslee
Hi,

For the Mantel test, your matrices do not need to be Euclidean, but they
do need to be symmetric. You could write a similar test that does not
require a symmetric matrix, though.

Sarah

On Tue, Mar 3, 2009 at 11:40 AM, Koen Hufkens koen.hufk...@ua.ac.be wrote:
 Hi List,

 I would like to compare two (confusion) matrices. I ended up with the ade4
 mantel.rtest function as my best option. However it seems that my data is
 non-euclidean in nature (is.euclid gives a FALSE). I attached both matrices
 at the end of the document.

 Are there any tools to transform these matrices into an euclidean form so I
 can use mantel.rtest with confidence.

 Other suggestions are also welcome.

 Kind regards,
 Koen

 --

 matrix 1

   V1 V2 V3 V4 V5 V6 V7 V8 V9 V10 V11
 1   0 60  5  0  9  3  3  0 18   1   1
 2  30  0 12  0  2 45  1  0  5   4   1
 3   8 32  0  1 19  5  4  0 27   1   3
 4   0  0  3  0 67  1  3  0  0   0  25
 5  12  3 13 26  0 12 27  0  3   2   2
 6   1 72  1  0  4  0 11  0  0  10   1
 7   3  2  9  0 45 40  0  0  0   0   0
 8  13  3  0  0  0  1  0  0 10   0  72
 9  24 26 34  0  6  2  0  2  0   2   4
 10  2 21  1  0  1 67  0  0  1   0   6
 11  2  2 28 11 10 10  0 22  3  13   0

 matrix 2

   V1 V2 V3 V4 V5 V6 V7 V8 V9 V10 V11
 1   0 66  0 10  9  5  0  3  7   0   0
 2  43  0  0 14  2 32  0  1  5   3   0
 3  11 32  4  0 19 10  1  7 13   2   0
 4   0  0  0  0  0  0  0  0  0   0   0
 5  11  6  4 18  0 15 18 22  4   1   0
 6   2 40  3  3 12  0  1 24  1  14   0
 7   4  5  0  8 32 49  2  0  0   0   0
 8   0  0  0  0  0  0  0  0  0   0   0
 9  19 23  2 42  8  2  0  0  0   3   1
 10  1 16  3  3  3 73  0  0  2   0   0
 11  2  4  0 20 15 10 15  0 10   7  17



-- 
Sarah Goslee
http://www.functionaldiversity.org

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] modifying a built in function from the stats package (fixing arima)

2009-03-03 Thread Marc Vinyes
Dear members of the list,

I'm a beginner in R and I'm having some trouble with: Error in
optim(init[mask], armafn, method = BFGS, hessian = TRUE, control =
optim.control,  :
  non-finite finite-difference value [8]

when running arima.

I've seen that some people have come accross the same problem:
https://stat.ethz.ch/pipermail/r-help/2008-August/169660.html

So I'd like to modify the code of arima to change the optimization function
with another one that handles these problems automatically , however I don't
find the way to do it and
http://tolstoy.newcastle.edu.au/R/e6/help/09/01/2476.html points out a way
that doesn't work for me:

* If I type edit(arima) and I modify it, changes are not saved,
* If I copy the code and I save it like a different function, I get the hard
error: Error in Delta %+% c(1, -1) : object R_TSconv not found

Anybody can give me a hint? I miss matlab's easy way of doing this (edit
function.m).

Thanks in advance

MarC (AleaSoft)

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Inefficiency of SAS Programming

2009-03-03 Thread Frank E Harrell Jr

Ajay ohri wrote:


why didnt you call it procunivariate if that was exactly what you wanted 
to do .


Why would I ever do that?  describe is a improvement on univariate, 
saving an estimated 87 +/- 87 trees per year in paper by printing what 
you need in much less space and concentrating on real descriptive 
statistics.


Frank




On Tue, Mar 3, 2009 at 7:11 PM, Frank E Harrell Jr 
f.harr...@vanderbilt.edu mailto:f.harr...@vanderbilt.edu wrote:


Ajay ohri wrote:

for an  inefficient  language , it sure has dominated the
predictive
analytics world for 3 plus decades.
I referred once to intellectual jealousy between newton and
liebnitz.

i am going ahead and creating the R package called Anne.

It basically is meant only for SAS users who want to learn R ,
without upsetting the schedule of the corporate users.

Simply put , it is a wrapper on SAS language using the function
command...ie
procunivariate function in Anne package would call the summary
function
and so on...


Go ahead and add to the confusion.  You've already created some by
using  summary for procunivariate.  I created the describe function
in the Hmisc package to replace univariate.

Frank


Regards,

Ajay

www.decisionstats.com http://www.decisionstats.com

On Tue, Mar 3, 2009 at 9:20 AM, Greg Snow greg.s...@imail.org
mailto:greg.s...@imail.org wrote:

This does not really address my point.  Yes, if the few
nerds who want to
do funny stuff are the ones making the purchase, then there
is a good chance
(but still not guaranteed) that they will get IML, but do
all companies that
buy SAS actually think about that, or do they just see the
extra price (no
matter how low), or not even think to look at that piece
because the person
making the purchase does not really the funny things you can
do with it.

If you want your SAS code to be able to be run by anyone
with SAS, you
cannot assume that they have IML.  If you want your R code
to be run by
anyone, you cannot make your code dependent on
packages/tools that are not
available for all platforms.

--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org mailto:greg.s...@imail.org
801.408.8111


-Original Message-
From: Gerard M. Keogh [mailto:gmke...@justice.ie
mailto:gmke...@justice.ie]
Sent: Monday, March 02, 2009 3:22 AM
To: Greg Snow
Cc: Frank E Harrell Jr; R list;
r-help-boun...@r-project.org
mailto:r-help-boun...@r-project.org
Subject: Re: [R] Inefficiency of SAS Programming

Yes Greg,

but if you're buying SAS they'll throw in IML pretty
cheaply - SAS
think
it's only for a few nerds out there who wan to do funny
stuff.

G



Greg Snow
greg.s...@imail.
org
To
Sent by:  Gerard M. Keogh
r-help-boun...@r-
gmke...@justice.ie mailto:gmke...@justice.ie, Frank E
project.org http://project.org
  Harrell Jr
 
f.harr...@vanderbilt.edu mailto:f.harr...@vanderbilt.edu


cc
27/02/2009 19:05
 r-help-boun...@r-project.org

mailto:r-help-boun...@r-project.org
 
r-help-boun...@r-project.org

mailto:r-help-boun...@r-project.org,
R
  list
r-h...@stat.math.ethz.ch mailto:r-h...@stat.math.ethz.ch

Subject
  Re: [R]
Inefficiency of SAS
  Programming










But SAS/IML is not part of base SAS, it costs extra, so
there is a good
chance that a user that has SAS will not be able to run
code that uses
SAS/IML.

I have known of SAS programmers who know IML well that
still write
matrix/vector tools using macros or proc transpose so
   

Re: [R] locfit smoothing question (package maintainer not reachable)

2009-03-03 Thread Suresh Krishna


Dear all,

I just realized that using family=qgauss restores normal-looking  
confidence bands... I read that using family=gaussian rather than  
family=qgauss fixes the dispersion parameter at 1, but without knowing  
the theory behind the code, I dont understand why there is such a  
difference between the two. If there is a simple explanation or  
recommendation, I am eager to hear it.


Thanks, Suresh


On Tue, 03 Mar 2009 16:56:43 +0100, Suresh Krishna madzient...@gmail.com  
wrote:




Dear list members,

I am trying to understand this output from the smoothing package locfit  
(1.5-4, running on R 2.8.1 on Windows Vista 64 bit).


# sample code

x-1:100

y-rnorm(100)
fit-locfit(y~x,family=gaussian) #default parameters are fine
plot(fit,band=global)  #plot seems reasonable, confidence bands use  
a global estimate of variance


y-1000*rnorm(100)
fit-locfit(y~x,family=gaussian)
plot(fit,band=global) #aren't these confidence bands too small ? am i  
using this function wrongly ?


Using band=local gives results that seem to make more sense. Could  
someone offer me some guidance ?


Thanks, Suresh

ps. The package maintainer, Catherine Loader, is no longer reachable at  
her Auckland address.





__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] preparing data for barplot()

2009-03-03 Thread Andrew Ziem
What is the best way to produce a barplot from my data?  I would like
the barplot to show each person with the values stacked
val1+val2+val3, so there is one bar for each person  When I use
barplot(data.matrix(realdata)), it shows one bar for each value
instead.

To post here, I created an artificical data set, but it works fine.

fakedata - as.data.frame(list(LETTERS[1:3]))
colnames(fakedata) - 'people'
fakedata['val1'] = abs(rnorm(3))
fakedata['val2'] = abs(rnorm(3))
fakedata['val3'] = abs(rnorm(3))
barplot(data.matrix(fakedata))

At a glance there is no substantial difference is between my fake data
and my real data.

 realdata
  person val1 val2 val3
1  A  221   71  175
2  B  222   85  147
 mydata
  people   val1 val2   val3
1  A 0.75526748 0.445386 0.09186245
2  B 0.06107566 2.008815 2.50269410
3  C 0.47171611 0.592037 0.57612168

However

 data.matrix(realdata)
  person val1 val2 val3
1 NA  221   71  175
2 NA  222   85  147
Warning messages:
1: NAs introduced by coercion
2: NAs introduced by coercion

So then I converted 'person' from a list to factors, which removed the
coercision error, but barplot() still shows each bar as value instead
of a person.

My serialized() data subset is here (look at bottom half where there
are no line numbers)
http://pastebin.com/m6d1e1d79


Thanks in advance,
Andrew

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] ggplot2: annotated horizontal lines

2009-03-03 Thread Dave Murray-Rust

Hello,

I'm using geom_hline to add a minimum line to my plot (representing  
the best solution found so far by a search algorithm). I'd like to  
annotate this line with it's numerical value to save trying to read it  
off the graph, but I can't see a clear way to do this - any ideas?


(Alternatively, if this is against the spirit of the grammar of  
graphics, is there a better way to represent the information?)


Cheers,
dave


--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Fit indexes in SEM with categorical data + ML estimation

2009-03-03 Thread jebyrnes

Hey, Dorothee.  SEM does not use the S-B chi squared index.  If you want to
use it, however, I have some methods written for the Satorra-Bentler Chi
Square test in the sem.additions package over at r-forge.

To install it directly within R type
install.packages(sem.additions,repos=http://R-Forge.R-project.org;)

For more details, see http://r-forge.r-project.org/projects/sem-additions/



Dorothee wrote:
 
 Hello,
 
 
 It has been found that SEM analysis using polychoric correlations +
 maximum likelihood estimator produces incorrect test statistics and
 standard errors (e.g., Flora, D. B.,  Curran, P. J. (2004). An Empirical
 Evaluation of Alternative Methods of Estimation for Confirmatory Factor
 Analysis With Ordinal Data. Psychological Methods, 9(4), 466-491).
 
 Standard errors can be dealt with by using bootstrap estimations. But, I
 was wondering how the fit indexes in the SEM package were estimated when
 the observed variables are categorical (ordinal or/and binary) and when
 one is using polychoric correlation (hetcor in polycor package) in
 combination with ML. Does SEM use the Satorra-Bentler rescaled Chi-square
 for instance?
 I look in previous posts but couldn't find what i am looking for (hope i
 looked well enough!).
 
 
 Cheers,
 Dorothee
 
 

-- 
View this message in context: 
http://www.nabble.com/Fit-indexes-in-SEM-with-categorical-data-%2B-ML-estimation-tp21782611p22314468.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] ggplot2: annotated horizontal lines

2009-03-03 Thread baptiste auguie

What's wrong with geom_text?


 my.value = 0.65
 qplot(1,1)+geom_hline(v=0)+
geom_text(mapping=aes(x=1,y=0),label=paste(my.value),vjust=-1)



baptiste

On 3 Mar 2009, at 18:10, Dave Murray-Rust wrote:


Hello,

I'm using geom_hline to add a minimum line to my plot (representing
the best solution found so far by a search algorithm). I'd like to
annotate this line with it's numerical value to save trying to read it
off the graph, but I can't see a clear way to do this - any ideas?

(Alternatively, if this is against the spirit of the grammar of
graphics, is there a better way to represent the information?)

Cheers,
dave


--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


_

Baptiste Auguié

School of Physics
University of Exeter
Stocker Road,
Exeter, Devon,
EX4 4QL, UK

Phone: +44 1392 264187

http://newton.ex.ac.uk/research/emag

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] nlme: problem with fitting logistic function

2009-03-03 Thread jakub kreisinger
Dear colegues 
I am trying to analyze growth data on mice. To do this I attempted to fit 
logistic curve using nlme package. However, the dataset I use is large (in 
total ca 20 000 measures on ca 3 000 individuals) with relatively complicated 
structure (several explanatory variables with interactions + random effect 
where individual offspring are nested within particular litters are nested 
within particular parental pairs). 
Although I had no problems to fit models, where the complexity of random effect 
was reduce (which is conceptually incorrect), the fitting procedure of the full 
model did not reach the 1 iteration after several hours. Do you have any idea 
how to solve this problem? 

Thank you very much for your advice 
Best regards 
Jakub Kreisinger

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] locfit smoothing question (package maintainer not reachable)

2009-03-03 Thread David Winsemius
I think you should read (or re-read)  the locfit help page and *also*  
the links from that page to the help pages for locfit.raw and rv. I  
would have thought that since family= is not an argument to locfit per  
se, but rather is documented in locfit.raw that you have yet done so,  
but perhaps not?


--
David Winsemis
On Mar 3, 2009, at 12:39 PM, Suresh Krishna wrote:



Dear all,

I just realized that using family=qgauss restores normal-looking  
confidence bands... I read that using family=gaussian rather than  
family=qgauss fixes the dispersion parameter at 1, but without  
knowing the theory behind the code, I dont understand why there is  
such a difference between the two. If there is a simple explanation  
or recommendation, I am eager to hear it.


Thanks, Suresh


On Tue, 03 Mar 2009 16:56:43 +0100, Suresh Krishna madzient...@gmail.com 
 wrote:




Dear list members,

I am trying to understand this output from the smoothing package  
locfit (1.5-4, running on R 2.8.1 on Windows Vista 64 bit).


# sample code

x-1:100

y-rnorm(100)
fit-locfit(y~x,family=gaussian) #default parameters are fine
plot(fit,band=global)  #plot seems reasonable, confidence bands  
use a global estimate of variance


y-1000*rnorm(100)
fit-locfit(y~x,family=gaussian)
plot(fit,band=global) #aren't these confidence bands too small ?  
am i using this function wrongly ?


Using band=local gives results that seem to make more sense.  
Could someone offer me some guidance ?


Thanks, Suresh

ps. The package maintainer, Catherine Loader, is no longer  
reachable at her Auckland address.





__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] scatter plot question

2009-03-03 Thread Dipankar Basu
Hi R Users,

I have a dataframe like this:

id  x   rho
A  1   0.1
B  20  0.5
C  2   0.9
...

I want to do a scatter plot of x versus rho but for each point on the
scatter plot I want the corresponding entry for id instead of points. In
STATA I can do so by

twoway (scatter x rho, mlabel(id))

How can I do the same in R? I am sure there is some simple way to do this.

Dipankar

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] locfit smoothing question (package maintainer not reachable)

2009-03-03 Thread Liaw, Andy
From: Suresh Krishna
[...] 
 ps. The package maintainer, Catherine Loader, is no longer 
 reachable at  
 her Auckland address.

For the record, I'm the package maintainer for locfit, and I have not
exactly vanished (yet).  Please see the package description.

That said, it doesn't mean I know all the details about the code.  I
just do enough to keep the package on CRAN.

Best,
Andy
Notice:  This e-mail message, together with any attachme...{{dropped:12}}

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] save the layout using igraph

2009-03-03 Thread kevinchang

Hi R users,

I am using built-in functions in  igraph package to draw networks . I need
to compare several network with exactly the same structure but with edge
hightlighted differently.  I am wondering if there is a way to save the
layout so that every graph will look the same as each other except for the
colors of edges. Or is there any parameter I can set for this purpose??

Thanks in advance, 
Shukai
-- 
View this message in context: 
http://www.nabble.com/save-the-layout-using-igraph-tp22316155p22316155.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] rgl persp3d bounding box color problem.

2009-03-03 Thread chaogai
rgl_0.83-3  did not help

Duncan Murdoch wrote:
 On 3/2/2009 2:48 PM, chaogai wrote:
 Oops, sorry

 R version 2.8.1 (2008-12-22)
 i686-pc-linux-gnu

 locale:
 LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=C;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C


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

 other attached packages:
 [1] rgl_0.81svGUI_0.9-44svSocket_0.9-43 svMisc_0.9-46

 0.81 isn't the current version of rgl on CRAN.  Please try that one,
 or even better, the development version on R-forge.

 Duncan Murdoch


 Duncan Murdoch wrote:
 On 3/2/2009 2:00 PM, chaogai wrote:
 Whatever it is, it is also happening on my Acer,  Suse 11.1, 32 bits,
 self build R.

 Versions of R and rgl?

 Duncan Murdoch


 Kees

 Bo Zhou wrote:
 Thanks Duncan.

 I haven't got a chance to try it in windows yet. But I won't be
 surprised if it's my driver's fault. I had OpenGL problems on this
 dell laptop before.

  
 Date: Sun, 1 Mar 2009 18:29:20 -0500
 From: murd...@stats.uwo.ca
 To: bozhou1...@hotmail.com
 CC: remkoduur...@gmail.com; r-help@r-project.org
 Subject: Re: [R] rgl persp3d bounding box color problem.

 On 01/03/2009 5:54 PM, Bo Zhou wrote:
   
 site down..

 here is the code

 library(rgl)

 plot1:
 persp3d(x=1:11,y=1:210,z=matrix(rep(1,11*210),11,210),col=matrix(rep(#FF,11*210),11,210))



 plot2:
 persp3d(x=1:11,y=1:10,z=matrix(rep(1,11*10),11,10),col=matrix(rep(#FF,11*10),11,10))


   
 Works fine on Mac OS 10.5 too.  Looks like a bug in your OpenGL
 driver...

 Duncan Murdoch


   
 Thanks!

 Bo
 
 Date: Mon, 2 Mar 2009 09:28:31 +1100
 Subject: Re: [R] rgl persp3d bounding box color problem.
 From: remkoduur...@gmail.com
 To: bozhou1...@hotmail.com

 I would not mind trying, but the link no longer works...

 Remko


 -
 Remko Duursma
 Post-Doctoral Fellow

 Centre for Plant and Food Science
 University of Western Sydney
 Hawkesbury Campus
 Richmond NSW 2753

 Dept of Biological Science
 Macquarie University
 North Ryde NSW 2109
 Australia

 Mobile: +61 (0)422 096908



 On Mon, Mar 2, 2009 at 8:16 AM, Bo Zhou bozhou1...@hotmail.com
 wrote:
   
 Thanks, Duncan.

 What's your platform? Could this be an issues related to my
 platform? I'm on Ubuntu 8.10 64bit using cran's R package. I
 built rgl package on my machine using install.packages(). I'm
 going to give it a try in windows.

 I would be very grateful if anyone using similar setup could
 give it a try.

 Thanks,
 Bo

 
 Date: Sun, 1 Mar 2009 07:03:10 -0500
 From: murd...@stats.uwo.ca
 To: bozhou1...@hotmail.com
 CC: r-help@r-project.org
 Subject: Re: [R] rgl persp3d bounding box color problem.

 On 28/02/2009 4:20 PM, Bo Zhou wrote:
   
 Hi guys,

 I hit on a problem when I use rgl.

 Could you try to run the code here in this link and see why
 the first persp3d gives a red bounding box and the second
 shows black?
   
 They both show as black on my system.

 Duncan Murdoch

   
 http://rafb.net/p/g1i7ur33.html

 (sorry for not pasting the code here directly but my previous
 email got filtered by this list so I suspect my code looks
 like spam to the spam filter)

 I'm expecting black color to be the right result but the code
 is virtually same except different data size. Looks like a mem
 bug to me?


 BTW you will need to install the rgl package

 Thanks,

 Bo

 _



 [[alternative HTML version deleted]]

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible
 code.
   
 _


[[alternative HTML version deleted]]

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible
 code.

   
 _


 [[alternative HTML version deleted]]

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
   

 _
 Hotmail® is up to 70% faster. Now good news travels really fast.
 [[alternative HTML version deleted]]

  
 

Re: [R] Inefficiency of SAS Programming

2009-03-03 Thread Rolf Turner


On 3/03/2009, at 5:58 PM, Ajay ohri wrote:


for an  inefficient  language , it sure has dominated the predictive
analytics world for 3 plus decades.
I referred once to intellectual jealousy between newton and liebnitz.

i am going ahead and creating the R package called Anne.

It basically is meant only for SAS users who want to learn R ,
without upsetting the schedule of the corporate users.

Simply put , it is a wrapper on SAS language using the function  
command...ie
procunivariate function in Anne package would call the summary  
function

and so on...


Reminds me of fortune(38).

cheers,

Rolf Turner

##
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] save the layout using igraph

2009-03-03 Thread Gábor Csárdi
Shukai,

the layout functions return a matrix that you can supply as the
'layout' argument of the plotting functions, e.g.

g1 - erdos.renyi.game(50,2/50)
lay - layout.fruchterman.reingold(g1)
g2 - delete.edges(g1, sample(ecount(g1), 30)-1)
plot(g1, layout=lay, vertex.size=10)
plot(g2, layout=lay, vertex.size=10)

Best,
Gabor

On Tue, Mar 3, 2009 at 8:37 PM, kevinchang shu...@seas.upenn.edu wrote:

 Hi R users,

 I am using built-in functions in  igraph package to draw networks . I need
 to compare several network with exactly the same structure but with edge
 hightlighted differently.  I am wondering if there is a way to save the
 layout so that every graph will look the same as each other except for the
 colors of edges. Or is there any parameter I can set for this purpose??

 Thanks in advance,
 Shukai
 --
 View this message in context: 
 http://www.nabble.com/save-the-layout-using-igraph-tp22316155p22316155.html
 Sent from the R help mailing list archive at Nabble.com.

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.




-- 
Gabor Csardi gabor.csa...@unil.ch UNIL DGM

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] ggplot2: annotated horizontal lines

2009-03-03 Thread Dave Murray-Rust


On 3 Mar 2009, at 18:41, baptiste auguie wrote:


What's wrong with geom_text?


my.value = 0.65
qplot(1,1)+geom_hline(v=0)+
geom_text(mapping=aes(x=1,y=0),label=paste(my.value),vjust=-1)




Well, firstly I hadn't thought to use it. Ooops.

Secondly, I can't make it just do a single value - it seems to want a  
value for every point in the dataset, e.g.:


  qplot( wt, mpg, data=mtcars ) +  
geom_text(mapping=aes(x=1,y=0,label=paste(0.5),vjust=-1))

Error in data.frame(..., check.names = FALSE) :
  arguments imply differing number of rows: 1, 32

Cheers,
dave




baptiste

On 3 Mar 2009, at 18:10, Dave Murray-Rust wrote:


Hello,

I'm using geom_hline to add a minimum line to my plot (representing
the best solution found so far by a search algorithm). I'd like to
annotate this line with it's numerical value to save trying to read  
it

off the graph, but I can't see a clear way to do this - any ideas?

(Alternatively, if this is against the spirit of the grammar of
graphics, is there a better way to represent the information?)

Cheers,
dave


--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


_

Baptiste Auguié

School of Physics
University of Exeter
Stocker Road,
Exeter, Devon,
EX4 4QL, UK

Phone: +44 1392 264187

http://newton.ex.ac.uk/research/emag
__





--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] par and a substitute for mtext to write one time a title per page

2009-03-03 Thread Aldi Kraja

RE: par and a substitute for mtext to write one time a title per page


Hi,
Q1. Is there way I can set mfg =c(2,1) which for me could have meant 2 
pages and no split on the columns per page; and mfrow =c(4,1) which for 
me it means 4 graphs per page in the par function?
So if I have a pdf/png etc file I will output two pages with 4 graphs 
for each, or modifiable depending on the case of data?

I obtain the following:

Error in par(mfg = c(2, 1), mfrow = c(4, 1)) :
 parameter i in mfg is out of range

steps:
1. open outstream: pdf(file=some_address_and_file.pdf)
2. do the corresponding loop to prepare the graphs for specific data
3. plot 2 or more pages of graphs with 4 graphs per page
4. close the outstream.

Q2: with mtext function I can write in the outter margin including a 
title as a header.
Is there another way to write a title one time per page in these 
multiple graphs, so I can save the graphs space per page?


Thank you in advance,

Aldi

--

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] repeated measures anova, sphericity, epsilon, etc

2009-03-03 Thread Paul Gribble
I have 3 questions (below).

Background: I am teaching an introductory statistics course in which we are
covering (among other things) repeated measures anova. This time around
teaching it, we are using R for all of our computations. We are starting by
covering the univariate approach to repeated measures anova.

Doing a basic repeated measures anova (univariate approach) using aov()
seems straightforward (e.g.:

+ myModel-aov(myDV~myFactor+Error(Subjects/myFactor),data=myData)
+ summary(myModel)

Where I am currently stuck is how best to deal with the issue of the
assumption of homogeneity of treatment differences (in other words, the
sphericity assumption) - both how to test it in R and how to compute
corrected df for the F-test if the assumption is violated.

Back when I taught this course using SPSS it was relatively straightforward
- we would look at Mauchly's test of sphericity - if it was significant,
then we would use one of the corrected F-tests (e.g. Greenhouse-Geisser or
Huynh-Feldt) that were spat out automagically by SPSS.

I gather from searching the r-help archives, searching google, and searching
through various books on R, that the only way of using mauchly.test() in R
is on a multivariate model object (e.g. mauchly.test cannot handle an aov()
object).

Question 1: how do you (if you do so), test for sphericity in a repeated
measures anova using R, when using aov()? (or do you test the sphericity
assumption using a different method)?

Question 2: Can someone point me to an example (on the web, in a book,
wherever) showing how to perform a repeated measures anova using the
multivariate approach in R?

Question 3: Are there any existing R functions for calculating adjusted df
for Greenhouse-Geisser, Huynh-Feldt (or calculating epsilon), or is it up to
me to write my own function?

Thanks in advance for any suggestions,

-- 
Paul L. Gribble, Ph.D.
Associate Professor
Dept. Psychology
The University of Western Ontario
London, Ontario
Canada N6A 5C2
Tel. +1 519 661 2111 x82237
Fax. +1 519 661 3961
pgrib...@uwo.ca
http://gribblelab.org

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] locfit smoothing question (package maintainer not reachable)

2009-03-03 Thread Suresh Krishna


David Winsemis wrote:

I think you should read (or re-read)  the locfit help page and *also*  
the links from that page to the help pages for locfit.raw and rv. I  
would have thought that since family= is not an argument to locfit per  
se, but rather is documented in locfit.raw that you have yet done so,  
but perhaps not?


I did read the help pages for locfit.raw, and found:

Local likelihood family; gaussian; binomial; poisson; gamma and  
geom. Density and rate estimation families are dens, rate and  
hazard (hazard rate). If the family is preceded by a 'q' (for example,  
family=qbinomial), quasi-likelihood variance estimates are used.  
Otherwise, the residual variance (rv) is fixed at 1. The default family is  
qgauss if a response y is provided; density if no response is  
provided. 


However, since the fake data were generated from a known gaussian  
distribution, I did not imagine that using family=gaussian would lead to  
such wildly different results. This is what I was hoping to understand,  
without having to struggle with Catherine's Loader book in order to  
understand the above paragraph deeply enough that this behavior makes  
sense.


Thanks again, Suresh

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] modifying a built in function from the stats package (fixing arima)

2009-03-03 Thread Carlos J. Gil Bellosta
Hello,

I do not think that is the way to go. If you believe that your algorithm
is better than the existing one, talk to the author of the package and
discuss the improvement. The whole community will benefit.

If you want to tune the existing function and tailor it to your needs,
you have several ways to go, among them:

1) Copy the existing function into a new file, edit it and load it via
source.

2) Download the source package and modify it for your own purposes.

Best regards,

Carlos J. Gil Bellosta
http://www.datanalytics.com


On Tue, 2009-03-03 at 18:20 +0100, Marc Vinyes wrote:
 Dear members of the list,
 
 I'm a beginner in R and I'm having some trouble with: Error in
 optim(init[mask], armafn, method = BFGS, hessian = TRUE, control =
 optim.control,  :
   non-finite finite-difference value [8]
 
 when running arima.
 
 I've seen that some people have come accross the same problem:
 https://stat.ethz.ch/pipermail/r-help/2008-August/169660.html
 
 So I'd like to modify the code of arima to change the optimization function
 with another one that handles these problems automatically , however I don't
 find the way to do it and
 http://tolstoy.newcastle.edu.au/R/e6/help/09/01/2476.html points out a way
 that doesn't work for me:
 
 * If I type edit(arima) and I modify it, changes are not saved,
 * If I copy the code and I save it like a different function, I get the hard
 error: Error in Delta %+% c(1, -1) : object R_TSconv not found
 
 Anybody can give me a hint? I miss matlab's easy way of doing this (edit
 function.m).
 
 Thanks in advance
 
 MarC (AleaSoft)
 
   [[alternative HTML version deleted]]
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] spatial markov chain methods

2009-03-03 Thread Rolf Turner


On 4/03/2009, at 4:36 AM, Torsten Lange wrote:


Hello,

can any one point me to R-packages (if available) which include  
spatial

Markov Chain methods?
My second question is more general but hopefully not OT: Currently we
are using the software TPROGS, which let people simulate property
distributions in space by some Markov Chain approaches. We face some
problems due to the lack of information between distances of samples
along borehole path and among boreholes. Is there any way to  
trick it

like for instants in variogram modeling were one might use nested
variograms...?


The spatstat package has facilities for simulating (non-Poisson) spatial
point processes vi MCMC (Metropolis-Hastings) methods.  But it's  
probably

not point patterns that you're after.

cheers,

Rolf Turner

##
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] xlsReadWrite package repository for Ubuntu

2009-03-03 Thread Hans-Peter Suter
2009/3/2 Prof Brian Ripley rip...@stats.ox.ac.uk:
 The CRAN Windows ones.  It is a windows-only package, see
 http://cran.r-project.org/web/packages/xlsReadWrite/index.html
 (incidentally to you: it seems no longer maintained and does not build under
 R-devel on Windows, see
 http://cran.r-project.org/bin/windows/contrib/2.9/check/xlsReadWrite-check.log
 The maintainer has not responded to requests for a fix.)

I didn't get a request (my email was 'gcha...@gmail instead of
gcha...@gmail.com). I'll look into the issue this weekend.

However there might be a problem because the package contains binary
code and maybe xlsReadWrite has to be put on a place other than CRAN
(I'll ask Rcore about this in a separate email). In any case I
absolutely intend to maintain the package also in future. AFAIK it
works well (apart from a small rowname bug which surfaced recently ;-)
and provides a pragmatic alternative to the OSS R packages gdata and
RODBC)

2009/3/3 Marc Schwartz marc_schwa...@comcast.net:
 You perhaps missed the key point in Uwe's response, which is that the
 package is only available under Windows, as it depends upon Windows
 specific functionality (MS Office API via a third party library which is
 available for Windows only) to natively read and write Excel files.

It's correct that xlsReadWrite is currently only available for
Windows. However it doesn't use the MS Office API but  works directly
with the file format (BIFF8), i.e. Excel is _not_ required. True is,
that it uses a third party library (Flexcel, TMSSoftware). This
library supports FreePascal which means that theoretically
xlsReadWrite could be compiled for Linux/Mac (tried once, didn't
succeed, will try again later (now also using Macs and
Debian/Ubuntu)).

-- 
Regards,
Hans-Peter

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] xlsReadWrite package repository for Ubuntu

2009-03-03 Thread Rolf Turner


On 4/03/2009, at 2:38 AM, Marc Schwartz wrote:


You perhaps missed the key point in Uwe's response, which is that the
package is only available under Windows, as it depends upon Windows
specific functionality (MS Office API via a third party library  
which is

available for Windows only) to natively read and write Excel files.
Thus, there is no package version available for Linux, or OSX for that
matter.

If you need to read Excel files under Linux, you could look at the
read.xls() function in the 'gdata' CRAN package. This package requires
that Perl be installed, as it calls a Perl routine (xls2csv) for
converting the Excel file to a CSV file, which can then be read  
into R.


If you need to write Excel files under Linux, you can use a Perl  
routine

that I had posted back in 2007:

  https://stat.ethz.ch/pipermail/r-help/2007-July/135968.html

and have updated since then to handle Unicode issues. I am attaching a
2k text file here with the updated routine.


For those needing to write *.xls files as well as read them, the  
write.xls
function in the package dataframes2xls might be useful.  I have no  
actual

experience in using it, but.

cheers,

Rolf Turner

##
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] ggplot2: annotated horizontal lines

2009-03-03 Thread baptiste auguie
I see your problem (although label should be outside the mapping in  
your case, i think).


A possible workaround is to provide some dummy data, as the default  
NULL doesn't seem to work,


 qplot( wt, mpg, data=mtcars ) +
 geom_text(data=data.frame(x=0,y=0),mapping=aes(x=1,y=0),label=test)

I'm sure Hadley will come up with a better explanation.

Best,

baptiste

On 3 Mar 2009, at 19:51, Dave Murray-Rust wrote:



On 3 Mar 2009, at 18:41, baptiste auguie wrote:


What's wrong with geom_text?


my.value = 0.65
qplot(1,1)+geom_hline(v=0)+
geom_text(mapping=aes(x=1,y=0),label=paste(my.value),vjust=-1)




Well, firstly I hadn't thought to use it. Ooops.

Secondly, I can't make it just do a single value - it seems to want a
value for every point in the dataset, e.g.:


qplot( wt, mpg, data=mtcars ) +

geom_text(mapping=aes(x=1,y=0,label=paste(0.5),vjust=-1))
Error in data.frame(..., check.names = FALSE) :
  arguments imply differing number of rows: 1, 32

Cheers,
dave




baptiste

On 3 Mar 2009, at 18:10, Dave Murray-Rust wrote:


Hello,

I'm using geom_hline to add a minimum line to my plot (representing
the best solution found so far by a search algorithm). I'd like to
annotate this line with it's numerical value to save trying to read
it
off the graph, but I can't see a clear way to do this - any ideas?

(Alternatively, if this is against the spirit of the grammar of
graphics, is there a better way to represent the information?)

Cheers,
dave


--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


_

Baptiste Auguié

School of Physics
University of Exeter
Stocker Road,
Exeter, Devon,
EX4 4QL, UK

Phone: +44 1392 264187

http://newton.ex.ac.uk/research/emag
__





--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.



_

Baptiste Auguié

School of Physics
University of Exeter
Stocker Road,
Exeter, Devon,
EX4 4QL, UK

Phone: +44 1392 264187

http://newton.ex.ac.uk/research/emag

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] repeated measures anova, sphericity, epsilon, etc

2009-03-03 Thread Peter Dalgaard

Paul Gribble wrote:

I have 3 questions (below).

Background: I am teaching an introductory statistics course in which we are
covering (among other things) repeated measures anova. This time around
teaching it, we are using R for all of our computations. We are starting by
covering the univariate approach to repeated measures anova.

Doing a basic repeated measures anova (univariate approach) using aov()
seems straightforward (e.g.:

+ myModel-aov(myDV~myFactor+Error(Subjects/myFactor),data=myData)
+ summary(myModel)

Where I am currently stuck is how best to deal with the issue of the
assumption of homogeneity of treatment differences (in other words, the
sphericity assumption) - both how to test it in R and how to compute
corrected df for the F-test if the assumption is violated.

Back when I taught this course using SPSS it was relatively straightforward
- we would look at Mauchly's test of sphericity - if it was significant,
then we would use one of the corrected F-tests (e.g. Greenhouse-Geisser or
Huynh-Feldt) that were spat out automagically by SPSS.

I gather from searching the r-help archives, searching google, and searching
through various books on R, that the only way of using mauchly.test() in R
is on a multivariate model object (e.g. mauchly.test cannot handle an aov()
object).

Question 1: how do you (if you do so), test for sphericity in a repeated
measures anova using R, when using aov()? (or do you test the sphericity
assumption using a different method)?

Question 2: Can someone point me to an example (on the web, in a book,
wherever) showing how to perform a repeated measures anova using the
multivariate approach in R?

Question 3: Are there any existing R functions for calculating adjusted df
for Greenhouse-Geisser, Huynh-Feldt (or calculating epsilon), or is it up to
me to write my own function?

Thanks in advance for any suggestions,


Have a look at

http://cran.r-project.org/doc/Rnews/Rnews_2007-2.pdf

Last time this came up, John Fox also pointed to some of his stuff, see 
http://finzi.psych.upenn.edu/R/Rhelp08/archive/151282.html


--
   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - (p.dalga...@biostat.ku.dk)  FAX: (+45) 35327907

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] locfit smoothing question (package maintainer not reachable)

2009-03-03 Thread David Winsemius
That is what I thought to be the critical paragraph. The variance is  
assumed to be = 1 when you use family=gaussian rather than the  
default of family=qgauss. You give it a vector, 1000*rnorm(100),  
that ranges widely and a small (relative) variance is assumed and so  
the confidence intervals are plotted as very narrow. This does not  
seem surprising given the functions documented design. I have the book  
and do not think I even need to pull it off the shelf since the help  
pages appear fully informative in this instance. I get an rv of 1 with  
the gaussian option and an rv of nearly 1000 when the default is used.


--
David Winsemius


On Mar 3, 2009, at 3:26 PM, Suresh Krishna wrote:



David Winsemis wrote:

I think you should read (or re-read)  the locfit help page and  
*also* the links from that page to the help pages for locfit.raw  
and rv. I would have thought that since family= is not an argument  
to locfit per se, but rather is documented in locfit.raw that you  
have yet done so, but perhaps not?


I did read the help pages for locfit.raw, and found:

Local likelihood family; gaussian; binomial; poisson; gamma  
and geom. Density and rate estimation families are dens, rate  
and hazard (hazard rate). If the family is preceded by a 'q' (for  
example, family=qbinomial), quasi-likelihood variance estimates  
are used. Otherwise, the residual variance (rv) is fixed at 1. The  
default family is qgauss if a response y is provided; density if  
no response is provided. 


However, since the fake data were generated from a known gaussian  
distribution, I did not imagine that using family=gaussian would  
lead to such wildly different results. This is what I was hoping to  
understand, without having to struggle with Catherine's Loader book  
in order to understand the above paragraph deeply enough that this  
behavior makes sense.


Thanks again, Suresh

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] sm.density.compare

2009-03-03 Thread James Lenihan
I am running the sm.density.compare function amd I am getting the following 
error:
 
my code is   sm.density.compare(LBSTRESN,COHORT,xlab=Units = umol/Lsubset = 
LBTEST==Creatinine)
 
Error in if (from == to) rep.int(from, length.out) else as.vector(c(from,  : 
  missing value where TRUE/FALSE needed
 
I do not understand the error and I have had no help when searching the WEB or 
the R documentation.
 
I have tried the sample program in the R doc:y - rnorm(100)
g - rep(1:2, rep(50,2))
sm.density.compare(y, g, model=equal)
 and it works fine.   The only difference with my data is that I have some 
missing values that show as NA. I have checked that theseare numbered values by 
using the is.nan function. Any ideas? Thank You Jim L. 


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] spatial markov chain methods

2009-03-03 Thread Torsten Lange

Rolf Turner schrieb:


On 4/03/2009, at 4:36 AM, Torsten Lange wrote:


Hello,

can any one point me to R-packages (if available) which include spatial
Markov Chain methods?
My second question is more general but hopefully not OT: Currently we
are using the software TPROGS, which let people simulate property
distributions in space by some Markov Chain approaches. We face some
problems due to the lack of information between distances of samples
along borehole path and among boreholes. Is there any way to trick it
like for instants in variogram modeling were one might use nested
variograms...?


The spatstat package has facilities for simulating (non-Poisson) spatial
point processes vi MCMC (Metropolis-Hastings) methods.  But it's probably
not point patterns that you're after.

cheers,

Rolf Turner

Thanks Rolf! To be more specific I'm a novice to MC method. However, I 
don't look on point processes but on spatial auto-correlation of certain 
types of soils or sediments in 3D - parameterization for geoscientific 
applications like hydrogeology... We created the MC transiograms for 
soil classes in vertical and horizontal directions. Problems arise due 
to the observation gap between sampling density in vertical (very high 
along borehole) and horizontal direction (much lower because of 
distances among boreholes).


Thank you for any hints,
Torsten

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] repeated measures anova, sphericity, epsilon, etc

2009-03-03 Thread Paul Gribble

 Have a look at

 http://cran.r-project.org/doc/Rnews/Rnews_2007-2.pdf


Wow. I think my students would keel over.


Anova() from the car package looks promising - I will check it out. Thanks


On Tue, Mar 3, 2009 at 4:00 PM, Peter Dalgaard p.dalga...@biostat.ku.dkwrote:

 Paul Gribble wrote:

 I have 3 questions (below).

 Background: I am teaching an introductory statistics course in which we
 are
 covering (among other things) repeated measures anova. This time around
 teaching it, we are using R for all of our computations. We are starting
 by
 covering the univariate approach to repeated measures anova.

 Doing a basic repeated measures anova (univariate approach) using aov()
 seems straightforward (e.g.:

 + myModel-aov(myDV~myFactor+Error(Subjects/myFactor),data=myData)
 + summary(myModel)

 Where I am currently stuck is how best to deal with the issue of the
 assumption of homogeneity of treatment differences (in other words, the
 sphericity assumption) - both how to test it in R and how to compute
 corrected df for the F-test if the assumption is violated.

 Back when I taught this course using SPSS it was relatively
 straightforward
 - we would look at Mauchly's test of sphericity - if it was significant,
 then we would use one of the corrected F-tests (e.g. Greenhouse-Geisser or
 Huynh-Feldt) that were spat out automagically by SPSS.

 I gather from searching the r-help archives, searching google, and
 searching
 through various books on R, that the only way of using mauchly.test() in R
 is on a multivariate model object (e.g. mauchly.test cannot handle an
 aov()
 object).

 Question 1: how do you (if you do so), test for sphericity in a repeated
 measures anova using R, when using aov()? (or do you test the sphericity
 assumption using a different method)?

 Question 2: Can someone point me to an example (on the web, in a book,
 wherever) showing how to perform a repeated measures anova using the
 multivariate approach in R?

 Question 3: Are there any existing R functions for calculating adjusted df
 for Greenhouse-Geisser, Huynh-Feldt (or calculating epsilon), or is it up
 to
 me to write my own function?

 Thanks in advance for any suggestions,


 Have a look at

 http://cran.r-project.org/doc/Rnews/Rnews_2007-2.pdf

 Last time this came up, John Fox also pointed to some of his stuff, see
 http://finzi.psych.upenn.edu/R/Rhelp08/archive/151282.html

 --
   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
  (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
 ~~ - (p.dalga...@biostat.ku.dk)  FAX: (+45) 35327907




-- 
Paul L. Gribble, Ph.D.
Associate Professor
Dept. Psychology
The University of Western Ontario
London, Ontario
Canada N6A 5C2
Tel. +1 519 661 2111 x82237
Fax. +1 519 661 3961
pgrib...@uwo.ca
http://gribblelab.org

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] par and a substitute for mtext to write one time a title per page

2009-03-03 Thread Aldi Kraja

Hmm,

Reading some responses in the archives on mfg, the first one was simple 
the mfg does not control the pages.
After removing mfg=c(2,1), and leaving in the program only mfrow=(4,1) 
although I am printing one after the other in a loop, pages are printed 
and do not overwrite the same page.


So by defining mfrow only, one can extend to many pages with no problem.

Q2. Here is a small test program:
x-rnorm(1000)
y-rnorm(1000)
par(mfrow=c(2,1))
plot(x,y)
mtext(This is my title,3,line=1)
mtext(This is my title,3,line=2)
mtext(This is my title,3,line=3)
plot(x,y)

Is there a function that can print a title in every one new page outside 
of the space designated for graphs, instead of me finding the first 
graph that starts the page and there using mtext as shown above?


Thanks,

Aldi

Aldi Kraja wrote:

RE: par and a substitute for mtext to write one time a title per page


Hi,
Q1. Is there way I can set mfg =c(2,1) which for me could have meant 2 
pages and no split on the columns per page; and mfrow =c(4,1) which 
for me it means 4 graphs per page in the par function?
So if I have a pdf/png etc file I will output two pages with 4 graphs 
for each, or modifiable depending on the case of data?

I obtain the following:

Error in par(mfg = c(2, 1), mfrow = c(4, 1)) :
 parameter i in mfg is out of range

steps:
1. open outstream: pdf(file=some_address_and_file.pdf)
2. do the corresponding loop to prepare the graphs for specific data
3. plot 2 or more pages of graphs with 4 graphs per page
4. close the outstream.

Q2: with mtext function I can write in the outter margin including a 
title as a header.
Is there another way to write a title one time per page in these 
multiple graphs, so I can save the graphs space per page?


Thank you in advance,

Aldi

--

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

and provide commented, minimal, self-contained, reproducible code.


--

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] scatter plot question

2009-03-03 Thread Mark Lyman
Dipankar Basu basu.15 at gmail.com writes:

 
 Hi R Users,
 
 I have a dataframe like this:
 
 id  x   rho
 A  1   0.1
 B  20  0.5
 C  2   0.9
 ...
 
 I want to do a scatter plot of x versus rho but for each point on the
 scatter plot I want the corresponding entry for id instead of points.

test - data.frame(id=c(A, B, C), x=c(1, 20, 2), rho=c(0.1, 0.5, 0.9))
plot(rho~x, test, pch=as.character(id))

Mark Lyman

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] portable R editor

2009-03-03 Thread Erich Neuwirth
EditPad Pro is commercial, which makes it a nonchoice for recommending
it to my students.
I recently switched from tinn-R to Notepad++ with NppToR and am quite
happy with it. tinn-R is quite good, but possibly the project is
getting too ambitous now. It needs quite some fiddling with
Rprofile.site to make it work.





Thompson, David (MNR) wrote:
 Werner,
 
 Another alternative is EditPad Pro http://www.editpadpro.com/.
 
 DaveT.
 *
 Silviculture Data Analyst
 Ontario Forest Research Institute
 Ontario Ministry of Natural Resources
 david.john.thomp...@ontario.ca
 http://ontario.ca/ofri
 *
 -Original Message-
 From: Andrew Redd [mailto:ar...@stat.tamu.edu] 
 Sent: March 2, 2009 10:29 PM
 To: Michael Bibo
 Cc: r-h...@stat.math.ethz.ch
 Subject: Re: [R] portable R editor

 Thanks for the plug on NppToR.  Yes it is portable, but a few of the
 features don't work. I have it on my plan to have a launcher for the
 portable apps menu.  Also the website for NppToR is now
 https://sourceforge.net/projects/npptor/

 On my personal website I also keep, semi-up-to-date a
 portableapps.comcompatible launcher for R.
 http://www.stat.tamu.edu/~aredd/site/?q=node/2.  There is a full
 installation and just the launcher.  If you download just the 
 launcher you
 can install the latest version of R into the bin directory and It will
 work.  I think it is version 2.8.0 in the installer.  I'll 
 update that soon.

 Andrew Redd

 On Mon, Mar 2, 2009 at 8:13 PM, Michael Bibo 
 michael_b...@health.qld.gov.au
 wrote:
 Werner Wernersen pensterfuzzer at yahoo.de writes:


 Hi,

 I have been dreaming about a complete R environment on my 
 USB stick for a
 long time. Now I finally want to
 realize it but what I am missing is a good, portable 
 editor for R which
 has
 tabs and syntax highlighting, can
 execute code, has bookmarks and a little project file 
 management facility
 pretty much like Tinn-R has
 those. I like Tinn-R but it seems like there is only a 
 very old version
 of
 Tinn-R which works standalone.

 Hi Werner,

 Three options:

 I have previously posted about using Emacs + ESS on a USB stick:
 http://finzi.psych.upenn.edu/R/Rhelp02/archive/107419.html

 Tinn-R will work portably.  I have simply copied the installed Tinn-R
 folder
 from one machine to another on which I do not have 
 administrator privileges
 and therefore cannot do a normal install.

 Another option is Notepad++ (http://notepad-
 plus.sourceforge.net/uk/site.htm).  There is even a portable version
 available
 fom www.portableapps.com.  Andrew Redd has created (and is 
 continuing to
 develop) NppToR 
 (http://www.stat.tamu.edu/~aredd/site/?q=node/37http://www.sta
 t.tamu.edu/%7Earedd/site/?q=node/37)
 which
 provides syntax highlighting, code folding and code passing to R.
  Notepad++
 has a tabbed interface as well as add-ons including a file explorer,
 windows
 manager and multiclipboard manager.  It also allows for the 
 recording of
 macros, and the instructions found at this blog

 (http://aztecpassage.blogspot.com/2007/11/load-new-file-from-te
 mplate-in-
 notepad.htmlhttp://aztecpassage.blogspot.com/2007/11/load-new-
 file-from-template-in-%0Anotepad.html)
 use Notepad++'s built-in capacity to run external tools to
 create new files from templates.


 Michael Bibo
 Queensland Health

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

  [[alternative HTML version deleted]]



 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 
 
 
 
 
 No virus found in this incoming message.
 Checked by AVG - www.avg.com 
 Version: 8.0.237 / Virus Database: 270.11.6/1980 - Release Date: 03/02/09 
 23:02:00
 

-- 
Erich Neuwirth, University of Vienna
Faculty of Computer Science
Computer Supported Didactics Working Group
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-39464 Fax: +43-1-4277-39459

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] detect outliers and high levarage points

2009-03-03 Thread choonhong ang
Hi friends,

How to detect outliers and high leverage points for GLM ?

Could I use plot(model)
(i) Residuals vs Fitted graph to detect the outliers ?
(ii) Residuals vs Leverage graph to detect the high leverage points ?
And then remove those points from the data and re-run the model ?

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] clust with hclustWard

2009-03-03 Thread Anirudh Kondaveeti
Hello everyone

I tried to use clust function using hclustWard clustering method
The distance mesaured I have used is rf
The data used is in the form of data frame (it is not a distance matrix) -
sd.df

The piece of code I have used is:
c1 - clust(sd.df,k=6,method=hclustWard,distMethod=rf)

But I get the following error message,

Error in if (n  2) stop(must have n = 2 objects to cluster) :
  argument is of length zero

Could any one help me with this? Also I tried to check the code of clust to
find out where this error message appears in the code and I could not find
it. Please let me know how can I make the clust work for hclustWard
method. Thanks!

Anirudh Kondaveeti


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Inference for R Spam

2009-03-03 Thread Michael A. Miller
 Dieter == Dieter Menne dieter.me...@menne-biomed.de writes:

 And, since my son asked me and I am basketball ignorant:
 Why are basketball scores mostly much too close to
 equality? The arguments (loose power when leading) might
 suggest that 2:0 might not be significant, but relevant. I
 tend to argue the other way round though, in medical
 statistics.

Sports scores are not statistics, they are measurements (counts)
of the number of times each team scores.  There is no sampling
and vanishingly small possibility of systematic error in the
measurement.

Mike

-- 
Michael A. Miller mmill...@iupui.edu
  Department of Radiology, Indiana University School of Medicine

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] reading scanned graphs

2009-03-03 Thread Aad Termorshuizen

   I have a graph (a curve with a x- and y-axis) on paper. (The device from
   which  I  receive  this  is  not  able  to  output  the data digitally
   unfortunately.) Is there a procedure by which I can scan the graph, save it
   into, e.g., a bitmap file and make it R to read this file into x and y
   coordinates?
   Thanks, Aad Termorshuizen
 _

   
   
   Disclaimer:
   Dit e-mailbericht is uitsluitend bestemd voor de geadresseerde(n). Indien
   dit e-mailbericht niet voor u bestemd is, verzoeken wij u vriendelijk doch
   dringend,  de  afzender  van  het bericht op hoogte te brengen en alle
   informatie  uit uw computer te verwijderen zonder acht te nemen van de
   inhoud.
   
   
   This E-mail has been scanned for viruses by the McAfee Appliance of Blgg
   B.V.
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] reading scanned graphs

2009-03-03 Thread Remko Duursma
Check out

http://www.datathief.org/


Remko

-
Remko Duursma
Post-Doctoral Fellow

Centre for Plant and Food Science
University of Western Sydney
Hawkesbury Campus
Richmond NSW 2753

Dept of Biological Science
Macquarie University
North Ryde NSW 2109
Australia

Mobile: +61 (0)422 096908



2009/3/4 Aad Termorshuizen aad.termorshui...@blgg.nl:

   I have a graph (a curve with a x- and y-axis) on paper. (The device from
   which  I  receive  this  is  not  able  to  output  the data digitally
   unfortunately.) Is there a procedure by which I can scan the graph, save it
   into, e.g., a bitmap file and make it R to read this file into x and y
   coordinates?
   Thanks, Aad Termorshuizen
     _

   
   
   Disclaimer:
   Dit e-mailbericht is uitsluitend bestemd voor de geadresseerde(n). Indien
   dit e-mailbericht niet voor u bestemd is, verzoeken wij u vriendelijk doch
   dringend,  de  afzender  van  het bericht op hoogte te brengen en alle
   informatie  uit uw computer te verwijderen zonder acht te nemen van de
   inhoud.
   
   
   This E-mail has been scanned for viruses by the McAfee Appliance of Blgg
   B.V.
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] periodogram smoothing question

2009-03-03 Thread otunno
Hello -

I am currently simulating bivariate AR(1) time series data and have the
following line in my code:

Px=spec.pgram(ts.union(X,XX),spans=c(?,?))

The spans option is where I enter in the vector containing the Daniell
smoother numbers, but I don't know what a Daniell smoother is (hence the
question marks). Can somebody please tell me?

Is there another option where I can simply enter in the smoothing window
width?

Thanks, Ferebee

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] reading scanned graphs

2009-03-03 Thread Frank E Harrell Jr

Remko Duursma wrote:

Check out

http://www.datathief.org/


Remko


For Linux I recommend the engauge-digitizer package.
Frank



-
Remko Duursma
Post-Doctoral Fellow

Centre for Plant and Food Science
University of Western Sydney
Hawkesbury Campus
Richmond NSW 2753

Dept of Biological Science
Macquarie University
North Ryde NSW 2109
Australia

Mobile: +61 (0)422 096908



2009/3/4 Aad Termorshuizen aad.termorshui...@blgg.nl:

  I have a graph (a curve with a x- and y-axis) on paper. (The device from
  which  I  receive  this  is  not  able  to  output  the data digitally
  unfortunately.) Is there a procedure by which I can scan the graph, save it
  into, e.g., a bitmap file and make it R to read this file into x and y
  coordinates?
  Thanks, Aad Termorshuizen
_

  
  
  Disclaimer:
  Dit e-mailbericht is uitsluitend bestemd voor de geadresseerde(n). Indien
  dit e-mailbericht niet voor u bestemd is, verzoeken wij u vriendelijk doch
  dringend,  de  afzender  van  het bericht op hoogte te brengen en alle
  informatie  uit uw computer te verwijderen zonder acht te nemen van de
  inhoud.
  
  
  This E-mail has been scanned for viruses by the McAfee Appliance of Blgg
  B.V.
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.




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

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] score test statistic in logistic regression

2009-03-03 Thread Greg Dropkin
re post from

bkelcey at umich.edu bkelcey at umich.edu
Wed Feb 27 15:09:48 CET 2008

If the response y is given as the proportion of successes out of n trials,
and y, n, p, x, and z are vectors of length M, and the model is logit(p) =
b0 + b1*x + b2*z then for the score test for the null hypothesis b1=0 use

des-array(c(rep(1,M),x,z),dim=c(M,3))
m0-glm(y~z,binomial,weights=n)
f-fitted(m0)
efscor-1:3
for (i in 1:3)
{
efscor[i]-sum((y-f)*n*des[,i])
}
fim-outer(1:3,1:3)
for (i in 1:3)
{
for (j in 1:3)
{
fim[i,j]-sum(des[,i]*des[,j]*n*f*(1-f))
}
}
score-crossprod(efscor,crossprod(solve(fim),efscor))
score


ok?

greg

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


  1   2   >