[R] R-help Digest, Vol 67, Issue 31

will2213 at umn.edu will2213 at umn.edu
Wed Oct 15 03:35:50 CEST 2008


V;
Sent via BlackBerry from T-Mobile

-----Original Message-----
From: r-help-request at r-project.org

Date: Tue, 30 Sep 2008 12:00:06 
To: <r-help at r-project.org>
Subject: R-help Digest, Vol 67, Issue 31


Send R-help mailing list submissions to
	r-help at r-project.org

To subscribe or unsubscribe via the World Wide Web, visit
	https://stat.ethz.ch/mailman/listinfo/r-help
or, via email, send a message with subject or body 'help' to
	r-help-request at r-project.org

You can reach the person managing the list at
	r-help-owner at r-project.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of R-help digest..."


Today's Topics:

   1. Re: GAMSetup (Simon Wood)
   2. Hazard plot (Laura Bonnett)
   3. Re: histogram-like plot with two variables (Duncan Murdoch)
   4. Re: histogram-like plot with two variables (Jim Lemon)
   5. Re: problem running Sweave as a web service with anti-virus
      software (Duncan Murdoch)
   6. Re: Dream of a wiki GUI for R (Philippe Grosjean)
   7. Located Latent Class Analysis (Uebersax) (Karen Chan)
   8. Re: Bug in "is" ? (Wacek Kusnierczyk)
   9. Re: density estimate (Eik Vettorazzi)
  10. Re: histogram-like plot with two variables (Philipp Pagel)
  11. Re: FW:  logistic regression (Frank E Harrell Jr)
  12. Re: example - export a data frame to an XML file (zubin)
  13. Re: Bug in "is" ? (Wacek Kusnierczyk)
  14. Re: Bug in "is" ? (Wacek Kusnierczyk)
  15. Re: GamSetup (Gavin Simpson)
  16. Re: Cross-tabulation Question (jim holtman)
  17. adding labels to tapply results (eric lee)
  18. Re: Problem with R on dual core under Linux - can not execute
      mpi.spawn.Rslaves() (Rainer M Krug)
  19. Re: Running mean for spatial data (Roger Bivand)
  20. Re: Problem with R on dual core under Linux - can not execute
      mpi.spawn.Rslaves() (Luke Tierney)
  21. Re: Located Latent Class Analysis (Uebersax) (Robert A LaBudde)
  22. Re: Problem with R on dual core under Linux - can not execute
      mpi.spawn.Rslaves() (Rainer M Krug)
  23. nomogram function (design library) (Gondrie, M.)
  24. Re: Cross-tabulation Question (John Kane)
  25. Re: does there any function like sumif in excel? (John Kane)
  26. Re: Problem with R on dual core under Linux - can not execute
      mpi.spawn.Rslaves() (Rainer M Krug)
  27. Re: Bug in "is" ? (Lucke, Joseph F)
  28. Re: Cross-tabulation Question (Gabor Grothendieck)
  29. How to remove columns of table in R recursively (Jason Lee)
  30. turning comma separated string from multiple choices into
      flags (June Kim)
  31. Script for dose proportionality assessment using power model
      and confidence interval criteria (Jean-Louis Abitbol)
  32. Re: ariable Importance Measure in Package RandomForest
      (Liaw, Andy)
  33. Re: turning comma separated string from multiple choices into
      flags (Peter Dalgaard)
  34. Re: density estimate (Eik Vettorazzi)
  35. Re: turning comma separated string from multiple choices into
      flags (June Kim)
  36. Acceptance rate in metrop (Xia Wang)
  37. Re: turning comma separated string from multiple choices into
      flags (Peter Dalgaard)
  38.  ggplot 2 - editing in the "panel_1_1" viewport (Pedro Barros)
  39.  Sending Notes email out of R under windows (popsmelove)
  40. Re: adjusting textsize and spacing in mosaic (vcd package)
      (Richard.Cotton at hsl.gov.uk)
  41. multiple page pdf file using pdf() (Kyle Matoba)
  42. Re: Trend graph (Greg Snow)
  43. Re: multiple page pdf file using pdf() (Peter Dalgaard)
  44. Re: superimpose histogram on biplot (Kevin Wright)
  45. Re: efficient code - yet another question (Kevin Wright)
  46. Re: turning comma separated string from multiple choices into
      flags (Henrique Dallazuanna)
  47. Re: multiple page pdf file using pdf() (Kyle Matoba)
  48. Re: FW:  logistic regression (Greg Snow)
  49. replicating dataframe rows (milton ruser)
  50. Re: histogram-like plot with two variables (Greg Snow)
  51. Re: adding labels to tapply results (Greg Snow)
  52.  confident interval on Coxme analysis (Jue!)
  53. Re: replicating dataframe rows (Henrique Dallazuanna)
  54. Re: replicating dataframe rows (Dimitris Rizopoulos)
  55.  snowfall and lam4-dev (Erin Hodgess)
  56. Re: ggplot 2 - editing in the "panel_1_1" viewport
      (rmailbox at justemail.net)
  57. Testing this significance of a factor in a mixed-model
      "ANCOVA" (Jesse Young)
  58. Sweave and UTF8/Win XP (Jacques Ropers)
  59. Testing this significance of a factor in a mixed-model
      "ANCOVA" (Jesse Young)
  60. Re: How to remove columns of table in R recursively
      (Patrick Connolly)
  61. persistence of model in R to a file (Sharma, Dhruv)
  62. Integrating functions in R (kvest at al.umces.edu)
  63. Simple question about extracting a subset of data (Josh B)
  64. Re: Simple question about extracting a subset of data
      (rmailbox at justemail.net)
  65. Re: Integrating functions in R (Jorge Ivan Velez)
  66. Re: persistence of model in R to a file (Greg Snow)
  67. histogram-like plot - multiple bars side by side (J?rg Gro?)
  68. x axis label overlap (CLERC Thomas)
  69. Re: histogram-like plot - multiple bars side by side (Greg Snow)
  70. Re: persistence of model in R to a file (Sharma, Dhruv)
  71.  quantile (liujb)
  72. Re: replicating dataframe rows (David Huffer)
  73. Re: quantile (jim holtman)
  74. box-whisker plot from pre-summarized data? (Avram Aelony)
  75. Re: quantile ( (Ted Harding))
  76.  count data with a specific range (sandsky)
  77. Re: adding labels to tapply results (Dieter Menne)
  78. Re: Hazard plot (Dieter Menne)
  79. Re: Double integration - Gauss Quadrature (Earl F. Glynn)
  80. Re: Double integration - Gauss Quadrature (Earl F. Glynn)
  81. Re: count data with a specific range (Peter Alspach)
  82. Re: box-whisker plot from pre-summarized data? (hadley wickham)
  83. Re: count data with a specific range (jim holtman)
  84.  Logistic Regression using optim() give "L-BFGS-B" error,
      please help (ashky)
  85. SET_VECTOR_ELT() and mkChar() (snoweye)
  86. Re: FW:  logistic regression (Frank E Harrell Jr)
  87. Re: example - export a data frame to an XML file (Paul Murrell)
  88. Re: Bug in "is" ? (Michael Grant)
  89. Re: R-2.7.2 infected? (Dave DeBarr)
  90. Re: histogram-like plot - multiple bars side by side *solved*
      (J?rg Gro?)
  91.  crashes while using Rattle (GTK+) ( Tomislav Pu?a )
  92. Version 2.7.2 GUI acts awkward? (Gregor Rolshausen)
  93. snow: Problems with cluster (tolga.i.uzuner at jpmorgan.com)
  94.  par() default values (Benoit Boulinguiez)
  95.  Desperatly seeking Parallel R simulation with Windows XP
      (quant15)
  96. calculating weighted correlation coefficients (Elena Wilson)
  97. Re: Desperatly seeking Parallel R simulation with Windows XP
      (Rainer M Krug)
  98. Re: par() default values (Eik Vettorazzi)
  99. rpvm for windows anyone ? (tolga.i.uzuner at jpmorgan.com)
  100. Weibull Verteilung (Hoeks, Luis)
  101. Re: Weibull Verteilung (Tsjerk Wassenaar)


----------------------------------------------------------------------

Message: 1
Date: Mon, 29 Sep 2008 10:56:13 +0100
From: Simon Wood <s.wood at bath.ac.uk>
Subject: Re: [R] GAMSetup
To: r-help at r-project.org
Message-ID: <200809291056.13882.s.wood at bath.ac.uk>
Content-Type: text/plain;  charset="iso-8859-1"

Michela,

`gam.setup' is probably the closest to a `GAMsetup' replacement. If you let me 
know what you need it for, I can probably help locate what you need in more 
detail (perhaps offline, if it's fairly specialized?)

best,
Simon

On Monday 29 September 2008 10:20, Michela Leone wrote:
> In the mgcv package the GAMsetup() function has been removed, can you
> please tell me what  the new function is?
> thanks Michela.
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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



------------------------------

Message: 2
Date: Mon, 29 Sep 2008 11:18:15 +0100
From: "Laura Bonnett" <l.j.bonnett at googlemail.com>
Subject: [R] Hazard plot
To: r-help at r-project.org
Message-ID:
	<f00d54d10809290318r7d7f7d80k9a4f54f7fc2f9e8d at mail.gmail.com>
Content-Type: text/plain

Hi All,

This sounds a relatively simple query, and I hope it is!

I am looking at a continuous variable, age.  I am looking at time to
12-month remission and can calculate the HR and 95% confidence interval are
follows:
coxfita = coxph(Surv(rem.Remtime,rem.Rcens)~nearma$all.age,data=nearma)
exp(coxfita$coefficients)
exp(confint(coxfita))


However, because I am looking at age as a continuous variable I cannot draw
a Kaplan-Meier curve.  Instead I need to draw a plot of hazard against age.
How do I do this? I don't think
plot(nearma$all.age,coxfita$linear.predictors) is quite right.

Thank you for your help,

Laura

	[[alternative HTML version deleted]]



------------------------------

Message: 3
Date: Mon, 29 Sep 2008 06:51:19 -0400
From: Duncan Murdoch <murdoch at stats.uwo.ca>
Subject: Re: [R] histogram-like plot with two variables
To: J?rg Gro? <joerg at licht-malerei.de>
Cc: r-help at r-project.org
Message-ID: <48E0B327.8030608 at stats.uwo.ca>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

On 28/09/2008 10:02 PM, J?rg Gro? wrote:
> Hi,
> 
> I want to plot a binomial propability distribution.
> 
> I know how to generate the data;
> 
>    x <- seq(from=0, to=14, by=1)
>    y <- dbinom(x, 14, 0.7, log = FALSE)
> 
> but what I don't know is how to plot this within a histogram like plot.
> Because the histogram function only accepts one variable.
> 
> Is there a way to get the look of "hist()" with two variables?
> 
> 
> 
> I tried:
> plot(x,y, type="h")
>   but the bars are very thin -is there a way to define the width?

You could use barplot():

barplot(y,names=x)

You could also do it with plot.histogram, but it's trickier, because 
it's designed for continuous data.  For example,

dat <- hist(x, plot=FALSE, breaks=c(-1,x)+0.5)
dat$density <- y
plot(dat, freq=FALSE)

Duncan Murdoch



------------------------------

Message: 4
Date: Mon, 29 Sep 2008 20:55:19 +1000
From: Jim Lemon <jim at bitwrit.com.au>
Subject: Re: [R] histogram-like plot with two variables
To: J?rg Gro? <joerg at licht-malerei.de>
Cc: r-help at r-project.org
Message-ID: <48E0B417.5090401 at bitwrit.com.au>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

J?rg Gro? wrote:
> Hi,
>
> I want to plot a binomial propability distribution.
>
> I know how to generate the data;
>
>    x <- seq(from=0, to=14, by=1)
>    y <- dbinom(x, 14, 0.7, log = FALSE)
>
> but what I don't know is how to plot this within a histogram like plot.
> Because the histogram function only accepts one variable.
>
> Is there a way to get the look of "hist()" with two variables?
>
>
>
> I tried:
> plot(x,y, type="h")
>   but the bars are very thin -is there a way to define the width?
>
>
>   
Hi Jorg,
Does this do what you want?

library(plotrix)
barp(y,names.arg=0:14)


Jim



------------------------------

Message: 5
Date: Mon, 29 Sep 2008 06:57:07 -0400
From: Duncan Murdoch <murdoch at stats.uwo.ca>
Subject: Re: [R] problem running Sweave as a web service with
	anti-virus	software
To: Paul.Rustomji at csiro.au
Cc: r-help at r-project.org
Message-ID: <48E0B483.2000704 at stats.uwo.ca>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

On 29/09/2008 2:01 AM, Paul.Rustomji at csiro.au wrote:
> Hello R mailing list
> 
> We are trying to use R and Sweave, running as a web service on a server
> to prepare statistical reports but are having problems with our
> anti-virus software apparently prohibiting execution due to what we
> think is Sweave trying to run an executable in one of the system's
> temporary folders.  
> 
> As background, we use the following Rscript command to invoke Sweave
> (the text in %'s are system variables)
> 
> Rscript -e
> Sweave('%script.dir%\\runstats1.Rnw',output='%uniquenum%-%fileend%.tex',
> debug=FALSE) %outdir% --slave
> 
> This runs OK when run on a local machine, but when when we try to run
> the code as a web service, the following error messages occur:
> 
> 2008-9-23 9:34:23 Would be blocked by Access Protection rule  (rule is
> currently not enforced)  CLW-H3P8L1S-BU\ASPNET
> c:\windows\microsoft.net\framework\v2.0.50727\aspnet_wp.exe
> C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET
> Files\r\dfbe3c81\37929eb6\assembly\dl3\2a60fd88\0036ec07_80b5c601\antlr.
> runtime.DLL Anti-spyware Maximum Protection:Prevent all programs from
> running files from the Temp folder Action blocked : Execute
> 2008-9-23 9:34:23 Would be blocked by Access Protection rule  (rule is
> currently not enforced)  CLW-H3P8L1S-BU\ASPNET
> c:\windows\microsoft.net\framework\v2.0.50727\aspnet_wp.exe
> C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET
> Files\r\dfbe3c81\37929eb6\assembly\dl3\84f8ea82\00eb8e7a_5ffbc701\Castle
> .DynamicProxy.DLL Anti-spyware Maximum Protection:Prevent all programs
> from running files from the Temp folder Action blocked : Execute
> 
> etc (there were a few more)
> 
> We have been able to configure the anti-virus software to allow
> Rscript.exe to run OK in temporary directories, but there seems to be a
> problem with Sweave trying to run an executable in one of the system's
> temp directories which the virus checker is then blocking.
> 
> Has anyone else had any experience with this or have any tips as to what
> might be going on, least of all how to get around this?

I think you need to contact the anti-virus vendor to get it to write 
more informative reports.  For example, what is the executable in the 
Temp directory?

Sweave by itself runs no executables, you normally run latex or some 
related program on its output; perhaps your script is trying to do that. 
  But diagnosing it without knowing the executable that is being run 
isn't really possible.

Duncan Murdoch



------------------------------

Message: 6
Date: Mon, 29 Sep 2008 13:12:11 +0200
From: Philippe Grosjean <phgrosjean at sciviews.org>
Subject: Re: [R] Dream of a wiki GUI for R
To: Ajay ohri <ohri2007 at gmail.com>
Cc: r-help at r-project.org, freerow <freerow at gmail.com>,	Tobias Verbeke
	<tobias.verbeke at gmail.com>
Message-ID: <48E0B80B.1060800 at sciviews.org>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Hello,

Just to add to what Ajay said: the http://wiki.r-project.org does not 
execute R code from within wiki pages. This is a choice for security 
reasons. However, there are ways to get R code from R wiki pages and run 
it in R: http://wiki.r-project.org/rwiki/doku.php?id=tips:misc:wikicode

Also, there is a discussion about integrating Sweave in wiki pages: 
http://wiki.r-project.org/rwiki/doku.php?id=developers:latex2wiki.

If someone would like to start a "teaching stats with R" topic on the R 
wiki and organize a section for this, he is more than welcome to make a 
proposal (send it to me).

Best,

Philippe Grosjean

..............................................<?}))><........
  ) ) ) ) )
( ( ( ( (    Prof. Philippe Grosjean
  ) ) ) ) )
( ( ( ( (    Numerical Ecology of Aquatic Systems
  ) ) ) ) )   Mons-Hainaut University, Belgium
( ( ( ( (
..............................................................

Ajay ohri wrote:
> Hi Tobias,
> 
> It makes sense from a practical view point. SAS Institute funds its own wiki
> at www.sascommunity.org  The catch is they have editorial influence and can
> use offerings there for commercial purposes.
> 
> 
> The surprising thing is you can actually create a wiki in wikipedia itself.
> Just adopt a convention lets say Rproj for beginning of each wiki page.
> 
> Note this would mean volunteers parsing the back and forth of messages into
> structure ( maybe it exists already)
> 
> However  wikis are a bit outdated. The latest is knol.google.com as it gives
> you the right to make document editable, or allow comments, or even what
> kind of license you want content to be shared. The catch again is its owned
> by Google , the big company.
> 
> Other options from Google include Google Docs as well as Google Sites.You
> can even create bulk Google Docs from a writely email that your
> docs.google.com account gives you, and just last week someone created a
> Google Docs plugin for sending R output directly to the Docs.
> 
> As you may have noticed and I have pointed out once the R -project website
> itself is badly outdated compared to the software itself. The official R
> wiki  of course is here
> http://wiki.r-project.org/rwiki/doku.php
> 
> So these are the options - noting that email groups are more easy to use and
>  addictive , though not the best for collobrative knowledge storage over a
> period of time.
> 
> Regards,
> 
> Ajay
> 
> www.decisionstats.com
> 
> On Sun, Sep 28, 2008 at 3:19 PM, Tobias Verbeke <tobias.verbeke at gmail.com>wrote:
> 
>> Hi,
>>
>> I am just writing a draft to introduce confidence intervals of various
>>> "effect sizes" to my students. Surely, I'll recommend the package
>>> MBESS in R. Currently, it means I have to recommend R's interface at
>>> first. As a statistics teacher in a dept of psychology, I often have
>>> to reply why not to teach SPSS. Psychologists and their students hate
>>> to memorize codes, or even to call any function with a list of
>>> parameters. I know if I have an online R platform with a wiki
>>> html-form design, I can bypass the function calls and headache
>>> parameters to expose the power of R. Rcmdr and its plugins help some,
>>> but students like to remember just one menu structure in the SPSS
>>> textbook. A wiki interface means they can search and find a complete
>>> example in psychology, with self-explained parameter inputs and
>>> outputs.
>>>
>>> Do I actually dream a wikipedia with front forms and back R? Most R
>>> fans are wiki fans, but not vice verse. So, I think I should talk my
>>> dream here rather than at wikipedia. If you know it had been a
>>> practice rather than an idea, please tell me where to write my
>>> teaching interface.
>>>
>> Some have had similar dreams:
>>
>> http://ideas.repec.org/p/hum/wpaper/sfb649dp2008-030.html
>> http://www.r-project.org/user-2006/Slides/Klinke.pdf
>>
>> http://www.r-project.org/user-2006/Abstracts/Klinke+Schmerbach+Troitschanskaia.pdf
>>
>> HTH,
>> Tobias
>>
>>
>> LI, Xiaoxu
>>> School of Arts and Social Sciences,
>>> Shenzhen Graduate School,
>>> Peking Univ.(Shenzhen Campus)
>>> China
>>>
>>> ______________________________________________
>>> R-help at 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<http://www.r-project.org/posting-guide.html>
>>> and provide commented, minimal, self-contained, reproducible code.
>>>
>>>
>>>
>> ______________________________________________
>> R-help at 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<http://www.r-project.org/posting-guide.html>
>> and provide commented, minimal, self-contained, reproducible code.
>>
> 
> 
>



------------------------------

Message: 7
Date: Mon, 29 Sep 2008 12:24:56 +0100
From: Karen Chan <k.chan at chs.dundee.ac.uk>
Subject: [R] Located Latent Class Analysis (Uebersax)
To: "r-help at r-project.org" <r-help at r-project.org>
Message-ID:
	<4DAD8E017B79F44DB4C39B1441A9C4EB34C5736D2C at corvus.tcgp.dundee.ac.uk>
Content-Type: text/plain

Dear list members

I am new to the list and would be much appreciated if you could help me.

I am very interested in applying Latent Class Model for analysing multiple raters agreement data.  I have recently found a paper by Uebersax, J. (1993) which described a method in a form of Located Latent Class Analysis (llca).  Uebersax has written a Fortran program which is available on the web, for the method described in the paper.  I do not have a Fortran compiler on my PC. I know there are many R packages do latent class type models.

I am wondering if anyone has implemented llca, or equivalent in R.

Thank you in advance for your help

-- Karen Chan
DHSRU
University of Dundee


The University of Dundee is a Scottish Registered Charity, No. SC015096.


	[[alternative HTML version deleted]]



------------------------------

Message: 8
Date: Mon, 29 Sep 2008 13:36:18 +0200
From: Wacek Kusnierczyk <Waclaw.Marcin.Kusnierczyk at idi.ntnu.no>
Subject: Re: [R] Bug in "is" ?
To: Peter Dalgaard <P.Dalgaard at biostat.ku.dk>
Cc: R help <R-help at stat.math.ethz.ch>
Message-ID: <48E0BDB2.6010509 at idi.ntnu.no>
Content-Type: text/plain; charset=ISO-8859-1

Peter Dalgaard wrote:
> Stefan Evert wrote:
>   
>>
>> ... am I the only one who thinks that the integer 7 is something  
>> entirely different from the real number 7.0? (The latter most likely  
>> being an equivalence class of sequences of rational numbers, but that  
>> depends on your axiomatisation of real numbers.) Integers can be  
>> embedded in the set of real numbers, but that doesn't make them the  
>> same mathematically.
>>   
>>     
> Several people have tried to make that point (or something very
> similar), but it doesn't seem to take.
>
> It might get clearer if taken one step up: is.double(-1+0i) is not true
> either, even though the real line is cleanly embedded in complex space,
> -1+0i is not the same as -1. For instance, you can take the square root
> of the former but not the latter.
>   

you see, there seems to be a confusion of *numbers* and their
*representations*.
but of course the integer 7 is *the same* number as the real number 1.0,
even if we refer to it using two different representations.
the literal '7' might, in some system, cause the compiler/interpreter to
use an integer representation of the number 7, and to use a floating
point representation of the number 7 in some other system.
these two representations differ, as do those for -1 and -1+0i; but just
as the real number 7.0 happens to be an integer, so does the complex
number -1+0i happen to be a real number.

and, of course, you can take a square root of -1, that's what you do
when you square-root -1+0i, only that the result is not a member of the
set of real numbers.  the fact that you may not be able to apply, in a
computer language, sqrt to -1, is a consequence of a particular
implementation; there's no problem, in principle, in having a system
where sqrt(-1) is allowable even if the literal '-1' corresponds to an
integer or floating point representation rather than one for complex
numbers.  just try it with systems such as octave, matlab, mathematica,
sage, etc.  in the last one, for example sqrt(int(-1)) is perfectly
legal, and returns what's expected.

*you* can't you take square root of the *integer* 2, can you?

"is.double(-1+0i) is not true either, even though the real line is
cleanly embedded in complex space,"
apparently, but it's an *implementation* choice, not a property of the
(both real and complex) number -1+0i.  the r function is.double returns
false for -1+0i, but it's not because the number -1+0i is not real, but
because the literal '-1+0i' makes r represent the number using a
specific representation scheme.  if you try to prove that r must work
the way it does by showing how it works, it's painfully circular, and void.

the problem was, and is, that is.integer refers to the *representation*,
not the *value* (which should, arguably, be clear from the man page),
and this seems to be counterintuitive to some of the users.

> With integers it is less clear that there is a difference in R, but it
> has been mentioned that you can get overflows from adding and multipying
> integers which you dont get with reals. In other programming languages,
> division of integers is integer division and many a fledgling C
> programmer has found the hard way that (2/3)*x is different from 2*x/3.
>   

and this, again, is an *implementation* matter, not a property of numbers.
again, in languages that allow the user to think mathematics rather than
registers and processors, (2/3)*x == 2*x/3 would rather evaluate to
true, even though these are *computer* languages used to specify
*computations*.

all this trolling, again, to argue that it's far from obvious that
is.integer(7) evaluates to FALSE, even if this might be a reasonable
choice from some point of view.

>   
>> So the original complaint should really have said that is.integer()  
>> doesn't do what a naive user (i.e. someone without a background in  
>> computer science or maths) might expect it to do. :-)
>>     
well, 'naive' should mean 'not familiar with r' rather than 'not
understanding the nature of computation'.  you can have good background
in maths and cs, and still expect that a language like r behaves
differently.
there's really no point in offending people that get confused by r's
details.

vQ



------------------------------

Message: 9
Date: Mon, 29 Sep 2008 13:39:20 +0200
From: Eik Vettorazzi <E.Vettorazzi at uke.uni-hamburg.de>
Subject: Re: [R] density estimate
To: Lavan <rsumithran at yahoo.com>
Cc: r-help at r-project.org
Message-ID: <48E0BE68.6050801 at uke.uni-hamburg.de>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Hi Lavan,
a continuous density is not restricted to be within [0, 1]. Its only 
bound to have an integral of 1.
For example
dnorm(0,sd=.1)
is a very common density and gives 3.989423. A density function is not a 
probability function!
If you think your data x is discrete than you can assign the correct 
probability mass for each data point by
 prop.table(table(x))

hth.

Lavan schrieb:
> Hi,
>
> I have a vector or random variables and I'm estimating the density using
> "bkde" function in the KernSmooth package. The out put contains two vectors
> (x and y), and the R documentation calls y as the density estimates, but my
> y-values are not exact density etstimates (since these are numbers larger
> than 1)! what is y here? Is it possible to get the true estimated density at
> each value of x?
>
> Thanks
>
>
>   

-- 
Eik Vettorazzi
Institut f?r Medizinische Biometrie und Epidemiologie
Universit?tsklinikum Hamburg-Eppendorf

Martinistr. 52
20246 Hamburg

T ++49/40/42803-8243
F ++49/40/42803-7790



------------------------------

Message: 10
Date: Mon, 29 Sep 2008 13:40:21 +0200
From: Philipp Pagel <p.pagel at wzw.tum.de>
Subject: Re: [R] histogram-like plot with two variables
To: r-help at r-project.org
Message-ID: <20080929114021.GA23118 at localhost>
Content-Type: text/plain; charset=iso-8859-1

On Mon, Sep 29, 2008 at 04:02:05AM +0200, J?rg Gro? wrote:
> Hi,
> 
> I want to plot a binomial propability distribution.
> 
> I know how to generate the data;
> 
>    x <- seq(from=0, to=14, by=1)
>    y <- dbinom(x, 14, 0.7, log = FALSE)
> 
> I tried:
> plot(x,y, type="h")
>   but the bars are very thin -is there a way to define the width?

yes - the lwd parameter controls line width. E.g.:

plot(x,y, type='h', lwd=5)

This is the way I usually plot count data - I prefer this over something
that looks like a normal histogram, because it reminds me that I am
looking at discrete values.

cu
	Philipp

-- 
Dr. Philipp Pagel
Lehrstuhl f?r Genomorientierte Bioinformatik
Technische Universit?t M?nchen
Wissenschaftszentrum Weihenstephan
85350 Freising, Germany
http://mips.gsf.de/staff/pagel



------------------------------

Message: 11
Date: Mon, 29 Sep 2008 06:42:41 -0500
From: Frank E Harrell Jr <f.harrell at vanderbilt.edu>
Subject: Re: [R] FW:  logistic regression
To: gavin.simpson at ucl.ac.uk
Cc: r-help at r-project.org, 'Bert Gunter' <gunter.berton at gene.com>
Message-ID: <48E0BF31.5050002 at vanderbilt.edu>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Gavin Simpson wrote:
> On Sun, 2008-09-28 at 21:23 -0500, Frank E Harrell Jr wrote:
>> Darin Brooks wrote:
>>> I certainly appreciate your comments, Bert.  It is abundantly clear that I
> <snip />
>>> Darin Brooks   
>> Darin,
>>
>> I think the point is that the confidence you can assign to the "best 
>> available variables" is zero.  That is the probability that stepwise 
>> variable selection will select the correct variables.
>>
>> It is probably better to build a model based on the knowledge in the 
>> field you alluded to, rather than to use P-values to decide.
>>
>> Frank Harrell
> 
> Hi Frank, et al
> 
> I don't have Darin's original email to hand just now, but IIRC he turned
> on the testing by p-values, something that add1 and drop1 do not do by
> default.
> 
> Venables and Ripley's MASS contains stepAIC and there they make use of
> drop1 in the regression chapters (Apologies if I have made sweeping
> statements that are just plain wrong here - I'm at home this morning and
> don't seem to have either of my two MASS copies here with me).
> 
> Would the same criticisms made by yourself and Bert, amongst others, in
> this thread be levelled at simplifying models using AIC rather than via
> p-values? Part of the issue with stepwise procedures is that they don't
> correct the overall Type I error rate (even if you use 0.05 as your
> cut-off for each test, overall your error rate can be much larger). Does
> AIC allow one to get out of this bit of the problem with stepwise
> methods?

AIC is just a restatement of P-values, so using AIC one variable at a 
time is just like using a different alpha.  Both methods have problems.

Frank

> 
> I'd appreciate any thoughts you or others on the list may have on this.
> 
> All the best, and thanks for an interesting discussion thus far.
> 
> G
> 
>>> -----Original Message-----
>>> From: Bert Gunter [mailto:gunter.berton at gene.com] 
>>> Sent: Sunday, September 28, 2008 6:26 PM
>>> To: 'David Winsemius'; 'Darin Brooks'
>>> Cc: r-help at stat.math.ethz.ch; ted.harding at manchester.ac.uk
>>> Subject: RE: [R] FW: logistic regression
>>>
>>>
>>> The Inferno awaits me -- but I cannot resist a comment (but DO look at
>>> Frank's website).
>>>
>>> There is a deep and disconcerting dissonance here. Scientists are
>>> (naturally) interested in getting at mechanisms, and so want to know which
>>> of the variables "count" and which do not. But statistical analysis --
>>> **any** statistical analysis -- cannot tell you that. All statistical
>>> analysis can do is build models that give good predictions (and only over
>>> the range of the data). The models you get depend **both** on the way Nature
>>> works **and** the peculiarities of your data (which is what Frank referred
>>> to in his comment on data reduction). In fact, it is highly likely that with
>>> your data there are many alternative prediction equations built from
>>> different collections of covariates that perform essentially equally well.
>>> Sometimes it is otherwise, typically when prospective, carefully designed
>>> studies are performed -- there is a reason that the FDA insists on clinical
>>> trials, after all (and reasons why such studies are difficult and expensive
>>> to do!).
>>>
>>> The belief that "data mining" (as it is known in the polite circles that
>>> Frank obviously eschews) is an effective (and even automated!) tool for
>>> discovering how Nature works is a misconception, but one that for many
>>> reasons is enthusiastically promoted.  If you are looking only to predict,
>>> it may do; but you are deceived if you hope for Truth. Can you get hints? --
>>> well maybe, maybe not. Chaos beckons.
>>>
>>> I think many -- maybe even most -- statisticians rue the day that stepwise
>>> regression was invented and certainly that it has been marketed as a tool
>>> for winnowing out the "important" few variables from the blizzard of
>>> "irrelevant" background noise. Pogo was right: " We have seen the enemy --
>>> and it is us."
>>>
>>> (As I said, the Inferno awaits...)
>>>
>>> Cheers to all,
>>> Bert Gunter
>>>
>>> DEFINITELY MY OWN OPINIONS HERE!
>>>
>>>
>>>
>>> -----Original Message-----
>>> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On
>>> Behalf Of David Winsemius
>>> Sent: Saturday, September 27, 2008 5:34 PM
>>> To: Darin Brooks
>>> Cc: r-help at stat.math.ethz.ch; ted.harding at manchester.ac.uk
>>> Subject: Re: [R] FW: logistic regression
>>>
>>> It's more a statement that it expresses a statistical perspective very
>>> succinctly, somewhat like a Zen koan.  Frank's book,"Regression Modeling
>>> Strategies", has entire chapters on reasoned approaches to your question.
>>> His website also has quite a bit of material free for the taking.
>>>
>>> --
>>> David Winsemius
>>> Heritage Laboratories
>>>
>>> On Sep 27, 2008, at 7:24 PM, Darin Brooks wrote:
>>>
>>>> Glad you were amused.
>>>>
>>>> I assume that "booking this as a fortune" means that this was an 
>>>> idiotic way to model the data?
>>>>
>>>> MARS?  Boosted Regression Trees?  Any of these a better choice to 
>>>> extract significant predictors (from a list of about 44) for a 
>>>> measured dependent variable?
>>>>
>>>> -----Original Message-----
>>>> From: r-help-bounces at r-project.org 
>>>> [mailto:r-help-bounces at r-project.org
>>>> ] On
>>>> Behalf Of Ted Harding
>>>> Sent: Saturday, September 27, 2008 4:30 PM
>>>> To: r-help at stat.math.ethz.ch
>>>> Subject: Re: [R] FW: logistic regression
>>>>
>>>>
>>>>
>>>> On 27-Sep-08 21:45:23, Dieter Menne wrote:
>>>>> Frank E Harrell Jr <f.harrell <at> vanderbilt.edu> writes:
>>>>>
>>>>>> Estimates from this model (and especially standard errors and
>>>>>> P-values)
>>>>>> will be invalid because they do not take into account the stepwise 
>>>>>> procedure above that was used to torture the data until they 
>>>>>> confessed.
>>>>>>
>>>>>> Frank
>>>>> Please book this as a fortune.
>>>>>
>>>>> Dieter
>>>> Seconded!
>>>> Ted.
>>>>


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



------------------------------

Message: 12
Date: Mon, 29 Sep 2008 08:05:15 -0400
From: zubin <binabina at bellsouth.net>
Subject: Re: [R] example - export a data frame to an XML file
To: Duncan Temple Lang <duncan at wald.ucdavis.edu>
Cc: r-help at r-project.org
Message-ID: <48E0C47B.601 at bellsouth.net>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Duncan, thanks for the note - the schema looks like this - is this what 
your asking for?

<document>
 <row>
  <date>2007-02-01</date >
  <UYG_Open>71.32</UYG_Open >
  <UYG_High>71.34</UYG_High >
  <UYG_Low>71.32</UYG_Low >
  <UYG_Close>71.34</UYG_Close >
  <UYG_Volume>200</UYG_Volume >
  <UYG_Adjusted>69.23</UYG_Adjusted >
 </row>
 <row>
  <date>2007-02-02</date >
  <UYG_Open>72.2</UYG_Open >
  <UYG_High>72.2</UYG_High >
  <UYG_Low>72.2</UYG_Low >
  <UYG_Close>72.2</UYG_Close >
  <UYG_Volume>200</UYG_Volume >
  <UYG_Adjusted>70.06</UYG_Adjusted >
 </row>
</document>

Duncan Temple Lang wrote:
> Hi Zubin.
>
>
>   The first thing is to send us a link to the schema that the
> other application expects. That would give us a "one-to-one"
> mapping; otherwise, data.frame to arbitrary XML is to vague.
>
>   Currently, there is nothing in the XML package that would
> be able to take an XML schema and write an R object to such a
> structure. However, I am in the process of creating an XMLSchema
> package which can read XML schema and make the description available to
> R so that we can read data from an XML file corresponding to that schema
> and this could be adapted in some ways to automate the creation of
> XML from an R object (under certain assumptions).
>
>  So please send us all a link to the XML schema.
>
>   D.
>
>
> zubin wrote:
>> In need of exporting an XML file from R, I scrub some data in R and 
>> push the data into another application requiring XML.  The data set 
>> is a very straightforward data frame of stock prices- see below.  I 
>> know the package XML is the one to use, but need an example or some 
>> direction on where to start.  I know we need to define the schema - 
>> can this be done in the R XML package?
>>>
>>> "date","UYG.Open","UYG.High","UYG.Low","UYG.Close","UYG.Volume","UYG.Adjusted" 
>>>
>>> "2007-02-01",71.32,71.34,71.32,71.34,200,69.23
>>> "2007-02-02",72.2,72.2,72.2,72.2,200,70.06
>>> "2007-02-05",71.76,71.76,71.76,71.76,5100,69.63
>>> "2007-02-06",72.85,72.85,72.85,72.85,3800,70.69
>>> "2007-02-07",72.85,72.85,72.85,72.85,0,70.69
>>>
>>>
>>>
>>>
>>
>> ______________________________________________
>> R-help at 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.
>



------------------------------

Message: 13
Date: Mon, 29 Sep 2008 14:17:56 +0200
From: Wacek Kusnierczyk <Waclaw.Marcin.Kusnierczyk at idi.ntnu.no>
Subject: Re: [R] Bug in "is" ?
To: R help <R-help at stat.math.ethz.ch>
Message-ID: <48E0C774.6070100 at idi.ntnu.no>
Content-Type: text/plain; charset=ISO-8859-1

Wacek Kusnierczyk wrote:
> Peter Dalgaard wrote:
>   
>> Stefan Evert wrote:
>>   
>>     
>>> ... am I the only one who thinks that the integer 7 is something  
>>> entirely different from the real number 7.0? (The latter most likely  
>>> being an equivalence class of sequences of rational numbers, but that  
>>> depends on your axiomatisation of real numbers.) Integers can be  
>>> embedded in the set of real numbers, but that doesn't make them the  
>>> same mathematically.
>>>   
>>>     
>>>       
>> Several people have tried to make that point (or something very
>> similar), but it doesn't seem to take.
>>
>> It might get clearer if taken one step up: is.double(-1+0i) is not true
>> either, even though the real line is cleanly embedded in complex space,
>> -1+0i is not the same as -1. For instance, you can take the square root
>> of the former but not the latter.
>>   
>>     
>
> you see, there seems to be a confusion of *numbers* and their
> *representations*.
> but of course the integer 7 is *the same* number as the real number 1.0,
>   
oops, a typo; the integer 7 is the same number as the real number *7.0*.
every integer is real, and the set of real numbers does not contain both
the integer 7 and the real 7.0 as two distinct numbers.

vQ



------------------------------

Message: 14
Date: Mon, 29 Sep 2008 14:27:53 +0200
From: Wacek Kusnierczyk <Waclaw.Marcin.Kusnierczyk at idi.ntnu.no>
Subject: Re: [R] Bug in "is" ?
To: R help <R-help at stat.math.ethz.ch>
Message-ID: <48E0C9C9.2090504 at idi.ntnu.no>
Content-Type: text/plain; charset=ISO-8859-1

Wacek Kusnierczyk wrote:
>
> you see, there seems to be a confusion of *numbers* and their
> *representations*.
> but of course the integer 7 is *the same* number as the real number 1.0,
> even if we refer to it using two different representations.
> the literal '7' might, in some system, cause the compiler/interpreter to
> use an integer representation of the number 7, and to use a floating
> point representation of the number 7 in some other system.
> these two representations differ, as do those for -1 and -1+0i; but just
> as the real number 7.0 happens to be an integer, so does the complex
> number -1+0i happen to be a real number.
>
> and, of course, you can take a square root of -1, that's what you do
> when you square-root -1+0i, only that the result is not a member of the
> set of real numbers.  the fact that you may not be able to apply, in a
> computer language, sqrt to -1, is a consequence of a particular
> implementation; there's no problem, in principle, in having a system
> where sqrt(-1) is allowable even if the literal '-1' corresponds to an
> integer or floating point representation rather than one for complex
> numbers.  just try it with systems such as octave, matlab, mathematica,
> sage, etc.  in the last one, for example sqrt(int(-1)) is perfectly
> legal, and returns what's expected.
>   
i also note that r *can* swallow the following (returning a non-integer
result):

sqrt(as.integer(2))

but it can't do the following (it returns NaN with a warning):

sqrt(as.integer(-1))
sqrt(as.double(-1))
sqrt(-1)

which is incoherent, in that there is an implicit type cast in the first
case, but not in the later ones.  and why not?
obviously, sage's gracefully computing sqrt(int(-1)) is a proof by
construction (for those who really need it) that r's design choice is
not the only possible (and, arguably, not the most intuitive and
practical, at this level of abstraction).

vQ



------------------------------

Message: 15
Date: Mon, 29 Sep 2008 13:33:14 +0100
From: Gavin Simpson <gavin.simpson at ucl.ac.uk>
Subject: Re: [R] GamSetup
To: Michela Leone <mickyleo at gmail.com>
Cc: r-help at r-project.org
Message-ID: <1222691594.3344.8.camel at prometheus.geog.ucl.ac.uk>
Content-Type: text/plain

On Mon, 2008-09-29 at 09:57 +0200, Michela Leone wrote:
> Hello,
> someone knows which function has replaced the GamSetup function in mgcv?
> With R 1.6 version  we have GamSetup but this function doesn't exist with R
> 2.7.2 version

Check out the Changelog:
....
1.0-0
....
* Function GAMsetup() has been removed.

A quick perusal of the manual for mgcv suggests gam.setup() may be what
you want. See ?gam.setup

G
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson             [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,          [f] +44 (0)20 7679 0565
 Pearson Building,             [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London          [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT.                 [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%



------------------------------

Message: 16
Date: Mon, 29 Sep 2008 08:38:49 -0400
From: "jim holtman" <jholtman at gmail.com>
Subject: Re: [R] Cross-tabulation Question
To: "Shubha Vishwanath Karanth" <shubhak at ambaresearch.com>
Cc: r-help at stat.math.ethz.ch
Message-ID:
	<644e1f320809290538g350fa01ck7d0133678cf13000 at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

> x
  V1  V2    V3
1  A One Apple
2  A One  Cake
3  A One  Cake
4  B One Apple
5  B One Apple
6  B One Apple
> tapply(x$V1, list(x$V2, x$V3), function(z) length(unique(z)))
    Apple Cake
One     2    1
>


On Mon, Sep 29, 2008 at 4:54 AM, Shubha Vishwanath Karanth
<shubhak at ambaresearch.com> wrote:
> Hi R,
>
>
>
> This is a cross tabulation question. Suppose that,
>
>
>
>> d=read.table("clipboard",header=F)
>
>
>
>> d
>
>  V1  V2    V3
>
>  A  One Apple
>
>  A  One  Cake
>
>  A  One  Cake
>
>  B  One Apple
>
>  B  One Apple
>
>  B  One Apple
>
>
>
>> table(d$V2,d$V3)
>
>
>
>        Apple Cake
>
>  One     4    2
>
>
>
>
>
> But, I don't want the count to be like the above. Here, it is counting
> the number of rows in that particular category. What I need is in each
> category, the count of unique V1's. So, my output should look like,
>
>
>
>        Apple Cake
>
>  One     2    1
>
>
>
>
>
> Any ideas please...
>
>
>
> Thanks, Shubha
>
>
>
> This e-mail may contain confidential and/or privileged i...{{dropped:13}}
>
> ______________________________________________
> R-help at 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?



------------------------------

Message: 17
Date: Mon, 29 Sep 2008 08:45:46 -0400
From: "eric lee" <ericlee100 at gmail.com>
Subject: [R] adding labels to tapply results
To: r-help at r-project.org
Message-ID:
	<4056389d0809290545r592bfa5fl801b188a1d5b0b0a at mail.gmail.com>
Content-Type: text/plain

Hi,

How do I get labels onto the output from tapply?  I need the labels to merge
the output with another data frame.  Thanks.

eric

d <- data.frame(cbind(x=1:3, y=1:10))
a <- with(d, tapply(y, x, sum))

	[[alternative HTML version deleted]]



------------------------------

Message: 18
Date: Mon, 29 Sep 2008 14:51:33 +0200
From: "Rainer M Krug" <r.m.krug at gmail.com>
Subject: Re: [R] Problem with R on dual core under Linux - can not
	execute	mpi.spawn.Rslaves()
To: "Martin Morgan" <mtmorgan at fhcrc.org>
Cc: r-help <r-help at r-project.org>
Message-ID:
	<fb7c7e870809290551g6024a546i27b1edf54aeff4dd at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

On Mon, Sep 29, 2008 at 12:19 AM, Martin Morgan <mtmorgan at fhcrc.org> wrote:
> "Rainer M Krug" <r.m.krug at gmail.com> writes:
>
>> Hi
>>
>> I am trying to utilize my dual core processor (and later a
>> High-performance clusters (HPC) ) by using the Rmpi, snow, snowfall,
>> ... packages, but I am struggling at the beginning, i.e. to initialise
>> the "cluster" on my dual core computer. Whenever I try to initialize
>> it (via sfInit(parallel=TRUE, cpus=2) or mpi.spawn.Rslaves(nslaves=2)
>> ), I get an error message:
>>
>>> sfInit(parallel=TRUE, cpus=2)
>> Forced parallel. Using session: XXXXXXXXR_rkrug_143706_092708
>>
>> Error in mpi.comm.spawn(slave = mpitask, slavearg = args, nslaves = count,  :
>>   MPI_Comm_spawn is not supported.
>> Error in sfInit(parallel = TRUE, cpus = 2) :
>>   Starting of snow cluster failed! Error in mpi.comm.spawn(slave =
>> mpitask, slavearg = args, nslaves = count,  :
>>   MPI_Comm_spawn is not supported.
>>
>> and
>>
>>> mpi.spawn.Rslaves(nslaves=2)
>> Error in mpi.spawn.Rslaves(nslaves = 2) :
>>   You cannot use MPI_Comm_spawn API
>
> This error comes from Rmpi,
>
>> head(mpi.spawn.Rslaves, 6)
>
> 1 function (Rscript = system.file("slavedaemon.R", package = "Rmpi"),
> 2     nslaves = mpi.universe.size(), root = 0, intercomm = 2, comm = 1,
> 3     hosts = NULL, needlog = TRUE, mapdrive = TRUE)
> 4 {
> 5     if (!is.loaded("mpi_comm_spawn"))
> 6         stop("You cannot use MPI_Comm_spawn API")
>
> and occurs when the compiler variable MPI2 is undefined when your

> package is installed. Likely this means that your mpi installation is
> either old (unlikely?) or that your Rmpi installation failed to
> properly detect the installed mpi version. It's difficult to know
> which, without more information on how the mpi and Rmpi installations
> went, at a minimum the result of R's sessionInfo() command and mpirun
> --version but likely including the output of Rmpi's installation.

Version:
lamboot -V

LAM 7.1.2/MPI 2 C++/ROMIO - Indiana University

        Arch:           i486-pc-linux-gnu
        Prefix:         /usr/lib/lam
        Configured by:  buildd
        Configured on:  Sun Mar 23 08:07:16 UTC 2008
        Configure host: rothera
        SSI rpi:        crtcp lamd sysv tcp usysv

Below find the session info and the info from the instalaltion of Rmpi.

In the install log from Rmpi, it says:
checking whether MPICH2 is declared... no
checking whether MPICH2 is declared... (cached) no

So what went wrong? Do I have to start the "cluster" on the dual-core machine?
Can I set the compiler variable MPI2 manually?

> version
               _
platform       i486-pc-linux-gnu
arch           i486
os             linux-gnu
system         i486, linux-gnu
status
major          2
minor          7.2
year           2008
month          08
day            25
svn rev        46428
language       R
version.string R version 2.7.2 (2008-08-25)
>
> sessionInfo()
R version 2.7.2 (2008-08-25)
i486-pc-linux-gnu

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

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

other attached packages:
[1] snow_0.3-3    Rmpi_0.5-5    snowfall_1.53

loaded via a namespace (and not attached):
[1] tools_2.7.2
>
> install.packages(c("Rmpi"), dep=TRUE, repo="http://cbio.uct.ac.za/CRAN/")
Warning in install.packages(c("Rmpi"), dep = TRUE, repo =
"http://cbio.uct.ac.za/CRAN/") :
  argument 'lib' is missing: using '/usr/local/lib/R/site-library'
trying URL 'http://cbio.uct.ac.za/CRAN/src/contrib/Rmpi_0.5-5.tar.gz'
Content type 'application/x-gzip' length 94643 bytes (92 Kb)
opened URL
==================================================
downloaded 92 Kb

* Installing *source* package 'Rmpi' ...
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
I am here /usr/lib/mpich and it is MPICH
Try to find mpi.h ...
Found in /usr/lib/mpich/include
Try to find libmpi.so or libmpich.a
Found libmpich in /usr/lib/mpich/lib
##########################################
checking whether MPICH2 is declared... no
checking whether MPICH2 is declared... (cached) no
##########################################
checking for openpty in -lutil... yes
checking for main in -lpthread... yes
configure: creating ./config.status
config.status: creating src/Makevars
** libs
gcc -std=gnu99 -I/usr/share/R/include -DPACKAGE_NAME=\"\"
-DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\"
-DPACKAGE_BUGREPORT=\"\" -DHAVE_DECL_MPICH2=0 -DHAVE_DECL_MPICH2=0
-I/usr/lib/mpich/include  -DMPICH -fPIC     -fpic  -g -O2 -c
conversion.c -o conversion.o
gcc -std=gnu99 -I/usr/share/R/include -DPACKAGE_NAME=\"\"
-DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\"
-DPACKAGE_BUGREPORT=\"\" -DHAVE_DECL_MPICH2=0 -DHAVE_DECL_MPICH2=0
-I/usr/lib/mpich/include  -DMPICH -fPIC     -fpic  -g -O2 -c
internal.c -o internal.o
gcc -std=gnu99 -I/usr/share/R/include -DPACKAGE_NAME=\"\"
-DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\"
-DPACKAGE_BUGREPORT=\"\" -DHAVE_DECL_MPICH2=0 -DHAVE_DECL_MPICH2=0
-I/usr/lib/mpich/include  -DMPICH -fPIC     -fpic  -g -O2 -c
RegQuery.c -o RegQuery.o
gcc -std=gnu99 -I/usr/share/R/include -DPACKAGE_NAME=\"\"
-DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\"
-DPACKAGE_BUGREPORT=\"\" -DHAVE_DECL_MPICH2=0 -DHAVE_DECL_MPICH2=0
-I/usr/lib/mpich/include  -DMPICH -fPIC     -fpic  -g -O2 -c Rmpi.c -o
Rmpi.o
gcc -std=gnu99 -shared  -o Rmpi.so conversion.o internal.o RegQuery.o
Rmpi.o -L/usr/lib/mpich/lib -lmpich -lutil -lpthread -fPIC
-L/usr/lib/R/lib -lR
** R
** demo
** inst
** preparing package for lazy loading
** help
 >>> Building/Updating help pages for package 'Rmpi'
     Formats: text html latex example
  hosts                             text    html    latex
  internal                          text    html    latex
  mpi.abort                         text    html    latex
  mpi.apply                         text    html    latex   example
  mpi.barrier                       text    html    latex
  mpi.bcast                         text    html    latex
  mpi.bcast.Robj                    text    html    latex
  mpi.bcast.cmd                     text    html    latex
  mpi.cart.coords                   text    html    latex   example
  mpi.cart.create                   text    html    latex   example
  mpi.cart.get                      text    html    latex   example
  mpi.cart.rank                     text    html    latex   example
  mpi.cart.shift                    text    html    latex   example
  mpi.cartdim.get                   text    html    latex   example
  mpi.comm                          text    html    latex   example
  mpi.comm.disconnect               text    html    latex
  mpi.comm.free                     text    html    latex
  mpi.comm.inter                    text    html    latex
  mpi.comm.set.errhandler           text    html    latex
  mpi.comm.spawn                    text    html    latex
  mpi.const                         text    html    latex
  mpi.dims.create                   text    html    latex   example
  mpi.exit                          text    html    latex
  mpi.finalize                      text    html    latex
  mpi.gather                        text    html    latex   example
  mpi.gather.Robj                   text    html    latex   example
  mpi.get.count                     text    html    latex
  mpi.get.processor.name            text    html    latex
  mpi.get.sourcetag                 text    html    latex
  mpi.info                          text    html    latex
  mpi.init.sprng                    text    html    latex
  mpi.intercomm.merge               text    html    latex
  mpi.parSim                        text    html    latex
  mpi.parapply                      text    html    latex   example
  mpi.probe                         text    html    latex
  mpi.realloc                       text    html    latex
  mpi.reduce                        text    html    latex
  mpi.remote.exec                   text    html    latex   example
  mpi.scatter                       text    html    latex   example
  mpi.scatter.Robj                  text    html    latex   example
  mpi.send                          text    html    latex   example
  mpi.send.Robj                     text    html    latex
  mpi.sendrecv                      text    html    latex   example
  mpi.setup.rng                     text    html    latex
  mpi.spawn.Rslaves                 text    html    latex   example
  mpi.universe.size                 text    html    latex
  mpi.wait                          text    html    latex
** building package indices ...
* DONE (Rmpi)

The downloaded packages are in
        /tmp/RtmpdX6zlZ/downloaded_packages
>

>
> Dirk Eddelbuettel
> (https://stat.ethz.ch/pipermail/r-devel/2008-September/050665.html)
> suggested that snow's makeSOCKcluster is an easier starting point for
> single computer 'clusters' or other configurations where significant
> system administration is not desired -- these should work without
> additional software on most systems, even if more limiting in the long
> term (in my opinion). See, e.g., the examples on the help page for
> clusterApply for basic operation. A bit oddly, apparently the
> 'snowfall' package restricts snow's functionality to mpi clusters. So
> you might start with snow directly.
>
> Martin
>
>>
>> I followed the pdf "Developing parallel programs using snowfall" by
>> Jochen Knaus,. installed the relevant libraries and programs, but it
>> does not work.
>>
>> I am stuck.
>>
>> Any help appreciated,
>>
>> Rainer
>>
>>
>> --
>> Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
>> Biology, UCT), Dipl. Phys. (Germany)
>>
>> Centre of Excellence for Invasion Biology
>> Faculty of Science
>> Natural Sciences Building
>> Private Bag X1
>> University of Stellenbosch
>> Matieland 7602
>> South Africa
>>
>> ______________________________________________
>> R-help at 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.
>
> --
> Martin Morgan
> Computational Biology / Fred Hutchinson Cancer Research Center
> 1100 Fairview Ave. N.
> PO Box 19024 Seattle, WA 98109
>
> Location: Arnold Building M2 B169
> Phone: (206) 667-2793
>



-- 
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
Biology, UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Faculty of Science
Natural Sciences Building
Private Bag X1
University of Stellenbosch
Matieland 7602
South Africa



------------------------------

Message: 19
Date: Mon, 29 Sep 2008 12:55:28 +0000 (UTC)
From: Roger Bivand <Roger.Bivand at nhh.no>
Subject: Re: [R] Running mean for spatial data
To: r-help at stat.math.ethz.ch
Message-ID: <loom.20080929T124917-356 at post.gmane.org>
Content-Type: text/plain; charset=us-ascii

Isaac Tetteh <kowtet <at> yahoo.com> writes:

> 
> Dear All,
> Please can anyone help me with codes for performing running mean for 
> my 3-D/4-D gridded (Spatial ) data sets( x,y,t, and x,y,z, t, 
> respectively).

Have you reviewed the Spatial Task View on CRAN, and considered posting on the 
R-sig-geo list? It is quite likely that the easiest way to do this is to 
represent your data as an appropriate object, then to see which dimension(s)
you want to run over (possibly the t, but a spatial filter would run over
others). If you need to do a lot of this, you'll save time by thinking through 
representation carefully, and seeing whether R is the best platform for you
for this task.

Roger Bivand

> Thank you,
> Isaac
>



------------------------------

Message: 20
Date: Mon, 29 Sep 2008 08:05:23 -0500 (CDT)
From: Luke Tierney <luke at stat.uiowa.edu>
Subject: Re: [R] Problem with R on dual core under Linux - can not
	execute mpi.spawn.Rslaves()
To: Rainer M Krug <r.m.krug at gmail.com>
Cc: r-help <r-help at r-project.org>
Message-ID: <Pine.LNX.4.64.0809290801310.16515 at itasca2.wildberry.org>
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed

Look at the configure output below: configure is finding mpi.h in
/usr/lib/mpich/include, soit is using mpich, not lam.  You may be able
to tell Rmpi specifically where to look for LAM stuff or you may need
to uninstall mpich (almost surely that can be avoided but it may be
easier if you don't really need mpich).

Best,

luke

On Mon, 29 Sep 2008, Rainer M Krug wrote:

> On Mon, Sep 29, 2008 at 12:19 AM, Martin Morgan <mtmorgan at fhcrc.org> wrote:
>> "Rainer M Krug" <r.m.krug at gmail.com> writes:
>>
>>> Hi
>>>
>>> I am trying to utilize my dual core processor (and later a
>>> High-performance clusters (HPC) ) by using the Rmpi, snow, snowfall,
>>> ... packages, but I am struggling at the beginning, i.e. to initialise
>>> the "cluster" on my dual core computer. Whenever I try to initialize
>>> it (via sfInit(parallel=TRUE, cpus=2) or mpi.spawn.Rslaves(nslaves=2)
>>> ), I get an error message:
>>>
>>>> sfInit(parallel=TRUE, cpus=2)
>>> Forced parallel. Using session: XXXXXXXXR_rkrug_143706_092708
>>>
>>> Error in mpi.comm.spawn(slave = mpitask, slavearg = args, nslaves = count,  :
>>>   MPI_Comm_spawn is not supported.
>>> Error in sfInit(parallel = TRUE, cpus = 2) :
>>>   Starting of snow cluster failed! Error in mpi.comm.spawn(slave =
>>> mpitask, slavearg = args, nslaves = count,  :
>>>   MPI_Comm_spawn is not supported.
>>>
>>> and
>>>
>>>> mpi.spawn.Rslaves(nslaves=2)
>>> Error in mpi.spawn.Rslaves(nslaves = 2) :
>>>   You cannot use MPI_Comm_spawn API
>>
>> This error comes from Rmpi,
>>
>>> head(mpi.spawn.Rslaves, 6)
>>
>> 1 function (Rscript = system.file("slavedaemon.R", package = "Rmpi"),
>> 2     nslaves = mpi.universe.size(), root = 0, intercomm = 2, comm = 1,
>> 3     hosts = NULL, needlog = TRUE, mapdrive = TRUE)
>> 4 {
>> 5     if (!is.loaded("mpi_comm_spawn"))
>> 6         stop("You cannot use MPI_Comm_spawn API")
>>
>> and occurs when the compiler variable MPI2 is undefined when your
>
>> package is installed. Likely this means that your mpi installation is
>> either old (unlikely?) or that your Rmpi installation failed to
>> properly detect the installed mpi version. It's difficult to know
>> which, without more information on how the mpi and Rmpi installations
>> went, at a minimum the result of R's sessionInfo() command and mpirun
>> --version but likely including the output of Rmpi's installation.
>
> Version:
> lamboot -V
>
> LAM 7.1.2/MPI 2 C++/ROMIO - Indiana University
>
>        Arch:           i486-pc-linux-gnu
>        Prefix:         /usr/lib/lam
>        Configured by:  buildd
>        Configured on:  Sun Mar 23 08:07:16 UTC 2008
>        Configure host: rothera
>        SSI rpi:        crtcp lamd sysv tcp usysv
>
> Below find the session info and the info from the instalaltion of Rmpi.
>
> In the install log from Rmpi, it says:
> checking whether MPICH2 is declared... no
> checking whether MPICH2 is declared... (cached) no
>
> So what went wrong? Do I have to start the "cluster" on the dual-core machine?
> Can I set the compiler variable MPI2 manually?
>
>> version
>               _
> platform       i486-pc-linux-gnu
> arch           i486
> os             linux-gnu
> system         i486, linux-gnu
> status
> major          2
> minor          7.2
> year           2008
> month          08
> day            25
> svn rev        46428
> language       R
> version.string R version 2.7.2 (2008-08-25)
>>
>> sessionInfo()
> R version 2.7.2 (2008-08-25)
> i486-pc-linux-gnu
>
> locale:
> LC_CTYPE=en_ZA.UTF-8;LC_NUMERIC=C;LC_TIME=en_ZA.UTF-8;LC_COLLATE=en_ZA.UTF-8;LC_MONETARY=C;LC_MESSAGES=en_ZA.UTF-8;LC_PAPER=en_ZA.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_ZA.UTF-8;LC_IDENTIFICATION=C
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
>
> other attached packages:
> [1] snow_0.3-3    Rmpi_0.5-5    snowfall_1.53
>
> loaded via a namespace (and not attached):
> [1] tools_2.7.2
>>
>> install.packages(c("Rmpi"), dep=TRUE, repo="http://cbio.uct.ac.za/CRAN/")
> Warning in install.packages(c("Rmpi"), dep = TRUE, repo =
> "http://cbio.uct.ac.za/CRAN/") :
>  argument 'lib' is missing: using '/usr/local/lib/R/site-library'
> trying URL 'http://cbio.uct.ac.za/CRAN/src/contrib/Rmpi_0.5-5.tar.gz'
> Content type 'application/x-gzip' length 94643 bytes (92 Kb)
> opened URL
> ==================================================
> downloaded 92 Kb
>
> * Installing *source* package 'Rmpi' ...
> checking for gcc... gcc
> checking for C compiler default output file name... a.out
> checking whether the C compiler works... yes
> checking whether we are cross compiling... no
> checking for suffix of executables...
> checking for suffix of object files... o
> checking whether we are using the GNU C compiler... yes
> checking whether gcc accepts -g... yes
> checking for gcc option to accept ISO C89... none needed
> I am here /usr/lib/mpich and it is MPICH
> Try to find mpi.h ...
> Found in /usr/lib/mpich/include
> Try to find libmpi.so or libmpich.a
> Found libmpich in /usr/lib/mpich/lib
> ##########################################
> checking whether MPICH2 is declared... no
> checking whether MPICH2 is declared... (cached) no
> ##########################################
> checking for openpty in -lutil... yes
> checking for main in -lpthread... yes
> configure: creating ./config.status
> config.status: creating src/Makevars
> ** libs
> gcc -std=gnu99 -I/usr/share/R/include -DPACKAGE_NAME=\"\"
> -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\"
> -DPACKAGE_BUGREPORT=\"\" -DHAVE_DECL_MPICH2=0 -DHAVE_DECL_MPICH2=0
> -I/usr/lib/mpich/include  -DMPICH -fPIC     -fpic  -g -O2 -c
> conversion.c -o conversion.o
> gcc -std=gnu99 -I/usr/share/R/include -DPACKAGE_NAME=\"\"
> -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\"
> -DPACKAGE_BUGREPORT=\"\" -DHAVE_DECL_MPICH2=0 -DHAVE_DECL_MPICH2=0
> -I/usr/lib/mpich/include  -DMPICH -fPIC     -fpic  -g -O2 -c
> internal.c -o internal.o
> gcc -std=gnu99 -I/usr/share/R/include -DPACKAGE_NAME=\"\"
> -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\"
> -DPACKAGE_BUGREPORT=\"\" -DHAVE_DECL_MPICH2=0 -DHAVE_DECL_MPICH2=0
> -I/usr/lib/mpich/include  -DMPICH -fPIC     -fpic  -g -O2 -c
> RegQuery.c -o RegQuery.o
> gcc -std=gnu99 -I/usr/share/R/include -DPACKAGE_NAME=\"\"
> -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\"
> -DPACKAGE_BUGREPORT=\"\" -DHAVE_DECL_MPICH2=0 -DHAVE_DECL_MPICH2=0
> -I/usr/lib/mpich/include  -DMPICH -fPIC     -fpic  -g -O2 -c Rmpi.c -o
> Rmpi.o
> gcc -std=gnu99 -shared  -o Rmpi.so conversion.o internal.o RegQuery.o
> Rmpi.o -L/usr/lib/mpich/lib -lmpich -lutil -lpthread -fPIC
> -L/usr/lib/R/lib -lR
> ** R
> ** demo
> ** inst
> ** preparing package for lazy loading
> ** help
> >>> Building/Updating help pages for package 'Rmpi'
>     Formats: text html latex example
>  hosts                             text    html    latex
>  internal                          text    html    latex
>  mpi.abort                         text    html    latex
>  mpi.apply                         text    html    latex   example
>  mpi.barrier                       text    html    latex
>  mpi.bcast                         text    html    latex
>  mpi.bcast.Robj                    text    html    latex
>  mpi.bcast.cmd                     text    html    latex
>  mpi.cart.coords                   text    html    latex   example
>  mpi.cart.create                   text    html    latex   example
>  mpi.cart.get                      text    html    latex   example
>  mpi.cart.rank                     text    html    latex   example
>  mpi.cart.shift                    text    html    latex   example
>  mpi.cartdim.get                   text    html    latex   example
>  mpi.comm                          text    html    latex   example
>  mpi.comm.disconnect               text    html    latex
>  mpi.comm.free                     text    html    latex
>  mpi.comm.inter                    text    html    latex
>  mpi.comm.set.errhandler           text    html    latex
>  mpi.comm.spawn                    text    html    latex
>  mpi.const                         text    html    latex
>  mpi.dims.create                   text    html    latex   example
>  mpi.exit                          text    html    latex
>  mpi.finalize                      text    html    latex
>  mpi.gather                        text    html    latex   example
>  mpi.gather.Robj                   text    html    latex   example
>  mpi.get.count                     text    html    latex
>  mpi.get.processor.name            text    html    latex
>  mpi.get.sourcetag                 text    html    latex
>  mpi.info                          text    html    latex
>  mpi.init.sprng                    text    html    latex
>  mpi.intercomm.merge               text    html    latex
>  mpi.parSim                        text    html    latex
>  mpi.parapply                      text    html    latex   example
>  mpi.probe                         text    html    latex
>  mpi.realloc                       text    html    latex
>  mpi.reduce                        text    html    latex
>  mpi.remote.exec                   text    html    latex   example
>  mpi.scatter                       text    html    latex   example
>  mpi.scatter.Robj                  text    html    latex   example
>  mpi.send                          text    html    latex   example
>  mpi.send.Robj                     text    html    latex
>  mpi.sendrecv                      text    html    latex   example
>  mpi.setup.rng                     text    html    latex
>  mpi.spawn.Rslaves                 text    html    latex   example
>  mpi.universe.size                 text    html    latex
>  mpi.wait                          text    html    latex
> ** building package indices ...
> * DONE (Rmpi)
>
> The downloaded packages are in
>        /tmp/RtmpdX6zlZ/downloaded_packages
>>
>
>>
>> Dirk Eddelbuettel
>> (https://stat.ethz.ch/pipermail/r-devel/2008-September/050665.html)
>> suggested that snow's makeSOCKcluster is an easier starting point for
>> single computer 'clusters' or other configurations where significant
>> system administration is not desired -- these should work without
>> additional software on most systems, even if more limiting in the long
>> term (in my opinion). See, e.g., the examples on the help page for
>> clusterApply for basic operation. A bit oddly, apparently the
>> 'snowfall' package restricts snow's functionality to mpi clusters. So
>> you might start with snow directly.
>>
>> Martin
>>
>>>
>>> I followed the pdf "Developing parallel programs using snowfall" by
>>> Jochen Knaus,. installed the relevant libraries and programs, but it
>>> does not work.
>>>
>>> I am stuck.
>>>
>>> Any help appreciated,
>>>
>>> Rainer
>>>
>>>
>>> --
>>> Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
>>> Biology, UCT), Dipl. Phys. (Germany)
>>>
>>> Centre of Excellence for Invasion Biology
>>> Faculty of Science
>>> Natural Sciences Building
>>> Private Bag X1
>>> University of Stellenbosch
>>> Matieland 7602
>>> South Africa
>>>
>>> ______________________________________________
>>> R-help at 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.
>>
>> --
>> Martin Morgan
>> Computational Biology / Fred Hutchinson Cancer Research Center
>> 1100 Fairview Ave. N.
>> PO Box 19024 Seattle, WA 98109
>>
>> Location: Arnold Building M2 B169
>> Phone: (206) 667-2793
>>
>
>
>
>

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



------------------------------

Message: 21
Date: Mon, 29 Sep 2008 09:15:59 -0400
From: Robert A LaBudde <ral at lcfltd.com>
Subject: Re: [R] Located Latent Class Analysis (Uebersax)
To: Karen Chan <k.chan at chs.dundee.ac.uk>
Cc: "r-help at r-project.org" <r-help at r-project.org>
Message-ID: <0K7Y00E07KUHYH12 at vms046.mailsrvcs.net>
Content-Type: text/plain; charset=us-ascii; format=flowed

Ubersax includes an ".exe" file in his zip package. This should solve 
your problem, if you use Windows. If you use linux, you should be 
able to easily find a free FORTRAN compiler.

At 07:24 AM 9/29/2008, Karen Chan wrote:
>Dear list members
>
>I am new to the list and would be much appreciated if you could help me.
>
>I am very interested in applying Latent Class Model for analysing 
>multiple raters agreement data.  I have recently found a paper by 
>Uebersax, J. (1993) which described a method in a form of Located 
>Latent Class Analysis (llca).  Uebersax has written a Fortran 
>program which is available on the web, for the method described in 
>the paper.  I do not have a Fortran compiler on my PC. I know there 
>are many R packages do latent class type models.
>
>I am wondering if anyone has implemented llca, or equivalent in R.
>
>Thank you in advance for your help
>
>-- Karen Chan
>DHSRU
>University of Dundee
>
>
>The University of Dundee is a Scottish Registered Charity, No. SC015096.
>
>
>         [[alternative HTML version deleted]]
>
>______________________________________________
>R-help at 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.

================================================================
Robert A. LaBudde, PhD, PAS, Dpl. ACAFS  e-mail: ral at lcfltd.com
Least Cost Formulations, Ltd.            URL: http://lcfltd.com/
824 Timberlake Drive                     Tel: 757-467-0954
Virginia Beach, VA 23464-3239            Fax: 757-467-2947

"Vere scire est per causas scire"



------------------------------

Message: 22
Date: Mon, 29 Sep 2008 15:46:50 +0200
From: "Rainer M Krug" <r.m.krug at gmail.com>
Subject: Re: [R] Problem with R on dual core under Linux - can not
	execute	mpi.spawn.Rslaves()
To: "Luke Tierney" <luke at stat.uiowa.edu>
Cc: r-help <r-help at r-project.org>
Message-ID:
	<fb7c7e870809290646l3ad5e4b5y3c59e9fc3892fbbe at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

On Mon, Sep 29, 2008 at 3:05 PM, Luke Tierney <luke at stat.uiowa.edu> wrote:
> Look at the configure output below: configure is finding mpi.h in
> /usr/lib/mpich/include, soit is using mpich, not lam.  You may be able
> to tell Rmpi specifically where to look for LAM stuff or you may need
> to uninstall mpich (almost surely that can be avoided but it may be
> easier if you don't really need mpich).

OK - I don't mind if I am using lam or mpich, so which one should I use?
I am confused.

If it helps, I am using Ubuntu Hardy

Rainer

>
> Best,
>
> luke
>
> On Mon, 29 Sep 2008, Rainer M Krug wrote:
>
>> On Mon, Sep 29, 2008 at 12:19 AM, Martin Morgan <mtmorgan at fhcrc.org>
>> wrote:
>>>
>>> "Rainer M Krug" <r.m.krug at gmail.com> writes:
>>>
>>>> Hi
>>>>
>>>> I am trying to utilize my dual core processor (and later a
>>>> High-performance clusters (HPC) ) by using the Rmpi, snow, snowfall,
>>>> ... packages, but I am struggling at the beginning, i.e. to initialise
>>>> the "cluster" on my dual core computer. Whenever I try to initialize
>>>> it (via sfInit(parallel=TRUE, cpus=2) or mpi.spawn.Rslaves(nslaves=2)
>>>> ), I get an error message:
>>>>
>>>>> sfInit(parallel=TRUE, cpus=2)
>>>>
>>>> Forced parallel. Using session: XXXXXXXXR_rkrug_143706_092708
>>>>
>>>> Error in mpi.comm.spawn(slave = mpitask, slavearg = args, nslaves =
>>>> count,  :
>>>>  MPI_Comm_spawn is not supported.
>>>> Error in sfInit(parallel = TRUE, cpus = 2) :
>>>>  Starting of snow cluster failed! Error in mpi.comm.spawn(slave =
>>>> mpitask, slavearg = args, nslaves = count,  :
>>>>  MPI_Comm_spawn is not supported.
>>>>
>>>> and
>>>>
>>>>> mpi.spawn.Rslaves(nslaves=2)
>>>>
>>>> Error in mpi.spawn.Rslaves(nslaves = 2) :
>>>>  You cannot use MPI_Comm_spawn API
>>>
>>> This error comes from Rmpi,
>>>
>>>> head(mpi.spawn.Rslaves, 6)
>>>
>>> 1 function (Rscript = system.file("slavedaemon.R", package = "Rmpi"),
>>> 2     nslaves = mpi.universe.size(), root = 0, intercomm = 2, comm = 1,
>>> 3     hosts = NULL, needlog = TRUE, mapdrive = TRUE)
>>> 4 {
>>> 5     if (!is.loaded("mpi_comm_spawn"))
>>> 6         stop("You cannot use MPI_Comm_spawn API")
>>>
>>> and occurs when the compiler variable MPI2 is undefined when your
>>
>>> package is installed. Likely this means that your mpi installation is
>>> either old (unlikely?) or that your Rmpi installation failed to
>>> properly detect the installed mpi version. It's difficult to know
>>> which, without more information on how the mpi and Rmpi installations
>>> went, at a minimum the result of R's sessionInfo() command and mpirun
>>> --version but likely including the output of Rmpi's installation.
>>
>> Version:
>> lamboot -V
>>
>> LAM 7.1.2/MPI 2 C++/ROMIO - Indiana University
>>
>>       Arch:           i486-pc-linux-gnu
>>       Prefix:         /usr/lib/lam
>>       Configured by:  buildd
>>       Configured on:  Sun Mar 23 08:07:16 UTC 2008
>>       Configure host: rothera
>>       SSI rpi:        crtcp lamd sysv tcp usysv
>>
>> Below find the session info and the info from the instalaltion of Rmpi.
>>
>> In the install log from Rmpi, it says:
>> checking whether MPICH2 is declared... no
>> checking whether MPICH2 is declared... (cached) no
>>
>> So what went wrong? Do I have to start the "cluster" on the dual-core
>> machine?
>> Can I set the compiler variable MPI2 manually?
>>
>>> version
>>
>>              _
>> platform       i486-pc-linux-gnu
>> arch           i486
>> os             linux-gnu
>> system         i486, linux-gnu
>> status
>> major          2
>> minor          7.2
>> year           2008
>> month          08
>> day            25
>> svn rev        46428
>> language       R
>> version.string R version 2.7.2 (2008-08-25)
>>>
>>> sessionInfo()
>>
>> R version 2.7.2 (2008-08-25)
>> i486-pc-linux-gnu
>>
>> locale:
>>
>> LC_CTYPE=en_ZA.UTF-8;LC_NUMERIC=C;LC_TIME=en_ZA.UTF-8;LC_COLLATE=en_ZA.UTF-8;LC_MONETARY=C;LC_MESSAGES=en_ZA.UTF-8;LC_PAPER=en_ZA.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_ZA.UTF-8;LC_IDENTIFICATION=C
>>
>> attached base packages:
>> [1] stats     graphics  grDevices utils     datasets  methods   base
>>
>> other attached packages:
>> [1] snow_0.3-3    Rmpi_0.5-5    snowfall_1.53
>>
>> loaded via a namespace (and not attached):
>> [1] tools_2.7.2
>>>
>>> install.packages(c("Rmpi"), dep=TRUE, repo="http://cbio.uct.ac.za/CRAN/")
>>
>> Warning in install.packages(c("Rmpi"), dep = TRUE, repo =
>> "http://cbio.uct.ac.za/CRAN/") :
>>  argument 'lib' is missing: using '/usr/local/lib/R/site-library'
>> trying URL 'http://cbio.uct.ac.za/CRAN/src/contrib/Rmpi_0.5-5.tar.gz'
>> Content type 'application/x-gzip' length 94643 bytes (92 Kb)
>> opened URL
>> ==================================================
>> downloaded 92 Kb
>>
>> * Installing *source* package 'Rmpi' ...
>> checking for gcc... gcc
>> checking for C compiler default output file name... a.out
>> checking whether the C compiler works... yes
>> checking whether we are cross compiling... no
>> checking for suffix of executables...
>> checking for suffix of object files... o
>> checking whether we are using the GNU C compiler... yes
>> checking whether gcc accepts -g... yes
>> checking for gcc option to accept ISO C89... none needed
>> I am here /usr/lib/mpich and it is MPICH
>> Try to find mpi.h ...
>> Found in /usr/lib/mpich/include
>> Try to find libmpi.so or libmpich.a
>> Found libmpich in /usr/lib/mpich/lib
>> ##########################################
>> checking whether MPICH2 is declared... no
>> checking whether MPICH2 is declared... (cached) no
>> ##########################################
>> checking for openpty in -lutil... yes
>> checking for main in -lpthread... yes
>> configure: creating ./config.status
>> config.status: creating src/Makevars
>> ** libs
>> gcc -std=gnu99 -I/usr/share/R/include -DPACKAGE_NAME=\"\"
>> -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\"
>> -DPACKAGE_BUGREPORT=\"\" -DHAVE_DECL_MPICH2=0 -DHAVE_DECL_MPICH2=0
>> -I/usr/lib/mpich/include  -DMPICH -fPIC     -fpic  -g -O2 -c
>> conversion.c -o conversion.o
>> gcc -std=gnu99 -I/usr/share/R/include -DPACKAGE_NAME=\"\"
>> -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\"
>> -DPACKAGE_BUGREPORT=\"\" -DHAVE_DECL_MPICH2=0 -DHAVE_DECL_MPICH2=0
>> -I/usr/lib/mpich/include  -DMPICH -fPIC     -fpic  -g -O2 -c
>> internal.c -o internal.o
>> gcc -std=gnu99 -I/usr/share/R/include -DPACKAGE_NAME=\"\"
>> -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\"
>> -DPACKAGE_BUGREPORT=\"\" -DHAVE_DECL_MPICH2=0 -DHAVE_DECL_MPICH2=0
>> -I/usr/lib/mpich/include  -DMPICH -fPIC     -fpic  -g -O2 -c
>> RegQuery.c -o RegQuery.o
>> gcc -std=gnu99 -I/usr/share/R/include -DPACKAGE_NAME=\"\"
>> -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\"
>> -DPACKAGE_BUGREPORT=\"\" -DHAVE_DECL_MPICH2=0 -DHAVE_DECL_MPICH2=0
>> -I/usr/lib/mpich/include  -DMPICH -fPIC     -fpic  -g -O2 -c Rmpi.c -o
>> Rmpi.o
>> gcc -std=gnu99 -shared  -o Rmpi.so conversion.o internal.o RegQuery.o
>> Rmpi.o -L/usr/lib/mpich/lib -lmpich -lutil -lpthread -fPIC
>> -L/usr/lib/R/lib -lR
>> ** R
>> ** demo
>> ** inst
>> ** preparing package for lazy loading
>> ** help
>> >>> Building/Updating help pages for package 'Rmpi'
>>    Formats: text html latex example
>>  hosts                             text    html    latex
>>  internal                          text    html    latex
>>  mpi.abort                         text    html    latex
>>  mpi.apply                         text    html    latex   example
>>  mpi.barrier                       text    html    latex
>>  mpi.bcast                         text    html    latex
>>  mpi.bcast.Robj                    text    html    latex
>>  mpi.bcast.cmd                     text    html    latex
>>  mpi.cart.coords                   text    html    latex   example
>>  mpi.cart.create                   text    html    latex   example
>>  mpi.cart.get                      text    html    latex   example
>>  mpi.cart.rank                     text    html    latex   example
>>  mpi.cart.shift                    text    html    latex   example
>>  mpi.cartdim.get                   text    html    latex   example
>>  mpi.comm                          text    html    latex   example
>>  mpi.comm.disconnect               text    html    latex
>>  mpi.comm.free                     text    html    latex
>>  mpi.comm.inter                    text    html    latex
>>  mpi.comm.set.errhandler           text    html    latex
>>  mpi.comm.spawn                    text    html    latex
>>  mpi.const                         text    html    latex
>>  mpi.dims.create                   text    html    latex   example
>>  mpi.exit                          text    html    latex
>>  mpi.finalize                      text    html    latex
>>  mpi.gather                        text    html    latex   example
>>  mpi.gather.Robj                   text    html    latex   example
>>  mpi.get.count                     text    html    latex
>>  mpi.get.processor.name            text    html    latex
>>  mpi.get.sourcetag                 text    html    latex
>>  mpi.info                          text    html    latex
>>  mpi.init.sprng                    text    html    latex
>>  mpi.intercomm.merge               text    html    latex
>>  mpi.parSim                        text    html    latex
>>  mpi.parapply                      text    html    latex   example
>>  mpi.probe                         text    html    latex
>>  mpi.realloc                       text    html    latex
>>  mpi.reduce                        text    html    latex
>>  mpi.remote.exec                   text    html    latex   example
>>  mpi.scatter                       text    html    latex   example
>>  mpi.scatter.Robj                  text    html    latex   example
>>  mpi.send                          text    html    latex   example
>>  mpi.send.Robj                     text    html    latex
>>  mpi.sendrecv                      text    html    latex   example
>>  mpi.setup.rng                     text    html    latex
>>  mpi.spawn.Rslaves                 text    html    latex   example
>>  mpi.universe.size                 text    html    latex
>>  mpi.wait                          text    html    latex
>> ** building package indices ...
>> * DONE (Rmpi)
>>
>> The downloaded packages are in
>>       /tmp/RtmpdX6zlZ/downloaded_packages
>>>
>>
>>>
>>> Dirk Eddelbuettel
>>> (https://stat.ethz.ch/pipermail/r-devel/2008-September/050665.html)
>>> suggested that snow's makeSOCKcluster is an easier starting point for
>>> single computer 'clusters' or other configurations where significant
>>> system administration is not desired -- these should work without
>>> additional software on most systems, even if more limiting in the long
>>> term (in my opinion). See, e.g., the examples on the help page for
>>> clusterApply for basic operation. A bit oddly, apparently the
>>> 'snowfall' package restricts snow's functionality to mpi clusters. So
>>> you might start with snow directly.
>>>
>>> Martin
>>>
>>>>
>>>> I followed the pdf "Developing parallel programs using snowfall" by
>>>> Jochen Knaus,. installed the relevant libraries and programs, but it
>>>> does not work.
>>>>
>>>> I am stuck.
>>>>
>>>> Any help appreciated,
>>>>
>>>> Rainer
>>>>
>>>>
>>>> --
>>>> Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
>>>> Biology, UCT), Dipl. Phys. (Germany)
>>>>
>>>> Centre of Excellence for Invasion Biology
>>>> Faculty of Science
>>>> Natural Sciences Building
>>>> Private Bag X1
>>>> University of Stellenbosch
>>>> Matieland 7602
>>>> South Africa
>>>>
>>>> ______________________________________________
>>>> R-help at 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.
>>>
>>> --
>>> Martin Morgan
>>> Computational Biology / Fred Hutchinson Cancer Research Center
>>> 1100 Fairview Ave. N.
>>> PO Box 19024 Seattle, WA 98109
>>>
>>> Location: Arnold Building M2 B169
>>> Phone: (206) 667-2793
>>>
>>
>>
>>
>>
>
> --
> Luke Tierney
> Chair, Statistics and Actuarial Science
> Ralph E. Wareham Professor of Mathematical Sciences
> University of Iowa                  Phone:             319-335-3386
> Department of Statistics and        Fax:               319-335-3017
>   Actuarial Science
> 241 Schaeffer Hall                  email:      luke at stat.uiowa.edu
> Iowa City, IA 52242                 WWW:  http://www.stat.uiowa.edu
>



-- 
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
Biology, UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Faculty of Science
Natural Sciences Building
Private Bag X1
University of Stellenbosch
Matieland 7602
South Africa



------------------------------

Message: 23
Date: Mon, 29 Sep 2008 16:05:29 +0200
From: "Gondrie, M." <M.Gondrie at umcutrecht.nl>
Subject: [R] nomogram function (design library)
To: <r-help at R-project.org>
Message-ID:
	<72347512FFF6574380BE8AF537C66C91F872DF at EXV5.ds.umcutrecht.nl>
Content-Type: text/plain;	charset="us-ascii"

Dear colleagues,


I hope someone can help me with my problem.

I have fitted a cox model with the following syntax:
 
# cox01def <-cph(Surv(TEVENT,EVENT) ~  ifelse(AGE>50, (AGE-50)^2,0) +
BMI +
# HDL+DIABETES +HISTCAR2 + log(CREAT)+
as.factor(ALBUMIN)+STENOSIS+IMT,data # = XC,  x=T, y=T, surv=T) *1

Furthermore  I have estimated my beta's also with a Lasso method -
Coxpath ( from Glmpath pckage) , namely: 

# LASSOdata <- list(x=cox01$x, time=XC$TEVENT, status=XC$EVENT)
# summary(LASSOdata)
# LASSOpath <- coxpath(data=SMARTdata)

My problem is the following:

I want to make a nomogram with the beta's from the lasso. Is that
possible? I know of the nomogram-function from the "design"-library. I
thought that when I would replace the coefficients of the cph-fit*1 by
the lasso-coefs, the nomogram would change; However it doesn't

# Lasso.coefs <- LASSOpath$b.predictor
# Cox01def$coef <- Lasso.coefs

If it isn't possible to solve this problem with the nomogram-function
from the design library, Then I would like to know if there is an
alternative function available? 
 
I hope to get a reply soon, 
 

Martijn Gondrie ( Utrecht, The Netherlands)  



------------------------------

Message: 24
Date: Mon, 29 Sep 2008 07:15:28 -0700 (PDT)
From: John Kane <jrkrideau at yahoo.ca>
Subject: Re: [R] Cross-tabulation Question
To: r-help at stat.math.ethz.ch,	Shubha Vishwanath Karanth
	<shubhak at ambaresearch.com>
Message-ID: <72969.51129.qm at web38401.mail.mud.yahoo.com>
Content-Type: text/plain; charset=us-ascii

?aggregate or have a look at the reshape package.


--- On Mon, 9/29/08, Shubha Vishwanath Karanth <shubhak at ambaresearch.com> wrote:

> From: Shubha Vishwanath Karanth <shubhak at ambaresearch.com>
> Subject: [R] Cross-tabulation Question
> To: r-help at stat.math.ethz.ch
> Received: Monday, September 29, 2008, 4:54 AM
> Hi R,
> 
>  
> 
> This is a cross tabulation question. Suppose that,
> 
>  
> 
> > d=read.table("clipboard",header=F)
> 
>  
> 
> > d
> 
>   V1  V2    V3
> 
>   A  One Apple
> 
>   A  One  Cake
> 
>   A  One  Cake
> 
>   B  One Apple
> 
>   B  One Apple
> 
>   B  One Apple
> 
>  
> 
> > table(d$V2,d$V3)
> 
>      
> 
>         Apple Cake
> 
>   One     4    2
> 
>  
> 
>  
> 
> But, I don't want the count to be like the above. Here,
> it is counting
> the number of rows in that particular category. What I need
> is in each
> category, the count of unique V1's. So, my output
> should look like,
> 
>  
> 
>         Apple Cake
> 
>   One     2    1
> 
>  
> 
>  
> 
> Any ideas please...
> 
>  
> 
> Thanks, Shubha
> 
>  
> 
> This e-mail may contain confidential and/or privileged
> i...{{dropped:13}}
> 
> ______________________________________________
> R-help at 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.


      __________________________________________________________________
[[elided Yahoo spam]]



------------------------------

Message: 25
Date: Mon, 29 Sep 2008 07:20:38 -0700 (PDT)
From: John Kane <jrkrideau at yahoo.ca>
Subject: Re: [R] does there any function like sumif in excel?
To: R-help at r-project.org, caocheng?? <caocheng8230 at gmail.com>
Message-ID: <972822.20441.qm at web38408.mail.mud.yahoo.com>
Content-Type: text/plain; charset=utf-8

There are several ways to subset the dataframe 
?select will give you one.

or mydata[mydata$A=value]<- mydata

then apply sum()


I do not think there is one single command equivalent to sumif()



--- On Sun, 9/28/08, caocheng?? <caocheng8230 at gmail.com> wrote:

> From: caocheng?? <caocheng8230 at gmail.com>
> Subject: [R] does there any function like sumif in excel?
> To: R-help at r-project.org
> Received: Sunday, September 28, 2008, 10:25 PM
> I have a data.frame datas which have two columns A and B.
> I want to filter column A by some values and to get a value
> list which
> contain the value in B.
> Best wishes!
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at 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.


      __________________________________________________________________
Yahoo! Canada Toolbar: Search from anywhere on the web, and bookmark your favourite sites. Download it now at
http://ca.toolbar.yahoo.com.



------------------------------

Message: 26
Date: Mon, 29 Sep 2008 16:21:14 +0200
From: "Rainer M Krug" <r.m.krug at gmail.com>
Subject: Re: [R] Problem with R on dual core under Linux - can not
	execute	mpi.spawn.Rslaves()
To: "Luke Tierney" <luke at stat.uiowa.edu>
Cc: r-help <r-help at r-project.org>
Message-ID:
	<fb7c7e870809290721t6394098bk7b432db2f158d6a5 at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

I looked at snow and  makeSOCKcluster(c("localhost", "localhost")) and
it perfectly suits my needs. In addition, I want to work on a "real
cluster" which uses MPI, so these two will not interfere. I plan to
use snowSOCKcluster(...) then for the usage of the cores, and MPI (on
the level of the whole simulation) to run one complete simulation on
one node.

Thanks

Rainer


On Mon, Sep 29, 2008 at 3:46 PM, Rainer M Krug <r.m.krug at gmail.com> wrote:
> On Mon, Sep 29, 2008 at 3:05 PM, Luke Tierney <luke at stat.uiowa.edu> wrote:
>> Look at the configure output below: configure is finding mpi.h in
>> /usr/lib/mpich/include, soit is using mpich, not lam.  You may be able
>> to tell Rmpi specifically where to look for LAM stuff or you may need
>> to uninstall mpich (almost surely that can be avoided but it may be
>> easier if you don't really need mpich).
>
> OK - I don't mind if I am using lam or mpich, so which one should I use?
> I am confused.
>
> If it helps, I am using Ubuntu Hardy
>
> Rainer
>
>>
>> Best,
>>
>> luke
>>
>> On Mon, 29 Sep 2008, Rainer M Krug wrote:
>>
>>> On Mon, Sep 29, 2008 at 12:19 AM, Martin Morgan <mtmorgan at fhcrc.org>
>>> wrote:
>>>>
>>>> "Rainer M Krug" <r.m.krug at gmail.com> writes:
>>>>
>>>>> Hi
>>>>>
>>>>> I am trying to utilize my dual core processor (and later a
>>>>> High-performance clusters (HPC) ) by using the Rmpi, snow, snowfall,
>>>>> ... packages, but I am struggling at the beginning, i.e. to initialise
>>>>> the "cluster" on my dual core computer. Whenever I try to initialize
>>>>> it (via sfInit(parallel=TRUE, cpus=2) or mpi.spawn.Rslaves(nslaves=2)
>>>>> ), I get an error message:
>>>>>
>>>>>> sfInit(parallel=TRUE, cpus=2)
>>>>>
>>>>> Forced parallel. Using session: XXXXXXXXR_rkrug_143706_092708
>>>>>
>>>>> Error in mpi.comm.spawn(slave = mpitask, slavearg = args, nslaves =
>>>>> count,  :
>>>>>  MPI_Comm_spawn is not supported.
>>>>> Error in sfInit(parallel = TRUE, cpus = 2) :
>>>>>  Starting of snow cluster failed! Error in mpi.comm.spawn(slave =
>>>>> mpitask, slavearg = args, nslaves = count,  :
>>>>>  MPI_Comm_spawn is not supported.
>>>>>
>>>>> and
>>>>>
>>>>>> mpi.spawn.Rslaves(nslaves=2)
>>>>>
>>>>> Error in mpi.spawn.Rslaves(nslaves = 2) :
>>>>>  You cannot use MPI_Comm_spawn API
>>>>
>>>> This error comes from Rmpi,
>>>>
>>>>> head(mpi.spawn.Rslaves, 6)
>>>>
>>>> 1 function (Rscript = system.file("slavedaemon.R", package = "Rmpi"),
>>>> 2     nslaves = mpi.universe.size(), root = 0, intercomm = 2, comm = 1,
>>>> 3     hosts = NULL, needlog = TRUE, mapdrive = TRUE)
>>>> 4 {
>>>> 5     if (!is.loaded("mpi_comm_spawn"))
>>>> 6         stop("You cannot use MPI_Comm_spawn API")
>>>>
>>>> and occurs when the compiler variable MPI2 is undefined when your
>>>
>>>> package is installed. Likely this means that your mpi installation is
>>>> either old (unlikely?) or that your Rmpi installation failed to
>>>> properly detect the installed mpi version. It's difficult to know
>>>> which, without more information on how the mpi and Rmpi installations
>>>> went, at a minimum the result of R's sessionInfo() command and mpirun
>>>> --version but likely including the output of Rmpi's installation.
>>>
>>> Version:
>>> lamboot -V
>>>
>>> LAM 7.1.2/MPI 2 C++/ROMIO - Indiana University
>>>
>>>       Arch:           i486-pc-linux-gnu
>>>       Prefix:         /usr/lib/lam
>>>       Configured by:  buildd
>>>       Configured on:  Sun Mar 23 08:07:16 UTC 2008
>>>       Configure host: rothera
>>>       SSI rpi:        crtcp lamd sysv tcp usysv
>>>
>>> Below find the session info and the info from the instalaltion of Rmpi.
>>>
>>> In the install log from Rmpi, it says:
>>> checking whether MPICH2 is declared... no
>>> checking whether MPICH2 is declared... (cached) no
>>>
>>> So what went wrong? Do I have to start the "cluster" on the dual-core
>>> machine?
>>> Can I set the compiler variable MPI2 manually?
>>>
>>>> version
>>>
>>>              _
>>> platform       i486-pc-linux-gnu
>>> arch           i486
>>> os             linux-gnu
>>> system         i486, linux-gnu
>>> status
>>> major          2
>>> minor          7.2
>>> year           2008
>>> month          08
>>> day            25
>>> svn rev        46428
>>> language       R
>>> version.string R version 2.7.2 (2008-08-25)
>>>>
>>>> sessionInfo()
>>>
>>> R version 2.7.2 (2008-08-25)
>>> i486-pc-linux-gnu
>>>
>>> locale:
>>>
>>> LC_CTYPE=en_ZA.UTF-8;LC_NUMERIC=C;LC_TIME=en_ZA.UTF-8;LC_COLLATE=en_ZA.UTF-8;LC_MONETARY=C;LC_MESSAGES=en_ZA.UTF-8;LC_PAPER=en_ZA.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_ZA.UTF-8;LC_IDENTIFICATION=C
>>>
>>> attached base packages:
>>> [1] stats     graphics  grDevices utils     datasets  methods   base
>>>
>>> other attached packages:
>>> [1] snow_0.3-3    Rmpi_0.5-5    snowfall_1.53
>>>
>>> loaded via a namespace (and not attached):
>>> [1] tools_2.7.2
>>>>
>>>> install.packages(c("Rmpi"), dep=TRUE, repo="http://cbio.uct.ac.za/CRAN/")
>>>
>>> Warning in install.packages(c("Rmpi"), dep = TRUE, repo =
>>> "http://cbio.uct.ac.za/CRAN/") :
>>>  argument 'lib' is missing: using '/usr/local/lib/R/site-library'
>>> trying URL 'http://cbio.uct.ac.za/CRAN/src/contrib/Rmpi_0.5-5.tar.gz'
>>> Content type 'application/x-gzip' length 94643 bytes (92 Kb)
>>> opened URL
>>> ==================================================
>>> downloaded 92 Kb
>>>
>>> * Installing *source* package 'Rmpi' ...
>>> checking for gcc... gcc
>>> checking for C compiler default output file name... a.out
>>> checking whether the C compiler works... yes
>>> checking whether we are cross compiling... no
>>> checking for suffix of executables...
>>> checking for suffix of object files... o
>>> checking whether we are using the GNU C compiler... yes
>>> checking whether gcc accepts -g... yes
>>> checking for gcc option to accept ISO C89... none needed
>>> I am here /usr/lib/mpich and it is MPICH
>>> Try to find mpi.h ...
>>> Found in /usr/lib/mpich/include
>>> Try to find libmpi.so or libmpich.a
>>> Found libmpich in /usr/lib/mpich/lib
>>> ##########################################
>>> checking whether MPICH2 is declared... no
>>> checking whether MPICH2 is declared... (cached) no
>>> ##########################################
>>> checking for openpty in -lutil... yes
>>> checking for main in -lpthread... yes
>>> configure: creating ./config.status
>>> config.status: creating src/Makevars
>>> ** libs
>>> gcc -std=gnu99 -I/usr/share/R/include -DPACKAGE_NAME=\"\"
>>> -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\"
>>> -DPACKAGE_BUGREPORT=\"\" -DHAVE_DECL_MPICH2=0 -DHAVE_DECL_MPICH2=0
>>> -I/usr/lib/mpich/include  -DMPICH -fPIC     -fpic  -g -O2 -c
>>> conversion.c -o conversion.o
>>> gcc -std=gnu99 -I/usr/share/R/include -DPACKAGE_NAME=\"\"
>>> -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\"
>>> -DPACKAGE_BUGREPORT=\"\" -DHAVE_DECL_MPICH2=0 -DHAVE_DECL_MPICH2=0
>>> -I/usr/lib/mpich/include  -DMPICH -fPIC     -fpic  -g -O2 -c
>>> internal.c -o internal.o
>>> gcc -std=gnu99 -I/usr/share/R/include -DPACKAGE_NAME=\"\"
>>> -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\"
>>> -DPACKAGE_BUGREPORT=\"\" -DHAVE_DECL_MPICH2=0 -DHAVE_DECL_MPICH2=0
>>> -I/usr/lib/mpich/include  -DMPICH -fPIC     -fpic  -g -O2 -c
>>> RegQuery.c -o RegQuery.o
>>> gcc -std=gnu99 -I/usr/share/R/include -DPACKAGE_NAME=\"\"
>>> -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\"
>>> -DPACKAGE_BUGREPORT=\"\" -DHAVE_DECL_MPICH2=0 -DHAVE_DECL_MPICH2=0
>>> -I/usr/lib/mpich/include  -DMPICH -fPIC     -fpic  -g -O2 -c Rmpi.c -o
>>> Rmpi.o
>>> gcc -std=gnu99 -shared  -o Rmpi.so conversion.o internal.o RegQuery.o
>>> Rmpi.o -L/usr/lib/mpich/lib -lmpich -lutil -lpthread -fPIC
>>> -L/usr/lib/R/lib -lR
>>> ** R
>>> ** demo
>>> ** inst
>>> ** preparing package for lazy loading
>>> ** help
>>> >>> Building/Updating help pages for package 'Rmpi'
>>>    Formats: text html latex example
>>>  hosts                             text    html    latex
>>>  internal                          text    html    latex
>>>  mpi.abort                         text    html    latex
>>>  mpi.apply                         text    html    latex   example
>>>  mpi.barrier                       text    html    latex
>>>  mpi.bcast                         text    html    latex
>>>  mpi.bcast.Robj                    text    html    latex
>>>  mpi.bcast.cmd                     text    html    latex
>>>  mpi.cart.coords                   text    html    latex   example
>>>  mpi.cart.create                   text    html    latex   example
>>>  mpi.cart.get                      text    html    latex   example
>>>  mpi.cart.rank                     text    html    latex   example
>>>  mpi.cart.shift                    text    html    latex   example
>>>  mpi.cartdim.get                   text    html    latex   example
>>>  mpi.comm                          text    html    latex   example
>>>  mpi.comm.disconnect               text    html    latex
>>>  mpi.comm.free                     text    html    latex
>>>  mpi.comm.inter                    text    html    latex
>>>  mpi.comm.set.errhandler           text    html    latex
>>>  mpi.comm.spawn                    text    html    latex
>>>  mpi.const                         text    html    latex
>>>  mpi.dims.create                   text    html    latex   example
>>>  mpi.exit                          text    html    latex
>>>  mpi.finalize                      text    html    latex
>>>  mpi.gather                        text    html    latex   example
>>>  mpi.gather.Robj                   text    html    latex   example
>>>  mpi.get.count                     text    html    latex
>>>  mpi.get.processor.name            text    html    latex
>>>  mpi.get.sourcetag                 text    html    latex
>>>  mpi.info                          text    html    latex
>>>  mpi.init.sprng                    text    html    latex
>>>  mpi.intercomm.merge               text    html    latex
>>>  mpi.parSim                        text    html    latex
>>>  mpi.parapply                      text    html    latex   example
>>>  mpi.probe                         text    html    latex
>>>  mpi.realloc                       text    html    latex
>>>  mpi.reduce                        text    html    latex
>>>  mpi.remote.exec                   text    html    latex   example
>>>  mpi.scatter                       text    html    latex   example
>>>  mpi.scatter.Robj                  text    html    latex   example
>>>  mpi.send                          text    html    latex   example
>>>  mpi.send.Robj                     text    html    latex
>>>  mpi.sendrecv                      text    html    latex   example
>>>  mpi.setup.rng                     text    html    latex
>>>  mpi.spawn.Rslaves                 text    html    latex   example
>>>  mpi.universe.size                 text    html    latex
>>>  mpi.wait                          text    html    latex
>>> ** building package indices ...
>>> * DONE (Rmpi)
>>>
>>> The downloaded packages are in
>>>       /tmp/RtmpdX6zlZ/downloaded_packages
>>>>
>>>
>>>>
>>>> Dirk Eddelbuettel
>>>> (https://stat.ethz.ch/pipermail/r-devel/2008-September/050665.html)
>>>> suggested that snow's makeSOCKcluster is an easier starting point for
>>>> single computer 'clusters' or other configurations where significant
>>>> system administration is not desired -- these should work without
>>>> additional software on most systems, even if more limiting in the long
>>>> term (in my opinion). See, e.g., the examples on the help page for
>>>> clusterApply for basic operation. A bit oddly, apparently the
>>>> 'snowfall' package restricts snow's functionality to mpi clusters. So
>>>> you might start with snow directly.
>>>>
>>>> Martin
>>>>
>>>>>
>>>>> I followed the pdf "Developing parallel programs using snowfall" by
>>>>> Jochen Knaus,. installed the relevant libraries and programs, but it
>>>>> does not work.
>>>>>
>>>>> I am stuck.
>>>>>
>>>>> Any help appreciated,
>>>>>
>>>>> Rainer
>>>>>
>>>>>
>>>>> --
>>>>> Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
>>>>> Biology, UCT), Dipl. Phys. (Germany)
>>>>>
>>>>> Centre of Excellence for Invasion Biology
>>>>> Faculty of Science
>>>>> Natural Sciences Building
>>>>> Private Bag X1
>>>>> University of Stellenbosch
>>>>> Matieland 7602
>>>>> South Africa
>>>>>
>>>>> ______________________________________________
>>>>> R-help at 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.
>>>>
>>>> --
>>>> Martin Morgan
>>>> Computational Biology / Fred Hutchinson Cancer Research Center
>>>> 1100 Fairview Ave. N.
>>>> PO Box 19024 Seattle, WA 98109
>>>>
>>>> Location: Arnold Building M2 B169
>>>> Phone: (206) 667-2793
>>>>
>>>
>>>
>>>
>>>
>>
>> --
>> Luke Tierney
>> Chair, Statistics and Actuarial Science
>> Ralph E. Wareham Professor of Mathematical Sciences
>> University of Iowa                  Phone:             319-335-3386
>> Department of Statistics and        Fax:               319-335-3017
>>   Actuarial Science
>> 241 Schaeffer Hall                  email:      luke at stat.uiowa.edu
>> Iowa City, IA 52242                 WWW:  http://www.stat.uiowa.edu
>>
>
>
>
> --
> Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
> Biology, UCT), Dipl. Phys. (Germany)
>
> Centre of Excellence for Invasion Biology
> Faculty of Science
> Natural Sciences Building
> Private Bag X1
> University of Stellenbosch
> Matieland 7602
> South Africa
>



-- 
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
Biology, UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Faculty of Science
Natural Sciences Building
Private Bag X1
University of Stellenbosch
Matieland 7602
South Africa



------------------------------

Message: 27
Date: Mon, 29 Sep 2008 09:24:09 -0500
From: "Lucke, Joseph F" <Joseph.F.Lucke at uth.tmc.edu>
Subject: Re: [R] Bug in "is" ?
To: "Stefan Evert" <stefan.evert at uos.de>,	"R-help Mailing List"
	<r-help at r-project.org>
Message-ID:
	<4677FCB5A35A0441A0E0C99D56B23D910D8BD670 at UTHEVS2.mail.uthouston.edu>
Content-Type: text/plain;	charset="us-ascii"

Stefan
You are right.  Briefly put, the existence of 7 requires only Peano's
axiom for successive integers.  Strictly speaking, 7 is not an integer
but a natural number. But natural numbers can be embedded in the
integers which can be embedded in the rationals which can be embedded
the reals which can be embedded in the complex. Little of this is
relevant to a programming language's two basic storage modes for
numbers. Confusing a variable type with a mathematical set is an
elementary, if entertaining, logical error.
Joe

-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
On Behalf Of Stefan Evert
Sent: Saturday, September 27, 2008 12:27 PM
To: R-help Mailing List
Subject: Re: [R] Bug in "is" ?

Hi everyone!

Sorry for taking an already overlong discussion thread slightly off-
topic, but ...

> quote:
> No doubt, 7.0 is integer in math. But if people can write 7 why people

> need to write 7.0 (I do not see any reason to do this).
> endquote

> What is true in mathematics is not necessarily true in R.

... am I the only one who thinks that the integer 7 is something
entirely different from the real number 7.0? (The latter most likely
being an equivalence class of sequences of rational numbers, but that
depends on your axiomatisation of real numbers.) Integers can be
embedded in the set of real numbers, but that doesn't make them the same
mathematically.

So the original complaint should really have said that is.integer()
doesn't do what a naive user (i.e. someone without a background in
computer science or maths) might expect it to do. :-)

That said, I've fallen into the same trap more than once, and painfully,
myself (often in connection with MySQL).


Best wishes, and with a tiny grain of salt, Stefan Evert

[ stefan.evert at uos.de | http://purl.org/stefan.evert ]




	[[alternative HTML version deleted]]

______________________________________________
R-help at 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.



------------------------------

Message: 28
Date: Mon, 29 Sep 2008 10:26:30 -0400
From: "Gabor Grothendieck" <ggrothendieck at gmail.com>
Subject: Re: [R] Cross-tabulation Question
To: "Shubha Vishwanath Karanth" <shubhak at ambaresearch.com>
Cc: r-help at stat.math.ethz.ch
Message-ID:
	<971536df0809290726h20f5dbd7k8612099b83cd68c3 at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

Try this:

> with(unique(x), table(V2, V3))
     V3
V2    Apple Cake
  One     2    1


On Mon, Sep 29, 2008 at 4:54 AM, Shubha Vishwanath Karanth
<shubhak at ambaresearch.com> wrote:
> Hi R,
>
>
>
> This is a cross tabulation question. Suppose that,
>
>
>
>> d=read.table("clipboard",header=F)
>
>
>
>> d
>
>  V1  V2    V3
>
>  A  One Apple
>
>  A  One  Cake
>
>  A  One  Cake
>
>  B  One Apple
>
>  B  One Apple
>
>  B  One Apple
>
>
>
>> table(d$V2,d$V3)
>
>
>
>        Apple Cake
>
>  One     4    2
>
>
>
>
>
> But, I don't want the count to be like the above. Here, it is counting
> the number of rows in that particular category. What I need is in each
> category, the count of unique V1's. So, my output should look like,
>
>
>
>        Apple Cake
>
>  One     2    1
>
>
>
>
>
> Any ideas please...
>
>
>
> Thanks, Shubha
>
>
>
> This e-mail may contain confidential and/or privileged i...{{dropped:13}}
>
> ______________________________________________
> R-help at 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.
>



------------------------------

Message: 29
Date: Tue, 30 Sep 2008 00:37:41 +1000
From: "Jason Lee" <huajie.lee at gmail.com>
Subject: [R] How to remove columns of table in R recursively
To: r-help at r-project.org
Message-ID:
	<a847b5a10809290737w4462cadds41f8d39fe508f0fc at mail.gmail.com>
Content-Type: text/plain

Hi R-list,

I would like to know how to perform any elimination of attribute (column) in
R.

E.g I  have:-

20,21,22,23,24,25,normal
1,2,3,4,5,5,normal
0,1,0,2,3,4,abnormal
...

I intend to do a checking on each column:-

If the column sum of abnormal is 0 but the column sum of normal is nonzero,
i wanted to eliminate this attribute. And so on and so forth observing other
attributes across the list. In the end, I wanted to form information as a
table.

Desired Output:-
21,23,24,25,normal
2,4,5,5,normal
1,2,3,4,abnormal

It is some sort of removing noise from the data.

Appreciate alot. Thanks.

Rgrds,

	[[alternative HTML version deleted]]



------------------------------

Message: 30
Date: Mon, 29 Sep 2008 23:45:46 +0900
From: "June Kim" <juneaftn at gmail.com>
Subject: [R] turning comma separated string from multiple choices into
	flags
To: r-help at r-project.org
Message-ID:
	<6f80c1520809290745v29ae5e8bs62debff6b87c731b at mail.gmail.com>
Content-Type: text/plain; charset=UTF-8

Hello,

I use google docs' Forms to conduct surveys online. Multiple choices
questions are coded as comma separated values.

For example,

if the question is like:

1. What magazines do you currently subscribe to? (you can choose
multiple choices)
1) Fast Company
2) Havard Business Review
3) Business Week
4) The Economist

And if the subject chose 1) and 3), the data is coded as a cell in a
spreadsheet as,

"Fast Company, Business Week"

I read the data with read.csv into R. To analyze the data, I have to
change that string into something like flags(indicator variables?).
That is, there should be 4 variables, of which values are either 1 or
0, indicating chosen or not-chosen respectively.

Suppose the data is something like,

> survey1
  age                                    favorite_magazine
1  29                                         Fast Company
2  31                          Fast Company, Business Week
3  32 Havard Business Review, Business Week, The Economist
>

Then I have to chop the string in favorite_magazine column to turn
that data into something like,

> survey1transformed
  age Fast Company Havard Business Review Business Week The Economist
1  29            1                      0             0             0
2  31            1                      0             1             0
3  32            0                      1             1             1
>

Actually I have many more multiple choice questions in the survey.

What is the easy elegant and natural way in R to do the job?



------------------------------

Message: 31
Date: Mon, 29 Sep 2008 15:55:35 +0200
From: "Jean-Louis Abitbol" <jlabitbol at trophos.com>
Subject: [R] Script for dose proportionality assessment using power
	model and confidence interval criteria
To: "R Help" <r-help at stat.math.ethz.ch>
Message-ID: <1222696535.17289.1276523769 at webmail.messagingengine.com>
Content-Type: text/plain; charset="ISO-8859-1"

Dear R-Helpers

Has anyone written a script for the dose proportionality assessement
using the power model and the confidence interval criteria as described
in

- Gough at al. Assessment of dose proportionality: report from the
statisticians in the pharmaceutical industry in Drug Information
Journal,1995,     29:1039-1048 and/or
- Smith et al. Confidence interval criteria for assessment of dose
proportionality in Pharmaceutical Research, 2000, 20:1278-1283

As an aside, and before tweaking the source of function NCAanalyze in
the bear package, I wonder if anyone has a function for doing non
compartimental PK analysis by subject on a dataframe with subject, time
and concentration variates.  

Thanks in advance for sharing and helping me not re-invent the wheel
(which might be square given my R skills).

Best wishes, Jean-Louis

 
  
Jean-Louis Abitbol, MD
Chief Medical Officer
Trophos SA, Parc scientifique de Luminy, Case 931
Luminy Biotech Entreprises
13288 Marseille Cedex 9 France
Email: jlabitbol at trophos.com ---- Backup Email: abitbol at sent.com
Cellular: (33) (0)6 24 47 59 34
Direct Line: (33) (0)4 91 82 82 73-Switchboard: (33) (0)4 91 82 82 82  
Fax: (33) (0)4 91 82 82 89



------------------------------

Message: 32
Date: Mon, 29 Sep 2008 11:02:41 -0400
From: "Liaw, Andy" <andy_liaw at merck.com>
Subject: Re: [R] ariable Importance Measure in Package RandomForest
To: <linuxkaffee at gmx.net>
Cc: r-help at r-project.org, Uwe Ligges <ligges at statistik.tu-dortmund.de>
Message-ID:
	<39B6DDB9048D0F4DAD42CB26AAFF0AFA063CFF24 at usctmx1106.merck.com>
Content-Type: text/plain; charset="us-ascii"

The randomForest package is based on Breiman & Cutler's original code,
which grows trees using the CART algorithm.  The Gini criterion for
splitting nodes is hard-coded in the Fortran.  If you want info gain as
measure of variable importance, you should be growing trees using that
as the splitting criterion.  It may (or may not) be possible with the
party package, as that's a more modular design.  That's something you
can look into.

Best,
Andy 

From:  Uwe Ligges
> 
> Given you do not want to touch the randomForest 
> implementation itself, 
> the answer is "no, there is no particular function to do it 
> in package 
> randomForest. More particular:
> 
> ?randomForest tells us that a value "importance" is returned 
> that is `a 
> matrix with nclass + 2 (for classification) or two (for regression) 
> columns. For classification, the first nclass columns are the 
> class-specific measures computed as mean descrease in accuracy. The 
> nclass + 1st column is the mean descrease in accuracy over 
> all classes. 
> The last column is the mean decrease in Gini index. For 
> Regression, the 
> first column is the mean decrease in accuracy and the second the mean 
> decrease in MSE. If importance=FALSE, the last measure is 
> still returned 
> as a vector.'
> 
> So as far as I can see, you would have to change randomForest itself 
> that has to return some relevant values in order to calculate the 
> criterion(s) you are interested in.
> 
> Best wishes,
> Uwe Ligges
> 
> 
> 
> 
> 
> 
> linuxkaffee at gmx.net wrote:
> > Hi,
> > 
> > I've a question about the RandomForest package.
> > 
> > The package allows the extraction of a variable importance 
> measure. As far as
> > I could see from the documentation, the computation is 
> based on the Gini index.
> > 
> > Do you know if this extraction can be also based on other 
> criteria? In particular,
> > I'm interested in the info gain criterion.
> > 
> > Best regards,
> > Chris
> > --
> > 
> > ______________________________________________
> > R-help at 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 at 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.
> 
Notice:  This e-mail message, together with any attachme...{{dropped:12}}



------------------------------

Message: 33
Date: Mon, 29 Sep 2008 17:03:17 +0200
From: Peter Dalgaard <P.Dalgaard at biostat.ku.dk>
Subject: Re: [R] turning comma separated string from multiple choices
	into flags
To: June Kim <juneaftn at gmail.com>
Cc: r-help at r-project.org
Message-ID: <48E0EE35.9080901 at biostat.ku.dk>
Content-Type: text/plain; charset=UTF-8

June Kim wrote:
> Hello,
>
> I use google docs' Forms to conduct surveys online. Multiple choices
> questions are coded as comma separated values.
>
> For example,
>
> if the question is like:
>
> 1. What magazines do you currently subscribe to? (you can choose
> multiple choices)
> 1) Fast Company
> 2) Havard Business Review
> 3) Business Week
> 4) The Economist
>
> And if the subject chose 1) and 3), the data is coded as a cell in a
> spreadsheet as,
>
> "Fast Company, Business Week"
>
> I read the data with read.csv into R. To analyze the data, I have to
> change that string into something like flags(indicator variables?).
> That is, there should be 4 variables, of which values are either 1 or
> 0, indicating chosen or not-chosen respectively.
>
> Suppose the data is something like,
>
>   
>> survey1
>>     
>   age                                    favorite_magazine
> 1  29                                         Fast Company
> 2  31                          Fast Company, Business Week
> 3  32 Havard Business Review, Business Week, The Economist
>   
>
> Then I have to chop the string in favorite_magazine column to turn
> that data into something like,
>
>   
>> survey1transformed
>>     
>   age Fast Company Havard Business Review Business Week The Economist
> 1  29            1                      0             0             0
> 2  31            1                      0             1             0
> 3  32            0                      1             1             1
>   
>
> Actually I have many more multiple choice questions in the survey.
>
> What is the easy elegant and natural way in R to do the job?
>   

I'd look into something like as.data.frame(lapply(strings, grep,
x=favorite_magazine, fixed=TRUE)), where strings <- c("Fast Company",
"Havard Business Review", ...).

(I take it that the mechanism is such that you can rely on at least
having everything misspelled in the same way? If it is alternatingly
"Havard" and "Harvard", then things get a bit trickier.)

-- 
   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.dalgaard at biostat.ku.dk)              FAX: (+45) 35327907



------------------------------

Message: 34
Date: Mon, 29 Sep 2008 17:10:46 +0200
From: Eik Vettorazzi <E.Vettorazzi at uke.uni-hamburg.de>
Subject: Re: [R] density estimate
To: rsumithran at yahoo.com
Cc: r-help <r-help at r-project.org>
Message-ID: <48E0EFF6.3010100 at uke.uni-hamburg.de>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

The calculation of the Kullback Leibler measure depends on the scale of 
your probability function. If it is discrete, the formula with "sum" 
term applies. In the continuous case "sum" is replaced by "intgrate".
you may have a look at 
http://finzi.psych.upenn.edu/R/library/flexmix/html/KLdiv.html which 
covers both cases.
For continuous random variables you can typically get only probability 
statements for intervals - by integrating the density function over the 
range of the given interval. If your sample space is uncountable (say 
for instance the set of all real numbers), then it can be shown that 
every elementary event has to have a probability of zero.

hth.

Sumithran schrieb:
> Thank you. 
>
> I need the probability, because I'm trying to get the Kullback Leibler measure between two densities. Is there any package which gives the probability function for continuous distributions?
>
>
> Thaks,
>
> Lavan
>
> --- On Mon, 9/29/08, Eik Vettorazzi <E.Vettorazzi at uke.uni-hamburg.de> wrote:
>
>   
>> From: Eik Vettorazzi <E.Vettorazzi at uke.uni-hamburg.de>
>> Subject: Re: [R]  density estimate
>> To: "Lavan" <rsumithran at yahoo.com>
>> Cc: r-help at r-project.org
>> Date: Monday, September 29, 2008, 7:39 AM
>> Hi Lavan,
>> a continuous density is not restricted to be within [0, 1].
>> Its only 
>> bound to have an integral of 1.
>> For example
>> dnorm(0,sd=.1)
>> is a very common density and gives 3.989423. A density
>> function is not a 
>> probability function!
>> If you think your data x is discrete than you can assign
>> the correct 
>> probability mass for each data point by
>>  prop.table(table(x))
>>
>> hth.
>>
>> Lavan schrieb:
>>     
>>> Hi,
>>>
>>> I have a vector or random variables and I'm
>>>       
>> estimating the density using
>>     
>>> "bkde" function in the KernSmooth package.
>>>       
>> The out put contains two vectors
>>     
>>> (x and y), and the R documentation calls y as the
>>>       
>> density estimates, but my
>>     
>>> y-values are not exact density etstimates (since these
>>>       
>> are numbers larger
>>     
>>> than 1)! what is y here? Is it possible to get the
>>>       
>> true estimated density at
>>     
>>> each value of x?
>>>
>>> Thanks
>>>
>>>
>>>   
>>>       
>> -- 
>> Eik Vettorazzi
>> Institut f?r Medizinische Biometrie und Epidemiologie
>> Universit?tsklinikum Hamburg-Eppendorf
>>
>> Martinistr. 52
>> 20246 Hamburg
>>
>> T ++49/40/42803-8243
>> F ++49/40/42803-7790
>>     
>
>
>       
>   

-- 
Eik Vettorazzi
Institut f?r Medizinische Biometrie und Epidemiologie
Universit?tsklinikum Hamburg-Eppendorf

Martinistr. 52
20246 Hamburg

T ++49/40/42803-8243
F ++49/40/42803-7790



------------------------------

Message: 35
Date: Tue, 30 Sep 2008 00:12:34 +0900
From: "June Kim" <juneaftn at gmail.com>
Subject: Re: [R] turning comma separated string from multiple choices
	into	flags
To: "Peter Dalgaard" <P.Dalgaard at biostat.ku.dk>
Cc: r-help at r-project.org
Message-ID:
	<6f80c1520809290812w1df0b62fj5bd66f0ff42ad297 at mail.gmail.com>
Content-Type: text/plain; charset=UTF-8

Thank you. The misspelling of Harvard wasn't intended. The data are
spelled consistently.

2008/9/30 Peter Dalgaard <P.Dalgaard at biostat.ku.dk>:
> June Kim wrote:
>> Hello,
>>
>> I use google docs' Forms to conduct surveys online. Multiple choices
>> questions are coded as comma separated values.
>>
>> For example,
>>
>> if the question is like:
>>
>> 1. What magazines do you currently subscribe to? (you can choose
>> multiple choices)
>> 1) Fast Company
>> 2) Havard Business Review
>> 3) Business Week
>> 4) The Economist
>>
>> And if the subject chose 1) and 3), the data is coded as a cell in a
>> spreadsheet as,
>>
>> "Fast Company, Business Week"
>>
>> I read the data with read.csv into R. To analyze the data, I have to
>> change that string into something like flags(indicator variables?).
>> That is, there should be 4 variables, of which values are either 1 or
>> 0, indicating chosen or not-chosen respectively.
>>
>> Suppose the data is something like,
>>
>>
>>> survey1
>>>
>>   age                                    favorite_magazine
>> 1  29                                         Fast Company
>> 2  31                          Fast Company, Business Week
>> 3  32 Havard Business Review, Business Week, The Economist
>>
>>
>> Then I have to chop the string in favorite_magazine column to turn
>> that data into something like,
>>
>>
>>> survey1transformed
>>>
>>   age Fast Company Havard Business Review Business Week The Economist
>> 1  29            1                      0             0             0
>> 2  31            1                      0             1             0
>> 3  32            0                      1             1             1
>>
>>
>> Actually I have many more multiple choice questions in the survey.
>>
>> What is the easy elegant and natural way in R to do the job?
>>
>
> I'd look into something like as.data.frame(lapply(strings, grep,
> x=favorite_magazine, fixed=TRUE)), where strings <- c("Fast Company",
> "Havard Business Review", ...).
>
> (I take it that the mechanism is such that you can rely on at least
> having everything misspelled in the same way? If it is alternatingly
> "Havard" and "Harvard", then things get a bit trickier.)
>
> --
>   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.dalgaard at biostat.ku.dk)              FAX: (+45) 35327907
>
>
>

------------------------------

Message: 36
Date: Mon, 29 Sep 2008 08:29:03 -0700 (PDT)
From: Xia Wang <xiawang2007 at yahoo.com>
Subject: [R] Acceptance rate in metrop
To: r-help at r-project.org
Cc: xiawang2007 at yahoo.com
Message-ID: <957982.56567.qm at web55106.mail.re4.yahoo.com>
Content-Type: text/plain





Hi I am using metrop in MCMC library.  Since some times the prior density is 0 and
the log prior density would be –Inf, I ask the return value for loglikelihood
equal to Min.log, which is defined as log(.Machine$double.xmin)-400, whenever a
–Inf occurs to the logdensity.  However,
I noticed if two Min.log’s happen in a row, the sampled parameter value for the
second Min.log is treated as accepted. 
As a result, the parameters result in 0 prior density are included in my
results, which I do not want to do.  How
should I deal with it to avoid the acceptance of these iterations in MCMC?  Thanks for your help!






      
	[[alternative HTML version deleted]]



------------------------------

Message: 37
Date: Mon, 29 Sep 2008 17:32:30 +0200
From: Peter Dalgaard <P.Dalgaard at biostat.ku.dk>
Subject: Re: [R] turning comma separated string from multiple choices
	into flags
To: June Kim <juneaftn at gmail.com>
Cc: r-help at r-project.org
Message-ID: <48E0F50E.7030307 at biostat.ku.dk>
Content-Type: text/plain; charset=UTF-8

June Kim wrote:
> Thank you. The misspelling of Harvard wasn't intended. The data are
> spelled consistently.
>   
OK. One other potential problem: If the strings are substrings of
eachother (as in "Science" and "Statistical Science") then you may need
more care.

And I misremembered: It is probably better to use regexpr(....) != -1
than grep(....) for this purpose because the latter returns indices
rather than a value for each element.

-- 
   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.dalgaard at biostat.ku.dk)              FAX: (+45) 35327907



------------------------------

Message: 38
Date: Mon, 29 Sep 2008 08:46:07 -0700 (PDT)
From: Pedro Barros <pedro.barros at fao.org>
Subject: [R]  ggplot 2 - editing in the "panel_1_1" viewport
To: r-help at r-project.org
Message-ID: <19726397.post at talk.nabble.com>
Content-Type: text/plain; charset=us-ascii


Hi All,

I am trying to find out how to access the components of a ggplot plot, and I
found this reply from Paul Murrel
http://www.nabble.com/navigating-ggplot-viewports-tt14826352.html#a15056223.
I tried it, and it works.
However, I am trying to develop some functions that will do the drawing
"automatically", and usually I will not know the full name of the grob that
has the layout vp, like "plot.gtree.76". Is there a way that I can repeat
the same process, without going through the grid.ls step?

Thanks,
Pedro
-- 
View this message in context: http://www.nabble.com/ggplot-2---editing-in-the-%22panel_1_1%22-viewport-tp19726397p19726397.html
Sent from the R help mailing list archive at Nabble.com.



------------------------------

Message: 39
Date: Mon, 29 Sep 2008 08:47:07 -0700 (PDT)
From: popsmelove <cedric.carpentier at halbis.com>
Subject: [R]  Sending Notes email out of R under windows
To: r-help at r-project.org
Message-ID: <19726419.post at talk.nabble.com>
Content-Type: text/plain; charset=us-ascii


Hi, 

I'm trying to send a mail out of R with my lotus Notes mailing box.

I've find the object "Notes.NotesSession", but when I use comGetObjectInfo
to know wich method I can Use there is nothing (on ly return NULL)  Then I
don't know how to send an E-mail with R script.


Have you an idea ?


Thanks
 
-- 
View this message in context: http://www.nabble.com/Sending-Notes-email-out-of-R-under-windows-tp19726419p19726419.html
Sent from the R help mailing list archive at Nabble.com.



------------------------------

Message: 40
Date: Mon, 29 Sep 2008 17:01:54 +0100
From: Richard.Cotton at hsl.gov.uk
Subject: Re: [R] adjusting textsize and spacing in mosaic (vcd
	package)
To: r-help at r-project.org, r-help-bounces at r-project.org
Message-ID:
	<OFBF85136D.D8318CA2-ON802574D3.0057DE54-802574D3.005810D3 at hsl.gov.uk>
Content-Type: text/plain; charset="US-ASCII"

> I'm trying to find a way to change the font size in a mosaic plot (the 
> grid version, not the base graphics one).
> 
> Here's an example to demonstrate:
> #Basic plot
> library(vcd)
> mosaic(HairEyeColor, shade = TRUE)
> 
> #Bad first guess: this stops the default cell colouring, and doesn't 
> change the font size
> mosaic(HairEyeColor, shade = TRUE, gp=gpar(fontsize=16))
> 
> #This successfully changes most of the text sizes, but not the numbers 
on 
> the legend scale
> mosaic(HairEyeColor, shade = TRUE, 
>    labeling_args=list(gp_labels=gpar(fontsize=16),
>       gp_varnames=gpar(fontsize=18)),
>    legend_args=list(fontsize=16),
>    margins=unit(4, "lines"),
>    legend_width=unit(7, "lines"))
> 
> How do I change the size of the text on the legend scale?
> 
> Also, is there a way to change all the font sizes at once? 

For mailing list posterity, the workaround that was sent to me off-list is 
to set the pointsize argument on the device, for example:

windows(pointsize=16)
mosaic(HairEyeColor, shade = TRUE)

Interestingly, this appears to only change the legend scale fontsize, and 
ignore the other text.

Regards,
Richie.

Mathematical Sciences Unit
HSL


------------------------------------------------------------------------
ATTENTION:

This message contains privileged and confidential inform...{{dropped:20}}



------------------------------

Message: 41
Date: Mon, 29 Sep 2008 09:35:59 -0700
From: "Kyle Matoba" <kmmatoba at ucdavis.edu>
Subject: [R] multiple page pdf file using pdf()
To: r-help at r-project.org
Message-ID:
	<b72a69660809290935n7ce9f1vae76fdcb7f87affb at mail.gmail.com>
Content-Type: text/plain

List,

I am currently producing a series of charts using multiple calls to pdf()
but, rather than having 'n' single plot files, would like them all to go
into one 'n'-page pdf file. Would someone be so kind as to explain how, if
at all, I might go about doing this from within R? I have only ever
previously used devices besides x11 by analogy with printing things to x11.

I am running R-2.7.2 on Red Hat Linux.



TIA,

Kyle

	[[alternative HTML version deleted]]



------------------------------

Message: 42
Date: Mon, 29 Sep 2008 10:38:01 -0600
From: Greg Snow <Greg.Snow at imail.org>
Subject: Re: [R] Trend graph
To: "C.H." <chainsawtiney at gmail.com>, "r-help at r-project.org"
	<r-help at r-project.org>
Message-ID:
	<B37C0A15B8FB3C468B5BC7EBC7DA14CC6132C7170E at LP-EXMBVS10.CO.IHC.COM>
Content-Type: text/plain; charset="us-ascii"

Try this:

pre <- c(1,2,3,4,5)
post <- c(2,5,7,2,3)

plot( 1:2, range(pre,post), type='n', xlab='', ylab='CRP (mg/dl)', xaxt='n')
segments(1,pre,2,post)
axis(1, at=1:2, labels=c('Pre','Post'))

### or one way to label the lines

par(mar=c(5,4,4,4)+0.1)

plot( 1:2, range(pre,post), type='n', xlab='', ylab='CRP (mg/dl)', xaxt='n')
segments(1,pre,2,post)
axis(1, at=1:2, labels=c('Pre','Post'))

tmp.y <- TeachingDemos::spread.labs(post, strheight('1'),
 min=min(post), max=max(post))

mtext( 1:5, side=4, at=tmp.y, line=2, las=1 )


hope this helps,

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

> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of C.H.
> Sent: Friday, September 26, 2008 9:54 PM
> To: r-help at r-project.org
> Subject: [R] Trend graph
>
> Dear R Gurus,
>
> I have a problem related to plot.
> For example, I have two variables, pre and post.
>
> pre <- c(1,2,3,4,5)
> post <- c(2,5,7,2,3)
>
> How can I plot a line graph similar to this one?
>
> http://www.pubmedcentral.nih.gov/articlerender.fcgi?artid=1847566&rende
> rtype=figure&id=F1
>
> Would you please provide me a keyword so that I can search. I don't
> know what is the name of this type of graph.
>
> Regards,
> H
>
> --
> CH Chan
> Research Assistant - KWH
> http://www.macgrass.com
>
> ______________________________________________
> R-help at 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.



------------------------------

Message: 43
Date: Mon, 29 Sep 2008 18:43:58 +0200
From: Peter Dalgaard <P.Dalgaard at biostat.ku.dk>
Subject: Re: [R] multiple page pdf file using pdf()
To: Kyle Matoba <kmmatoba at ucdavis.edu>
Cc: r-help at r-project.org
Message-ID: <48E105CE.8060409 at biostat.ku.dk>
Content-Type: text/plain; charset=UTF-8

Kyle Matoba wrote:
> List,
>
> I am currently producing a series of charts using multiple calls to pdf()
> but, rather than having 'n' single plot files, would like them all to go
> into one 'n'-page pdf file. Would someone be so kind as to explain how, if
> at all, I might go about doing this from within R? I have only ever
> previously used devices besides x11 by analogy with printing things to x11.
>
> I am running R-2.7.2 on Red Hat Linux.
>
>
>   
Did you as much as look at help(pdf)????

Specifically, there is a "onefile" argument. It is even TRUE by default!
So just don't close and reopen the device between plots.

-- 
   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.dalgaard at biostat.ku.dk)              FAX: (+45) 35327907



------------------------------

Message: 44
Date: Mon, 29 Sep 2008 12:06:56 -0500
From: "Kevin Wright" <kw.statr at gmail.com>
Subject: Re: [R] superimpose histogram on biplot
To: " St?phane Dray " <dray at biomserv.univ-lyon1.fr>
Cc: r-help at r-project.org, Jennie Lavine <jennie.lavine at gmail.com>
Message-ID:
	<c968588d0809291006m2dc6a471had9f123e6b010e46 at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

I know that this is a late follow-up, but I just found this posting
today while searching for something else.

Two of my colleagues and myself have explored the use of Mosaic plots
for displaying the amount of variation captured by each axis.  See the
following paper:

@Article{Laffont2007,
  author =       {Jean-Louis Laffont and Mohamed Hanafi and Kevin Wright},
  title =        {Numerical and Graphical Measures to Facilitate the
                  Interpretation of GGE Biplots},
  journal =      {Crop Science},
  year =         2007,
  volume =       47,
  pages =        {990-996},
  annote =       {File: Biplots}
}

Here is the example code at the end of the paper.

Y = data.frame(E1 = c(50, 55, 65, 50, 60, 65, 75),
E2 = c(67, 71, 76, 80, 82, 89, 95),
E3 = c(90, 93, 95, 102, 97, 106, 117),
E4 = c(98, 102, 105, 130, 135, 137, 133),
E5 = c(120, 129, 134, 138, 151, 153, 155))
rownames(Y) = c("G1", "G2", "G3", "G4", "G5",
"G6", "G7")
Y = scale(Y, center = TRUE, scale = FALSE)
YG = matrix(rowMeans(Y)) %*% rep(1,ncol(Y))
YGE = Y - YG
Ysvd = svd(Y) # Singular value decomposition
G = U = Ysvd$u
H = Ysvd$v %*% diag(Ysvd$d)
# Formula: SSGk = diag(U? YG YG? U)
SSGk = diag(crossprod(crossprod(YG,U)))
# Formula: SSGEk = diag(U? YGE YGE? U)
SSGEk = diag(crossprod(crossprod(YGE,U)))
# Proportion of SS for each axis
TSS = sum(Y^2)
AxisProp = round(100*(SSGk + SSGEk)/TSS,0)
# First, the environment-focused GGE biplot
biplot(G[,1:2], H[,1:2], xlabs = rownames(Y),ylabs =
colnames(Y),
xlab = paste("Axis 1: ",AxisProp[1],"%"),
ylab = paste("Axis 2: ",AxisProp[2],"%"))
# Then the mosaic plot
mosaicdata = data.frame(G = SSGk, GE = SSGEk)
mosaicplot(mosaicdata, main = "", off = c(5,1),
cex.axis = 1, col = c("dimgray", "snow2"))

Kevin Wright


On Tue, Apr 1, 2008 at 11:37 AM, St?phane Dray
<dray at biomserv.univ-lyon1.fr> wrote:
> Hi Jennie,
> if you have questions about ade4, you can use the adelist
> http://listes.univ-lyon1.fr/wws/info/adelist
>
> ade4 has the add.scatter.eig function which is exactly what you need. Try
>
> add.scatter.eig(nipmat$eig, xax=1, yax=2)
>
> Cheers,
>
>
>
> Jennie Lavine wrote:
>> Hi all,
>>
>> I've been trying to figure out how to superimpose a histogram on a
>> biplot that shows the relative contribution of each axis.  I have
>> been using the NIPALS function (http://biomserv.univ-lyon1.fr/~dray/
>> files/softwares/nipals.R) to run principal component analyses.  Here
>> is a toy example.
>>
>> source("http://biomserv.univ-lyon1.fr/~dray/files/softwares/nipals.R")
>> mat=matrix(runif(100,0,1), ncol=10, nrow=10)
>> nipmat=nipals(mat, nf=9)
>> scatter(nipmat)
>>
>> In the plot generated by the above "scatter" command, there is a
>> histogram in the upper left corner.  I want to know how to
>> superimpose that histogram on a similar plot, such as the following:
>>
>> groups = as.factor(c(rep(1,2), rep(2,4), rep(3,4)))
>> s.arrow(dfxy=nipmat$co[,1:2]*8, sub="Day 10", possub="bottomleft",
>> csub=3)
>> s.class(dfxy=nipmat$li[,1:2], fac=groups, cellipse=2, axesell=F,
>> cstar=0 , col=c(2:3), add.plot=T)
>>
>> I can create the histogram using:
>>
>> plot(nipmat$eig/sum(nipmat$eig), type='h')
>>
>> but I don't know how to superimpose it on the above graph.
>>
>> Thanks for any  help!
>>
>> Best,
>> Jennie
>>
>>
>> Jennie Lavine
>> PhD Candidate
>> Center for Infectious Disease Dynamics
>> Penn State University
>> 505 ASI Building
>> (814)863-1815
>>
>>
>>       [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-help at 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.
>>
>>
>>
>
> --
> St?phane DRAY (dray at biomserv.univ-lyon1.fr )
> Laboratoire BBE-CNRS-UMR-5558, Univ. C. Bernard - Lyon I
> 43, Bd du 11 Novembre 1918, 69622 Villeurbanne Cedex, France
> Tel: 33 4 72 43 27 57       Fax: 33 4 72 43 13 88
> http://biomserv.univ-lyon1.fr/~dray/
>
> ______________________________________________
> R-help at 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.
>



------------------------------

Message: 45
Date: Mon, 29 Sep 2008 12:12:04 -0500
From: "Kevin Wright" <kw.statr at gmail.com>
Subject: Re: [R] efficient code - yet another question
To: "steven wilson" <swpt07 at gmail.com>
Cc: r-help at r-project.org
Message-ID:
	<c968588d0809291012sd695d50o26142f7d3b4db90b at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

You should also have a look at the pcaMethods package (on
Bioconductor).  I did some code optimization for the NIPALS algorithm
in that package which sped up the algorithm by at least a factor of
two.

Kevin Wright



On Wed, Apr 30, 2008 at 10:56 PM, steven wilson <swpt07 at gmail.com> wrote:
> Dear list members;
>
> The code given below corresponds to the PCA-NIPALS (principal
> component analysis) algorithm adapted from the nipals function in the
> package chemometrics. The reason for using NIPALS instead of SVD is
> the ability of this algorithm to handle missing values, but that's a
> different story. I've been trying to find a way to improve (if
> possible) the efficiency of the code, especially when the number of
> components to calculate is higher than 100. I've been working with a
> data set of 500 rows x 700 variables. The code gets really slow when
> the number of PC to calculate is for example 600 (why that number of
> components?....because I need them to detect outliers using another
> algorithm). In my old laptop running Win XP and R 2.7.0 (1GB RAM) it
> takes around 6 or 7 minutes. That shouldn't be a problem for one
> analysis, but when cross-validation is added the time increases
> severely.....Although there are several examples on the R help list
> giving some with 'hints' to improve effciency the truth is that I
> don't know (or I can't see it) the part of the code that can be
> improved (but it is clear that the bottle neck is the for and while
> loops). I would really appreciate any ideas/comments/etc...
>
> Thanks
>
> #################################################################
>
> pca.nipals <- function(X, ncomp, iter = 50, toler = sqrt(.Machine$double.eps))
> # X...data matrix, ncomp...number of components,
> # iter...maximal number of iterations per component,
> # toler...precision tolerance for calculation of components
> {
>
>     Xh <- scale(X, center = TRUE, scale = FALSE)
>     nr <- 0
>     T <- NULL; P <- NULL # matrix of scores and loadings
>     for (h in 1:ncomp)
>              {
>                     th <- Xh[, 1]
>                     ende <- FALSE
>                     while (!ende)
>                       {
>                           nr <- nr + 1
>                           ph <- t(crossprod(th, Xh) * as.vector(1 /
> crossprod(th)))
>                           ph <- ph * as.vector(1/sqrt(crossprod(ph)))
>                           thnew <- t(tcrossprod(t(ph), Xh) *
> as.vector(1/(crossprod(ph))))
>                           prec <- crossprod(th-thnew)
>                           th <- thnew
>                           if (prec <= (tol^2)) ende <- TRUE
>                           if (it <= nr) ende <- TRUE # didn't converge
>                       }
>
>                     Xh <- Xh - tcrossprod(th)
>                     T <- cbind(T, th); P <- cbind(P, ph)
>                     nr <- 0
>               }
>     list(T = T, P = P)
> }
>
> ______________________________________________
> R-help at 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.
>



------------------------------

Message: 46
Date: Mon, 29 Sep 2008 14:13:28 -0300
From: "Henrique Dallazuanna" <wwwhsd at gmail.com>
Subject: Re: [R] turning comma separated string from multiple choices
	into	flags
To: "June Kim" <juneaftn at gmail.com>
Cc: r-help at r-project.org
Message-ID:
	<da79af330809291013mec14d7em389c48e7ffdb1cc6 at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

Try this:

table(rep(x$age, unlist(lapply(strsplit(x$favorite_magazine, ","), length))),
        unlist(strsplit(x$favorite_magazine, ",")))

On Mon, Sep 29, 2008 at 11:45 AM, June Kim <juneaftn at gmail.com> wrote:
> Hello,
>
> I use google docs' Forms to conduct surveys online. Multiple choices
> questions are coded as comma separated values.
>
> For example,
>
> if the question is like:
>
> 1. What magazines do you currently subscribe to? (you can choose
> multiple choices)
> 1) Fast Company
> 2) Havard Business Review
> 3) Business Week
> 4) The Economist
>
> And if the subject chose 1) and 3), the data is coded as a cell in a
> spreadsheet as,
>
> "Fast Company, Business Week"
>
> I read the data with read.csv into R. To analyze the data, I have to
> change that string into something like flags(indicator variables?).
> That is, there should be 4 variables, of which values are either 1 or
> 0, indicating chosen or not-chosen respectively.
>
> Suppose the data is something like,
>
>> survey1
>  age                                    favorite_magazine
> 1  29                                         Fast Company
> 2  31                          Fast Company, Business Week
> 3  32 Havard Business Review, Business Week, The Economist
>>
>
> Then I have to chop the string in favorite_magazine column to turn
> that data into something like,
>
>> survey1transformed
>  age Fast Company Havard Business Review Business Week The Economist
> 1  29            1                      0             0             0
> 2  31            1                      0             1             0
> 3  32            0                      1             1             1
>>
>
> Actually I have many more multiple choice questions in the survey.
>
> What is the easy elegant and natural way in R to do the job?
>
> ______________________________________________
> R-help at 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.
>



-- 
Henrique Dallazuanna
Curitiba-Paran?-Brasil
25? 25' 40" S 49? 16' 22" O



------------------------------

Message: 47
Date: Mon, 29 Sep 2008 10:22:05 -0700
From: "Kyle Matoba" <kmmatoba at ucdavis.edu>
Subject: Re: [R] multiple page pdf file using pdf()
To: "Peter Dalgaard" <P.Dalgaard at biostat.ku.dk>
Cc: r-help at r-project.org
Message-ID:
	<b72a69660809291022p41424f30q9c9a78f86e3cb4a1 at mail.gmail.com>
Content-Type: text/plain

Peter,

Ah, I was under the impression that I had to 'dev.off()' after every plot.
Naturally I had wondered about that strange argument that did not seem to do
anything...

Problem solved, thanks everyone.

Many thanks,

Kyle

On Mon, Sep 29, 2008 at 9:43 AM, Peter Dalgaard <P.Dalgaard at biostat.ku.dk>wrote:

>  Kyle Matoba wrote:
> > List,
> >
> > I am currently producing a series of charts using multiple calls to pdf()
> > but, rather than having 'n' single plot files, would like them all to go
> > into one 'n'-page pdf file. Would someone be so kind as to explain how,
> if
> > at all, I might go about doing this from within R? I have only ever
> > previously used devices besides x11 by analogy with printing things to
> x11.
> >
> > I am running R-2.7.2 on Red Hat Linux.
> >
> >
> >
> Did you as much as look at help(pdf)????
>
> Specifically, there is a "onefile" argument. It is even TRUE by default!
> So just don't close and reopen the device between plots.
>
> --
>   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.dalgaard at biostat.ku.dk)              FAX: (+45) 35327907
>
>
>

	[[alternative HTML version deleted]]



------------------------------

Message: 48
Date: Mon, 29 Sep 2008 11:24:28 -0600
From: Greg Snow <Greg.Snow at imail.org>
Subject: Re: [R] FW:  logistic regression
To: Frank E Harrell Jr <f.harrell at vanderbilt.edu>, Darin Brooks
	<kfmgis at telus.net>
Cc: "dieter.menne at menne-biomed.de" <dieter.menne at menne-biomed.de>,
	"r-help at stat.math.ethz.ch" <r-help at stat.math.ethz.ch>,
	"ted.harding at manchester.ac.uk" <ted.harding at manchester.ac.uk>
Message-ID:
	<B37C0A15B8FB3C468B5BC7EBC7DA14CC6132C7175C at LP-EXMBVS10.CO.IHC.COM>
Content-Type: text/plain; charset="us-ascii"

> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Frank E Harrell Jr
> Sent: Saturday, September 27, 2008 7:15 PM
> To: Darin Brooks
> Cc: dieter.menne at menne-biomed.de; r-help at stat.math.ethz.ch;
> ted.harding at manchester.ac.uk
> Subject: Re: [R] FW: logistic regression
>
> Darin Brooks wrote:
> > Glad you were amused.
> >
> > I assume that "booking this as a fortune" means that this was an
> idiotic way
> > to model the data?
>
> Dieter was nominating this for the "fortunes" package in R.  (Thanks
> Dieter)
>
> >
> > MARS?  Boosted Regression Trees?  Any of these a better choice to
> extract
> > significant predictors (from a list of about 44) for a measured
> dependent
> > variable?
>
> Or use a data reduction method (principal components, variable
> clustering, etc.) or redundancy analysis (to remove individual
> predictors before examining associations with Y), or fit the full model
> using penalized maximum likelihood estimation.  lasso and lasso-like
> methods are also worth pursuing.

Frank (and any others who want to share an opinion):

What are your thoughts on model averaging as part of the above list?


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



------------------------------

Message: 49
Date: Mon, 29 Sep 2008 14:26:26 -0300
From: "milton ruser" <milton.ruser at gmail.com>
Subject: [R] replicating dataframe rows
To: "R Help" <r-help at r-project.org>
Message-ID:
	<3aaf1a030809291026o6b9c3daej8b03562c3272a8ea at mail.gmail.com>
Content-Type: text/plain

Dear all,

I have a data.frame like the sample below, and I would
like to expand my data.frame using "population" variable.
So, for each line of my data.frame I would like that
the new data.frame have many rows as the population collumn.

place<-c("place1", "place2", "place3", "place4", "place5")
population<-c(100,200,300,50,30)
my.df<-data.frame(cbind(place,population))
my.df


best wishes,

miltinho astronauta
brazil

	[[alternative HTML version deleted]]



------------------------------

Message: 50
Date: Mon, 29 Sep 2008 11:28:55 -0600
From: Greg Snow <Greg.Snow at imail.org>
Subject: Re: [R] histogram-like plot with two variables
To: Philipp Pagel <p.pagel at wzw.tum.de>, "r-help at r-project.org"
	<r-help at r-project.org>
Message-ID:
	<B37C0A15B8FB3C468B5BC7EBC7DA14CC6132C71764 at LP-EXMBVS10.CO.IHC.COM>
Content-Type: text/plain; charset="iso-8859-1"

An added note, if you use this approach, then you should probably set the lend parameter as well (becomes more important with wider lines).  See ?par and scroll down to lend for options/details.

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


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Philipp Pagel
> Sent: Monday, September 29, 2008 5:40 AM
> To: r-help at r-project.org
> Subject: Re: [R] histogram-like plot with two variables
>
> On Mon, Sep 29, 2008 at 04:02:05AM +0200, J?rg Gro? wrote:
> > Hi,
> >
> > I want to plot a binomial propability distribution.
> >
> > I know how to generate the data;
> >
> >    x <- seq(from=0, to=14, by=1)
> >    y <- dbinom(x, 14, 0.7, log = FALSE)
> >
> > I tried:
> > plot(x,y, type="h")
> >   but the bars are very thin -is there a way to define the width?
>
> yes - the lwd parameter controls line width. E.g.:
>
> plot(x,y, type='h', lwd=5)
>
> This is the way I usually plot count data - I prefer this over
> something
> that looks like a normal histogram, because it reminds me that I am
> looking at discrete values.
>
> cu
>         Philipp
>
> --
> Dr. Philipp Pagel
> Lehrstuhl f?r Genomorientierte Bioinformatik
> Technische Universit?t M?nchen
> Wissenschaftszentrum Weihenstephan
> 85350 Freising, Germany
> http://mips.gsf.de/staff/pagel
>
> ______________________________________________
> R-help at 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.



------------------------------

Message: 51
Date: Mon, 29 Sep 2008 11:31:46 -0600
From: Greg Snow <Greg.Snow at imail.org>
Subject: Re: [R] adding labels to tapply results
To: eric lee <ericlee100 at gmail.com>, "r-help at r-project.org"
	<r-help at r-project.org>
Message-ID:
	<B37C0A15B8FB3C468B5BC7EBC7DA14CC6132C7176A at LP-EXMBVS10.CO.IHC.COM>
Content-Type: text/plain; charset="us-ascii"

Try using aggregate instead of tapply.  If that does not answer your question, then try restating it or showing what your desired output would look like (see the posting guide referenced at the bottom of every post).

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


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of eric lee
> Sent: Monday, September 29, 2008 6:46 AM
> To: r-help at r-project.org
> Subject: [R] adding labels to tapply results
>
> Hi,
>
> How do I get labels onto the output from tapply?  I need the labels to
> merge
> the output with another data frame.  Thanks.
>
> eric
>
> d <- data.frame(cbind(x=1:3, y=1:10))
> a <- with(d, tapply(y, x, sum))
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.



------------------------------

Message: 52
Date: Mon, 29 Sep 2008 08:20:32 -0700 (PDT)
From: Jue! <val_harvey at hotmail.com>
Subject: [R]  confident interval on Coxme analysis
To: r-help at r-project.org
Message-ID: <19725947.post at talk.nabble.com>
Content-Type: text/plain; charset=us-ascii


Hi everyone

I perform analyses using coxme function of Kinship packages. Currently, I
obtain the following output

Cox mixed-effects model fit by maximum likelihood
  Data: seal 
  n= 26565 
  Iterations= 6 73 
                            NULL      Integrated Penalized
Log-likelihood -244068.0  -239495.7 -239271.9

  Penalized loglik: chisq= 9592.06 on 80.35 degrees of freedom, p= 0 
 Integrated loglik: chisq= 9144.56 on 2 degrees of freedom, p= 0 

Fixed effects: Surv(fpt) ~ statut 
            coef           exp(coef)  se(coef)      z p
statut -1.232174 0.2916579 0.1024215 -12.03 0

Random effects: ~1 | ident 
             ident
Variance: 1.473655



Is anyone can indicate me how can I obtain the confidence intervalle limit
of the parameters (e.g. statut) estimated in my model?

Thanks for your help
-- 
View this message in context: http://www.nabble.com/confident-interval-on-Coxme-analysis-tp19725947p19725947.html
Sent from the R help mailing list archive at Nabble.com.



------------------------------

Message: 53
Date: Mon, 29 Sep 2008 14:45:11 -0300
From: "Henrique Dallazuanna" <wwwhsd at gmail.com>
Subject: Re: [R] replicating dataframe rows
To: "milton ruser" <milton.ruser at gmail.com>
Cc: R Help <r-help at r-project.org>
Message-ID:
	<da79af330809291045m6cc9209ei62b2dfbb5008b23 at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

Try this:

my.df <- data.frame(Place = rep(place, population), Population =
rep(population, population))

On Mon, Sep 29, 2008 at 2:26 PM, milton ruser <milton.ruser at gmail.com> wrote:
> Dear all,
>
> I have a data.frame like the sample below, and I would
> like to expand my data.frame using "population" variable.
> So, for each line of my data.frame I would like that
> the new data.frame have many rows as the population collumn.
>
> place<-c("place1", "place2", "place3", "place4", "place5")
> population<-c(100,200,300,50,30)
> my.df<-data.frame(cbind(place,population))
> my.df
>
>
> best wishes,
>
> miltinho astronauta
> brazil
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.
>



-- 
Henrique Dallazuanna
Curitiba-Paran?-Brasil
25? 25' 40" S 49? 16' 22" O



------------------------------

Message: 54
Date: Mon, 29 Sep 2008 19:59:00 +0200
From: Dimitris Rizopoulos <d.rizopoulos at erasmusmc.nl>
Subject: Re: [R] replicating dataframe rows
To: milton ruser <milton.ruser at gmail.com>
Cc: R Help <r-help at r-project.org>
Message-ID: <48E11764.5080600 at erasmusmc.nl>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

try this:

place <- c("place1", "place2", "place3", "place4", "place5")
population <- c(100, 200, 300, 50, 30)
my.df <- data.frame(place, population)

my.df[rep(row.names(my.df), my.df$population), ]


I hope it helps.

Best,
Dimitris


milton ruser wrote:
> Dear all,
> 
> I have a data.frame like the sample below, and I would
> like to expand my data.frame using "population" variable.
> So, for each line of my data.frame I would like that
> the new data.frame have many rows as the population collumn.
> 
> place<-c("place1", "place2", "place3", "place4", "place5")
> population<-c(100,200,300,50,30)
> my.df<-data.frame(cbind(place,population))
> my.df
> 
> 
> best wishes,
> 
> miltinho astronauta
> brazil
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at 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.
> 

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

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



------------------------------

Message: 55
Date: Mon, 29 Sep 2008 13:05:39 -0500
From: "Erin Hodgess" <erinm.hodgess at gmail.com>
Subject: [R]  snowfall and lam4-dev
To: r-help at stat.math.ethz.ch
Message-ID:
	<7acc7a990809291105l53203570uc81c3bc40219a14a at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

Dear R People:

I was looking at the vignette for the snowfall package and it
references lam4-dev.

There is a command for Debian Linux, but not other flavors of Linus.

Does anyone know the right command for SUSE10.1, please/

thanks,
Erin


-- 
Erin Hodgess
Associate Professor
Department of Computer and Mathematical Sciences
University of Houston - Downtown
mailto: erinm.hodgess at gmail.com



------------------------------

Message: 56
Date: Mon, 29 Sep 2008 11:14:40 -0700
From: rmailbox at justemail.net
Subject: Re: [R] ggplot 2 - editing in the "panel_1_1" viewport
To: r-help at r-project.org
Cc: Pedro Barros <pedro.barros at fao.org>
Message-ID: <1222712080.28325.1276581403 at webmail.messagingengine.com>
Content-Type: text/plain; charset="ISO-8859-1"


Not an answer, but, I hope, more of an almost-the-same question...

I want to divide up the text grobs for the key labels into two 
different (text) grobs (each) and put them back into the space occupied 
by the original text grob. I've worked with grobs enough to think this 
should be easy, but I just cannot figure out how to identify the 
specific text grobs to replace on an arbitrary graph from the output of
grid.ls(viewports = TRUE).

Thanks,
Eric


----- Original message -----
From: "Pedro Barros" <pedro.barros at fao.org>
To: r-help at r-project.org
Date: Mon, 29 Sep 2008 08:46:07 -0700 (PDT)
Subject: [R]  ggplot 2 - editing in the "panel_1_1" viewport


Hi All,

I am trying to find out how to access the components of a ggplot plot, and I
found this reply from Paul Murrel
http://www.nabble.com/navigating-ggplot-viewports-tt14826352.html#a15056223.
I tried it, and it works.
However, I am trying to develop some functions that will do the drawing
"automatically", and usually I will not know the full name of the grob that
has the layout vp, like "plot.gtree.76". Is there a way that I can repeat
the same process, without going through the grid.ls step?

Thanks,
Pedro
-- 
View this message in context: http://www.nabble.com/ggplot-2---editing-in-the-%22panel_1_1%22-viewport-tp19726397p19726397.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help at 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.



------------------------------

Message: 57
Date: Mon, 29 Sep 2008 13:16:28 -0500
From: Jesse Young <jessewyoung at gmail.com>
Subject: [R] Testing this significance of a factor in a mixed-model
	"ANCOVA"
To: r-help at r-project.org
Message-ID: <1D0D018F-C573-45D4-BC9C-C3F12584FA01 at gmail.com>
Content-Type: text/plain

R-users -

I must preface this question by saying that I'm a relative newbie to  
both R and mixed-modeling.

I'm using lme fit an ANCOVA-like model.  My data consist of bone  
length measurements for a developmental series of two capuchin monkey  
species.  I'm interested in whether the rate of bone length scaling  
to body mass (i.e., growth) differs between species.

My call to lme looks like this:

model=lme(lghumlen ~ species + lgbmkg, random= ~ lgbmkg | id,  
correlation=corCAR1(), weights=varExp())

where lghumlen is the log of humerus length and lgbmkg is the log of  
body mass.

If I ask for a summary of my model, I get this from the table of  
fixed effects:

Fixed effects: lghumlen ~ species + lgbmkg
                         Value  Std.Error  DF   t-value p-value
(Intercept)          3.567226 0.02059541 540 173.20495   0.000
speciesCebus apella -0.096348 0.04523323  16  -2.13004   0.049
lgbmkg               0.532745 0.01804411 540  29.52459   0.000

So the difference between species looks to be barely significant.  I  
get the same result using the fit.contrast function from the gtools  
package:

fit.contrast(model,"species",coeff=c(1,-1))

                      Estimate Std. Error  t-value   Pr(>|t|)
species c=( 1 -1 ) 0.09634857 0.04523308 2.130046 0.04903713

However, if I use the anova function to summary the model, I get a  
totally different result:

anova(model)

             numDF denDF  F-value p-value
(Intercept)     1   540 49336.06  <.0001
species         1    16     0.45  0.5115
lgbmkg          1   540   871.70  <.0001

So the difference between species is not significant at all.

What gives?

Thanks,

Jesse

______________________________________________
Jesse W. Young, Ph.D.
Postdoctoral Research Fellow
Department of Anthropology
University of Texas at Austin
1 University Station C3200
Austin, TX  78712
Phone: (512) 232-6380

Email: jesse.young at mail.utexas.edu
Web page: https://webspace.utexas.edu/youngjw3/www/



______________________________________________
Jesse W. Young, Ph.D.
Postdoctoral Research Fellow
Department of Anthropology
University of Texas at Austin
1 University Station C3200
Austin, TX  78712
Phone: (512) 232-6380

Email: jesse.young at mail.utexas.edu
Web page: https://webspace.utexas.edu/youngjw3/www/







	[[alternative HTML version deleted]]



------------------------------

Message: 58
Date: Mon, 29 Sep 2008 20:08:23 +0200
From: Jacques Ropers <jropers at freesurf.Fr>
Subject: [R] Sweave and UTF8/Win XP
To: r-help at r-project.org
Message-ID: <48E11997.5060408 at freesurf.Fr>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Hi,
I would like to feed Sweave with an UTF8 encoded file, and obtain an 
UTF8 TeX file (so that I can use XeTeX and its font handling facilities). 
I'm under Win XP. I guess this is a matter of locale config but I can't 
find the proper way.
Thanks

Jacques



------------------------------

Message: 59
Date: Mon, 29 Sep 2008 13:14:14 -0500
From: Jesse Young <jesse.young at mail.utexas.edu>
Subject: [R] Testing this significance of a factor in a mixed-model
	"ANCOVA"
To: r-help at r-project.org
Message-ID: <50FEA724-6206-453C-9EA9-AC0BF4496BFC at mail.utexas.edu>
Content-Type: text/plain

R-users -

I must preface this question by saying that I'm a relative newbie to  
both R and mixed-modeling.

I'm using lme fit an ANCOVA-like model.  My data consist of bone  
length measurements for a developmental series of two capuchin monkey  
species.  I'm interested in whether the rate of bone length scaling  
to body mass (i.e., growth) differs between species.

My call to lme looks like this:

model=lme(lghumlen ~ species + lgbmkg, random= ~ lgbmkg | id,  
correlation=corCAR1(), weights=varExp())

where lghumlen is the log of humerus length and lgbmkg is the log of  
body mass.

If I ask for a summary of my model, I get this from the table of  
fixed effects:

Fixed effects: lghumlen ~ species + lgbmkg
                         Value  Std.Error  DF   t-value p-value
(Intercept)          3.567226 0.02059541 540 173.20495   0.000
speciesCebus apella -0.096348 0.04523323  16  -2.13004   0.049
lgbmkg               0.532745 0.01804411 540  29.52459   0.000

So the difference between species looks to be barely significant.  I  
get the same result using the fit.contrast function from the gtools  
package:

fit.contrast(model,"species",coeff=c(1,-1))

                      Estimate Std. Error  t-value   Pr(>|t|)
species c=( 1 -1 ) 0.09634857 0.04523308 2.130046 0.04903713

However, if I use the anova function to summary the model, I get a  
totally different result:

anova(model)

             numDF denDF  F-value p-value
(Intercept)     1   540 49336.06  <.0001
species         1    16     0.45  0.5115
lgbmkg          1   540   871.70  <.0001

So the difference between species is not significant at all.

What gives?

Thanks,

Jesse

______________________________________________
Jesse W. Young, Ph.D.
Postdoctoral Research Fellow
Department of Anthropology
University of Texas at Austin
1 University Station C3200
Austin, TX  78712
Phone: (512) 232-6380

Email: jesse.young at mail.utexas.edu
Web page: https://webspace.utexas.edu/youngjw3/www/






	[[alternative HTML version deleted]]



------------------------------

Message: 60
Date: Tue, 30 Sep 2008 08:18:02 +1300
From: Patrick Connolly <p_connolly at slingshot.co.nz>
Subject: Re: [R] How to remove columns of table in R recursively
To: Jason Lee <huajie.lee at gmail.com>
Cc: r-help at r-project.org
Message-ID: <20080929191802.GA5059 at slingshot.co.nz>
Content-Type: text/plain; charset=us-ascii

On Tue, 30-Sep-2008 at 12:37AM +1000, Jason Lee wrote:

|> Hi R-list,
|> 
|> I would like to know how to perform any elimination of attribute (column) in
|> R.
|> 
|> E.g I  have:-
|> 
|> 20,21,22,23,24,25,normal
|> 1,2,3,4,5,5,normal
|> 0,1,0,2,3,4,abnormal
|> ...
|> 
|> I intend to do a checking on each column:-
|> 
|> If the column sum of abnormal is 0 but the column sum of normal is nonzero,
|> i wanted to eliminate this attribute. And so on and so forth observing other
|> attributes across the list. In the end, I wanted to form information as a
|> table.
|> 
|> Desired Output:-
|> 21,23,24,25,normal
|> 2,4,5,5,normal
|> 1,2,3,4,abnormal
|> 
|> It is some sort of removing noise from the data.

Is this the sort of thing you want to do?

> aa <- data.frame(A = 1:5, B = 12:8, C = c(0, 4, 3, 0, 1))
> aa
  A  B C
1 1 12 0
2 2 11 4
3 3 10 3
4 4  9 0
5 5  8 1
> aa[!aa$C == 0,]
  A  B C
2 2 11 4
3 3 10 3
5 5  8 1



-- 
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.   
   ___    Patrick Connolly   
 {~._.~}          		 Great minds discuss ideas    
 _( Y )_  	  	        Middle minds discuss events 
(:_~*~_:) 	       		 Small minds discuss people  
 (_)-(_)  	                           ..... Anon
	  
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.



------------------------------

Message: 61
Date: Mon, 29 Sep 2008 15:51:30 -0400
From: "Sharma, Dhruv" <Dhruv.Sharma at PenFed.org>
Subject: [R] persistence of model in R to a file
To: <r-help at r-project.org>
Message-ID:
	<BF3D95EDD37088488ADB82FBBC5689CD0277086E at CHN-EXMBXPR01.pfcuhq.penfed.ads>
	
Content-Type: text/plain

 Hi,
    Is there a way to save R models (glm, lm , rpart etc) in a file that
be read in later?
 
    I noticed models take up space. by space them off and removing them
from memory it seems that would be useful.
 
    Also why do the models keep a copy of all columns in the original
data set even those columns are not in the model.
    E.g. if I build a model on columns A, B even thought column C exists
in the dataframe when I run the model against test data with only
columns A and B then I get an error saying column C is missing from the
data.
 
    Anyway it seems like the models would be more compact without having
to include within them data from the original data set used to build
them but that is an aside.
 
    If models can be persisted and loaded selectively later that would
neat.
 
 
thanks
Dhruv

	[[alternative HTML version deleted]]



------------------------------

Message: 62
Date: Mon, 29 Sep 2008 15:52:38 -0400 (EDT)
From: kvest at al.umces.edu
Subject: [R] Integrating functions in R
To: r-help at r-project.org
Message-ID:
	<2455.131.118.231.56.1222717958.squirrel at webmail.al.umces.edu>
Content-Type: text/plain;charset=iso-8859-1

I want to integrate the function (sin^7*x)*(cos^8*x)dx.  I do not have
values to integrate between.  I just want R to give me the integral of the
function.  For example R takes the derivative of the function by 
d1=D(expression(x^2*(cosh*(x^3))), "x").  Is there a similar function
available in R to find the integral?

Thanks,
Kim



------------------------------

Message: 63
Date: Mon, 29 Sep 2008 12:54:59 -0700 (PDT)
From: Josh B <joshb41 at yahoo.com>
Subject: [R] Simple question about extracting a subset of data
To: R Help <r-help at r-project.org>
Message-ID: <192025.49678.qm at web110113.mail.gq1.yahoo.com>
Content-Type: text/plain

Hello all,

I have a (hopefully) simple question.

If I have a data table (named "x") such as this:

daylengthleavesflowering.datefruits
LD1.90055581.64353250.76668986
LD-0.9399410-1.2592968-0.60141837
LD1.0222946-0.9697459 -0.60141837
SD-0.2668132-0.9697459-0.47363322
SD -1.5892393-0.70540660.66469785
SD -0.5222961-0.7054066-0.10701187

How do create a new data table that contains, e.g., only the long-day plants?

I have tried to do this using the "subset" command, but it seems to ignore me:

x.sd <- subset(x, daylength = "long.day", select = root.weight:stem.diameter)

This returns exactly the same data table I had before (including both long and short day plants).

So how do I do this properly? Actual code would be of the most direct help to me, since I am new at this. Thank you very much!


      
	[[alternative HTML version deleted]]



------------------------------

Message: 64
Date: Mon, 29 Sep 2008 12:59:19 -0700
From: rmailbox at justemail.net
Subject: Re: [R] Simple question about extracting a subset of data
To: "Josh B" <joshb41 at yahoo.com>, "R Help" <r-help at r-project.org>
Message-ID: <1222718359.22134.1276602431 at webmail.messagingengine.com>
Content-Type: text/plain; charset="ISO-8859-1"


It's hard to read your table, but I think this could be your problem:
daylength = "long.day"  is always TRUE
Testing for equality uses "==" so
daylength == "long.day" may or may not always be TRUE
 

----- Original message -----
From: "Josh B" <joshb41 at yahoo.com>
To: "R Help" <r-help at r-project.org>
Date: Mon, 29 Sep 2008 12:54:59 -0700 (PDT)
Subject: [R] Simple question about extracting a subset of data

Hello all,

I have a (hopefully) simple question.

If I have a data table (named "x") such as this:

daylengthleavesflowering.datefruits
LD1.90055581.64353250.76668986
LD-0.9399410-1.2592968-0.60141837
LD1.0222946-0.9697459 -0.60141837
SD-0.2668132-0.9697459-0.47363322
SD -1.5892393-0.70540660.66469785
SD -0.5222961-0.7054066-0.10701187

How do create a new data table that contains, e.g., only the long-day plants?

I have tried to do this using the "subset" command, but it seems to ignore me:

x.sd <- subset(x, daylength = "long.day", select = root.weight:stem.diameter)

This returns exactly the same data table I had before (including both long and short day plants).

So how do I do this properly? Actual code would be of the most direct help to me, since I am new at this. Thank you very much!


      
	[[alternative HTML version deleted]]

______________________________________________
R-help at 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.



------------------------------

Message: 65
Date: Mon, 29 Sep 2008 16:00:15 -0400
From: "Jorge Ivan Velez" <jorgeivanvelez at gmail.com>
Subject: Re: [R] Integrating functions in R
To: kvest at al.umces.edu
Cc: r-help at r-project.org
Message-ID:
	<317737de0809291300h3fa44df9s72096d843876dd56 at mail.gmail.com>
Content-Type: text/plain

Dear Kim,
Yes. Take a look at the Ryacas vignette {
http://cran.r-project.org/web/packages/Ryacas/vignettes/Ryacas.pdf}, section
5.7.

HTH,


Jorge



On Mon, Sep 29, 2008 at 3:52 PM, <kvest at al.umces.edu> wrote:

> I want to integrate the function (sin^7*x)*(cos^8*x)dx.  I do not have
> values to integrate between.  I just want R to give me the integral of the
> function.  For example R takes the derivative of the function by
> d1=D(expression(x^2*(cosh*(x^3))), "x").  Is there a similar function
> available in R to find the integral?
>
> Thanks,
> Kim
>
> ______________________________________________
> R-help at 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]]



------------------------------

Message: 66
Date: Mon, 29 Sep 2008 14:01:42 -0600
From: Greg Snow <Greg.Snow at imail.org>
Subject: Re: [R] persistence of model in R to a file
To: "Sharma, Dhruv" <Dhruv.Sharma at PenFed.org>, "r-help at r-project.org"
	<r-help at r-project.org>
Message-ID:
	<B37C0A15B8FB3C468B5BC7EBC7DA14CC6132C71842 at LP-EXMBVS10.CO.IHC.COM>
Content-Type: text/plain; charset="us-ascii"

See ?save for one way to save models for later re-reading.

I don't fully understand your next question, many of the modeling functions have options for saving the data (see ?lm), but can you give an example for your A, B, and C example? Then we will have a better chance of telling you what is happening and what options can change what is happening.

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


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Sharma, Dhruv
> Sent: Monday, September 29, 2008 1:52 PM
> To: r-help at r-project.org
> Subject: [R] persistence of model in R to a file
>
>  Hi,
>     Is there a way to save R models (glm, lm , rpart etc) in a file
> that
> be read in later?
>
>     I noticed models take up space. by space them off and removing them
> from memory it seems that would be useful.
>
>     Also why do the models keep a copy of all columns in the original
> data set even those columns are not in the model.
>     E.g. if I build a model on columns A, B even thought column C
> exists
> in the dataframe when I run the model against test data with only
> columns A and B then I get an error saying column C is missing from the
> data.
>
>     Anyway it seems like the models would be more compact without
> having
> to include within them data from the original data set used to build
> them but that is an aside.
>
>     If models can be persisted and loaded selectively later that would
> neat.
>
>
> thanks
> Dhruv
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.



------------------------------

Message: 67
Date: Mon, 29 Sep 2008 22:05:31 +0200
From: J?rg Gro? <joerg at licht-malerei.de>
Subject: [R] histogram-like plot - multiple bars side by side
To: r-help at r-project.org
Message-ID: <5AC387C2-A9AD-4C68-9399-4EBBE4D14AF4 at licht-malerei.de>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes

Hi,

I found this example for producing multiple histograms;

  require(plotrix)
  l <- list(rnorm(50),rnorm(50,sd=2),rnorm(50,mean=3))
  multhist(l)


Now I want something like that, for creating multiple density  
distributions (in one plot).

But I have two variables for one density distribution and "multhist"  
only allows me to add one variable;
   x <- seq(from=0, to=14, by=1)
   y <- dbinom(x, 14, 0.7, log = FALSE)


Is there a way to make a histogram-like plot with multiple bars side  
by side (for different distributions) like in the example?



------------------------------

Message: 68
Date: Mon, 29 Sep 2008 22:10:46 +0200
From: CLERC Thomas <thomas.clerc at unifr.ch>
Subject: [R] x axis label overlap
To: r-help at r-project.org
Message-ID: <69CC5A7A-C36D-4ED4-A846-16503ECA238F at unifr.ch>
Content-Type: text/plain


Hello,

On the figure produced by this code:

##############
# données Bacher 2001
y
.bacher
=
c
(69,18,13,12,5,4,3,3,13,9,7,6,4,2,69,19,12,40,5,2,2,2,51,18,8,31,9,3,2,2
)
x.bacher=c(seq(1:6),8,9,seq(9,13), 
15,15,16,17,17,18,19,20,22,22,23,25,25,26,27,28,30)

# graphe
#quartz(width=2.12,height=2.12)
quartz(width=10,height=10)
par(mar=c(5.1+2,4.1+2,4.1,2.1))
plot(x.bacher,y.bacher,type="b",xlab="time",ylab="number of  
prey",cex.lab=2,pch=19,axes=FALSE)
axis(1, at = c(1,9,15,17,22,25), side=1, labels = c("9 July","17  
July","23 July","25 July","30 July","1 August"),adj=1,cex.axis=1.8)
axis(2,cex.axis=1.8)
box()
#############

I want the x axis labels not to overlap, but without changing the size  
cex.axis=1.8 and without rotating them. Any idea?
	[[alternative HTML version deleted]]



------------------------------

Message: 69
Date: Mon, 29 Sep 2008 14:13:05 -0600
From: Greg Snow <Greg.Snow at imail.org>
Subject: Re: [R] histogram-like plot - multiple bars side by side
To: J?rg Gro? <joerg at licht-malerei.de>,	"r-help at r-project.org"
	<r-help at r-project.org>
Message-ID:
	<B37C0A15B8FB3C468B5BC7EBC7DA14CC6132C71854 at LP-EXMBVS10.CO.IHC.COM>
Content-Type: text/plain; charset="iso-8859-1"

Do you mean something like this:

x <- 0:14
y1 <- dbinom(x,14,0.7)
y2 <- dbinom(x,14,0.5)
y3 <- dbinom(x,14,0.3)

barplot( rbind(y1,y2,y3), names=x, beside=TRUE)

Hope this helps,

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


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of J?rg Gro?
> Sent: Monday, September 29, 2008 2:06 PM
> To: r-help at r-project.org
> Subject: [R] histogram-like plot - multiple bars side by side
>
> Hi,
>
> I found this example for producing multiple histograms;
>
>   require(plotrix)
>   l <- list(rnorm(50),rnorm(50,sd=2),rnorm(50,mean=3))
>   multhist(l)
>
>
> Now I want something like that, for creating multiple density
> distributions (in one plot).
>
> But I have two variables for one density distribution and "multhist"
> only allows me to add one variable;
>    x <- seq(from=0, to=14, by=1)
>    y <- dbinom(x, 14, 0.7, log = FALSE)
>
>
> Is there a way to make a histogram-like plot with multiple bars side
> by side (for different distributions) like in the example?
>
> ______________________________________________
> R-help at 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.



------------------------------

Message: 70
Date: Mon, 29 Sep 2008 16:20:17 -0400
From: "Sharma, Dhruv" <Dhruv.Sharma at PenFed.org>
Subject: Re: [R] persistence of model in R to a file
To: "Greg Snow" <Greg.Snow at imail.org>, <r-help at r-project.org>
Message-ID:
	<BF3D95EDD37088488ADB82FBBC5689CD0277087A at CHN-EXMBXPR01.pfcuhq.penfed.ads>
	
Content-Type: text/plain;	charset="us-ascii"

Thanks.

I will replicate the error and post an example.

Dhruv


-----Original Message-----
From: Greg Snow [mailto:Greg.Snow at imail.org] 
Sent: Monday, September 29, 2008 4:02 PM
To: Sharma, Dhruv; r-help at r-project.org
Subject: RE: persistence of model in R to a file


See ?save for one way to save models for later re-reading.

I don't fully understand your next question, many of the modeling
functions have options for saving the data (see ?lm), but can you give
an example for your A, B, and C example? Then we will have a better
chance of telling you what is happening and what options can change what
is happening.

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


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r- 
> project.org] On Behalf Of Sharma, Dhruv
> Sent: Monday, September 29, 2008 1:52 PM
> To: r-help at r-project.org
> Subject: [R] persistence of model in R to a file
>
>  Hi,
>     Is there a way to save R models (glm, lm , rpart etc) in a file 
> that be read in later?
>
>     I noticed models take up space. by space them off and removing 
> them from memory it seems that would be useful.
>
>     Also why do the models keep a copy of all columns in the original 
> data set even those columns are not in the model.
>     E.g. if I build a model on columns A, B even thought column C 
> exists in the dataframe when I run the model against test data with 
> only columns A and B then I get an error saying column C is missing 
> from the data.
>
>     Anyway it seems like the models would be more compact without 
> having to include within them data from the original data set used to 
> build them but that is an aside.
>
>     If models can be persisted and loaded selectively later that would

> neat.
>
>
> thanks
> Dhruv
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.



------------------------------

Message: 71
Date: Mon, 29 Sep 2008 13:09:14 -0700 (PDT)
From: liujb <liujulia7 at yahoo.com>
Subject: [R]  quantile
To: r-help at r-project.org
Message-ID: <19730778.post at talk.nabble.com>
Content-Type: text/plain; charset=us-ascii


Hello,

I need to assign a number to each x[i], i=1:100, based on the value of x[i]
and where they are in the distribution of x[i]. For example 1 for x[4] means
x[4] is below 25%. I can obtain the quantile using quantile command, and
just loop through the 1:100 and assign the correct number. But I was just
wondering whether there are a more efficient way.

Thank you,
sincerely,
Julia
-- 
View this message in context: http://www.nabble.com/quantile-tp19730778p19730778.html
Sent from the R help mailing list archive at Nabble.com.



------------------------------

Message: 72
Date: Mon, 29 Sep 2008 16:56:18 -0400
From: "David Huffer" <David.Huffer at csosa.gov>
Subject: Re: [R] replicating dataframe rows
To: "Dimitris Rizopoulos" <d.rizopoulos at erasmusmc.nl>,	"milton ruser"
	<milton.ruser at gmail.com>
Cc: R Help <r-help at r-project.org>
Message-ID:
	<B4A52056BFE1CA40986BB3BADFA4814101F4D256 at DC0633VMA1.csosa.gov>
Content-Type: text/plain;	charset="us-ascii"

On Monday, September 29, 2008 1:59, Dimitris Rizopoulos wrote:
 > On Monday, September 29, 2008 1:26, milton ruser wrote:
 > > ...I  have  a  data.frame  like...
 > >    place<-c("place1", "place2", "place3", "place4", "place5")
 > >    population<-c(100,200,300,50,30)
 > >    my.df<-data.frame(cbind(place,population))
 > > ...and I would like to expand my  data.frame
 > > using  "population"  variable.  So, for each
 > > line of my data.frame I would like that  the
 > > new  data.frame  have  many  rows   as   the
 > > population collumn...
 > ...try this...
 >    place <- c("place1", "place2", "place3", "place4", "place5")
 >    population <- c(100, 200, 300, 50, 30)
 >    my.df <- data.frame(place, population)

Or...

place <- c("place1", "place2", "place3", "place4", "place5")
population <- c(100, 200, 300, 50, 30)
my.df <- data.frame(place, population)

my.df [
  rep ( row.names ( my.df )
  , as.numeric ( as.character ( my.df$population ) )  
  ) ,
]
 
--
 David



------------------------------

Message: 73
Date: Mon, 29 Sep 2008 17:17:02 -0400
From: "jim holtman" <jholtman at gmail.com>
Subject: Re: [R] quantile
To: liujb <liujulia7 at yahoo.com>
Cc: r-help at r-project.org
Message-ID:
	<644e1f320809291417y467325cm7a51e7434f2b73a9 at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

?quantile
?cut

> x <- runif(10)
> y <- quantile(x, prob=seq(0,1,.25))
> y
        0%        25%        50%        75%       100%
0.06178627 0.29216247 0.60098370 0.83899171 0.94467527
> cut(x, breaks=y, include.lowest=TRUE)
 [1] [0.0618,0.292] (0.292,0.601]  (0.292,0.601]  (0.839,0.945]
[0.0618,0.292] (0.839,0.945]
 [7] (0.839,0.945]  (0.601,0.839]  (0.601,0.839]  [0.0618,0.292]
Levels: [0.0618,0.292] (0.292,0.601] (0.601,0.839] (0.839,0.945]
> cut(x, breaks=y, include.lowest=TRUE, labels=FALSE)
 [1] 1 2 2 4 1 4 4 3 3 1
> x
 [1] 0.26550866 0.37212390 0.57285336 0.90820779 0.20168193 0.89838968
0.94467527 0.66079779 0.62911404
[10] 0.06178627
>


On Mon, Sep 29, 2008 at 4:09 PM, liujb <liujulia7 at yahoo.com> wrote:
>
> Hello,
>
> I need to assign a number to each x[i], i=1:100, based on the value of x[i]
> and where they are in the distribution of x[i]. For example 1 for x[4] means
> x[4] is below 25%. I can obtain the quantile using quantile command, and
> just loop through the 1:100 and assign the correct number. But I was just
> wondering whether there are a more efficient way.
>
> Thank you,
> sincerely,
> Julia
> --
> View this message in context: http://www.nabble.com/quantile-tp19730778p19730778.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at 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?



------------------------------

Message: 74
Date: Mon, 29 Sep 2008 14:27:27 -0700
From: Avram Aelony <aavram at mac.com>
Subject: [R] box-whisker plot from pre-summarized data?
To: r-help at r-project.org
Message-ID: <2D9FFEC5-F863-473E-A413-71DD6BAAB10B at mac.com>
Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed

Hello,

Although my summary descriptives are generated outside of R (dataset  
is huge), I would like to produce a box-whisker plot using bxp or  
perhaps a function from the ggplot2 library using the precomputed  
summaries.

My dataset currently contains 10 rows (one row per week) with the  
following columns: weekno (the week over which values have been  
summarized), minimum, 25th and 75th percentile, median, mean, and max  
values.  Any suggestions on how I can plot this in R to produce a box- 
whisker plot (one box per week of data) ?  I have seen http:// 
finzi.psych.upenn.edu/R/library/graphics/html/bxp.html but am not  
sure how to shape my summarized data correctly to produce the plot.

Many thanks in advance,
Avram



------------------------------

Message: 75
Date: Mon, 29 Sep 2008 22:33:35 +0100 (BST)
From: (Ted Harding) <Ted.Harding at manchester.ac.uk>
Subject: Re: [R] quantile
To: liujb <liujulia7 at yahoo.com>
Cc: r-help at r-project.org
Message-ID: <XFMail.080929223335.Ted.Harding at manchester.ac.uk>
Content-Type: text/plain; charset=iso-8859-1

On 29-Sep-08 20:09:14, liujb wrote:
> Hello,
> I need to assign a number to each x[i], i=1:100, based on the
> value of x[i] and where they are in the distribution of x[i].
> For example 1 for x[4] means x[4] is below 25%. I can obtain
> the quantile using quantile command, and just loop through the
> 1:100 and assign the correct number. But I was just wondering
> whether there are a more efficient way.
> 
> Thank you,
> sincerely,
> Julia

Well, you can certainly do it with a much shorter loop!

set.seed(31425)
x   <- rnorm(13)
x.v <- numeric(length(x))
ix  <- order(x)
Q <- quantile(x)
for(i in (5:2)){ x.v[x<=Q[i]] <- (i-1) }

cbind(x,x.v, x[ix],x.v[ix])
               x x.v             
 [1,] -0.7565336   2 -1.7045077 1
 [2,] -0.3287683   2 -1.0693801 1
 [3,] -1.7045077   1 -1.0671752 1
 [4,]  0.7259883   4 -0.9718954 1
 [5,]  0.6174724   3 -0.7565336 2
 [6,] -1.0693801   1 -0.3668566 2
 [7,]  1.9826596   4 -0.3287683 2
 [8,] -0.9718954   1  0.2491123 3
 [9,] -1.0671752   1  0.4733287 3
[10,] -0.3668566   2  0.6174724 3
[11,]  0.2491123   3  0.7259883 4
[12,]  0.4733287   3  1.9826596 4
[13,]  2.2095536   4  2.2095536 4

Hoping this helps,
Ted.

--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at manchester.ac.uk>
Fax-to-email: +44 (0)870 094 0861
Date: 29-Sep-08                                       Time: 22:33:33
------------------------------ XFMail ------------------------------



------------------------------

Message: 76
Date: Mon, 29 Sep 2008 14:41:44 -0700 (PDT)
From: sandsky <realstone at hotmail.com>
Subject: [R]  count data with a specific range
To: r-help at r-project.org
Message-ID: <19732290.post at talk.nabble.com>
Content-Type: text/plain; charset=us-ascii


Hi there,

The data is

data<-c(2,6,13,26,19,25,18,11,22,25)

I want to count data for these rages:

[0~10]:
[11~20]:
[21-30]:

Is anyone can help me?

Thank you in advance
-- 
View this message in context: http://www.nabble.com/count-data-with-a-specific-range-tp19732290p19732290.html
Sent from the R help mailing list archive at Nabble.com.



------------------------------

Message: 77
Date: Mon, 29 Sep 2008 13:04:59 +0000 (UTC)
From: Dieter Menne <dieter.menne at menne-biomed.de>
Subject: Re: [R] adding labels to tapply results
To: r-help at stat.math.ethz.ch
Message-ID: <loom.20080929T130356-41 at post.gmane.org>
Content-Type: text/plain; charset=us-ascii

eric lee <ericlee100 <at> gmail.com> writes:

> How do I get labels onto the output from tapply?  I need the labels to merge
> the output with another data frame.  Thanks.
> 
> eric
> 
> d <- data.frame(cbind(x=1:3, y=1:10))
> a <- with(d, tapply(y, x, sum))
> 

By taking the warning seriously. 

> d <- data.frame(cbind(x=1:3, y=1:10))
Warning message:
In cbind(x = 1:3, y = 1:10) :
  number of rows of result is not a multiple of vector length (arg 1)

 d <- data.frame(cbind(x=101:110, y=1:10))
 a <- with(d, tapply(y, x, sum))
 a

#101 102 103 104 105 106 107 108 109 110 
#  1   2   3   4   5   6   7   8   9  10 
 
Dieter



------------------------------

Message: 78
Date: Mon, 29 Sep 2008 14:41:11 +0000 (UTC)
From: Dieter Menne <dieter.menne at menne-biomed.de>
Subject: Re: [R] Hazard plot
To: r-help at stat.math.ethz.ch
Message-ID: <loom.20080929T144022-313 at post.gmane.org>
Content-Type: text/plain; charset=us-ascii

Laura Bonnett <l.j.bonnett <at> googlemail.com> writes:

> I am looking at a continuous variable, age.  I am looking at time to
> 12-month remission and can calculate the HR and 95% confidence interval are
> follows:
> coxfita = coxph(Surv(rem.Remtime,rem.Rcens)~nearma$all.age,data=nearma)
> exp(coxfita$coefficients)
> exp(confint(coxfita))
> 
> However, because I am looking at age as a continuous variable I cannot draw
> a Kaplan-Meier curve.  Instead I need to draw a plot of hazard against age.

Function survplot in package Design has "hazard" as an option.

Dieter



------------------------------

Message: 79
Date: Mon, 29 Sep 2008 11:43:46 -0500
From: "Earl F. Glynn" <efg at stowers-institute.org>
Subject: Re: [R] Double integration - Gauss Quadrature
To: r-help at stat.math.ethz.ch
Message-ID: <gbr0h5$i3o$1 at ger.gmane.org>

"Susanne Pfeifer" <tiffy at tiffy.it> wrote in message 
news:48DE3BE0.5020200 at tiffy.it...
> Hi,
>
> I would like to solve a double integral of the form
. . .
> but I would like to use Gauss Quadrature to do it.
> I have written the following code (using R's statmod package) which
> works fine for one integral but it doesn't work for a double one:

Maybe there's some way to use sapply as your code suggests, but I'm not sure 
where you defined the $value that is being returned in your inner call:
gauss_legendre(function(x) x*y, 0, 1, nodes, weights)$value

I converted some old IDL code to do this 2D integral but without trying to 
use your sapply:

# For N=5, see "known" values here:
# http://mathworld.wolfram.com/Legendre-GaussQuadrature.html

library(statmod)
N <- 5
GL <- gauss.quad(N)
nodes   <- GL$nodes
weights <- GL$weights

##############################################

# 1D Gauss-Legendre
gauss_legendre <- function(f, a, b, nodes, weights)
{
  C <- (b - a) / 2
  D <- (b + a) / 2

  sum <- 0.0
  for (i in 1:length(nodes))
  {
    sum <- sum + weights[i] * f(nodes[i]*C + D)
  }

  return(C * sum)
}

##############################################

gauss_legendre2D_helper <- function(f, x, a2,b2, nodes, weights)
{
  C <- (b2 - a2) / 2
  D <- (b2 + a2) / 2

  sum <- 0.0
  for (i in 1:length(nodes))
  {
    y <- nodes[i]*C + D
    sum <- sum + weights[i] * f(x,y)
  }

  return(C * sum)
}

gauss_legendre2D <- function(f, a1,b1, a2,b2, nodes, weights)
{
  C <- (b1 - a1) / 2
  D <- (b1 + a1) / 2

  sum <- 0.0
  for (i in 1:length(nodes))
  {
    x <- nodes[i]*C + D
    sum <- sum + weights[i] * gauss_legendre2D_helper(f, x, a2, b2, nodes, 
weights)
  }

  return(C * sum)
}


##############################################

# 1D Test:
gauss_legendre(function(x) {x}, 0.0, 1.0, nodes, weights)

# 2D Test:
gauss_legendre2D(function(x,y) {x*y}, 0.0, 1.0, 0.0, 1.0, nodes, weights)

# Minimal testing here:

> # 1D Test:
> gauss_legendre(function(x) {x}, 0.0, 1.0, nodes, weights)
[1] 0.5
>
> # 2D Test:
> gauss_legendre2D(function(x,y) {x*y}, 0.0, 1.0, 0.0, 1.0, nodes, weights)
[1] 0.25


BTW:  I don't think you need N as large as you're using. The advantage of 
Gauss-Legendre quadrature is fairly high precision without that many 
function evaluations.


Formulas for those who may be interested:

1D Gauss-Legendre Quadrature












2D Gauss-Legendre Quadrature







This can be extended to a 3D integral evaluations, too.

efg

Earl F Glynn
Scientific Programmer
Stowers Institute for Medical Research
 


begin 666 clip_image002.gif
M1TE&.#EA% $K`'<`,2'^&E-O9G1W87)E.B!-:6-R;W-O9G0 at 3V9F:6-E`"'Y
M! $`````+ (`!0`/`2(`@ ````````+_A(^IR^V/`@Q2T0JSINL^K!U at PUEE
MB(JCX3EK"L?;-I[R;0/E&\%\5_O=2$'69XA,BD*YG)*6<)(8+Z$I:CTRB[.G
M-Y4U at J3?Z3B\[*AG9R1:!U>AWN7Y-((Y2?)QUMZ_1^<G)[846+%3L]:#10C'
MUX;((<6E`VEH*3G(6/<DM**'&<=GB8=#^FC4=ZEHX7JEFCJ:9D/6YW at Y&_O7
MVCFHUP3\4[6K^E?,B7?1\DJ*N&IZN[J\'!N%_(S:JT(="CV+6BHM&#,I/JK]
M*FU,JSMV/?3,+C]M;7_/0Y_-GM:_R.A,5[UUY,"\:X?PSK6#WO*\*RC*6#ID
MR?S=*T0KX":,__\BHNLWL6*=@QX%;EQW;J"S8_3*D=R!*9=%?%1>ZOO%K^-)
MA\6.R9I9AJ3)</9 *6/I(:FFE&".HIND;YM(E&?,93HD+A&5?]4D0=TE=22\
MK(1:2H7H"^T$.V-]K4WK%E^PJE-YQ;6C5 at M;GW?5Y'71-VC-OUYL)8$8*# 1
MMX05_W0,.;+DR;@:'[9,.;/FS=%07JW&.;3HT:-;DCZ-.G5HTP:[N7X-.[;L
MV;1KV[Z-.[?NW;Q[/W3A6K7PX<1ED,%</+GRU<N;.W^NMQ'TZ=1)\U5773FS
M[)D->^:.FBAXZ^.3"RTO&CGZN^K7&__N_G3[^ ;I%Y]O/_]X_/K[4Q7G[U^ 
3S0$H8('$G6=@@O9UH^ 3!0``.P``
`
end



------------------------------

Message: 80
Date: Mon, 29 Sep 2008 15:44:14 -0500
From: "Earl F. Glynn" <efg at stowers-institute.org>
Subject: Re: [R] Double integration - Gauss Quadrature
To: r-help at stat.math.ethz.ch
Message-ID: <gbrek1$64m$1 at ger.gmane.org>

"Susanne Pfeifer" <tiffy at tiffy.it> wrote in message 
news:48DE3BE0.5020200 at tiffy.it...
> Hi,
>
> I would like to solve a double integral of the form
>
> \int_0^1 \int_0^1 x*y dx dy
>
> using Gauss Quadrature.

OK, I felt guilty for using a for loop, so here's something that should be 
close to what you want using sapply:

library(statmod)
N <- 5
GL <- gauss.quad(N)
nodes   <- GL$nodes
weights <- GL$weights

gauss_legendre2D <- function(f, a1,b1, a2,b2, nodes, weights)
{
  C2 <- (b2 - a2) / 2
  D2 <- (b2 + a2) / 2
  y <- nodes*C2 + D2

  C1 <- (b1 - a1) / 2
  D1 <- (b1 + a1) / 2
  x <- nodes*C1 + D1

  C2*sum(weights *
      sapply( y,
          function(y) { C1 * sum( weights * f(x, y)) } ) )
}

# your problem:  area = 0.25
gauss_legendre2D(function(x,y) {x*y}, 0.0, 1.0, 0.0, 1.0, nodes, weights)

# test:  area of unit circle = integral 0..2pi integral 0..1 r*dr *dTheta
gauss_legendre2D(function(x,y) {x}, 0.0, 1.0, 0.0, 2*pi, nodes, weights)

efg
Earl F Glynn



------------------------------

Message: 81
Date: Tue, 30 Sep 2008 11:07:33 +1300
From: "Peter Alspach" <PAlspach at hortresearch.co.nz>
Subject: Re: [R] count data with a specific range
To: "sandsky" <realstone at hotmail.com>, <r-help at r-project.org>
Message-ID:
	<EC0F8FF776F3F74E9C63CE16641C9628032F4371 at AKLEXB02.hort.net.nz>
Content-Type: text/plain;	charset="us-ascii"

Kia ora

?hist

in particular the breaks argument and set plot=FALSE.

HTH ...

Peter Alspach
 

> -----Original Message-----
> From: r-help-bounces at r-project.org 
> [mailto:r-help-bounces at r-project.org] On Behalf Of sandsky
> Sent: Tuesday, 30 September 2008 10:42 a.m.
> To: r-help at r-project.org
> Subject: [R] count data with a specific range
> 
> 
> Hi there,
> 
> The data is
> 
> data<-c(2,6,13,26,19,25,18,11,22,25)
> 
> I want to count data for these rages:
> 
> [0~10]:
> [11~20]:
> [21-30]:
> 
> Is anyone can help me?
> 
> Thank you in advance
> --
> View this message in context: 
> http://www.nabble.com/count-data-with-a-specific-range-tp19732
> 290p19732290.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> R-help at 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.
> 

The contents of this e-mail are privileged and/or confidential to the named
 recipient and are not to be used by any other person and/or organisation.
 If you have received this e-mail in error, please notify the sender and delete
 all material pertaining to this e-mail.



------------------------------

Message: 82
Date: Mon, 29 Sep 2008 17:20:21 -0500
From: "hadley wickham" <h.wickham at gmail.com>
Subject: Re: [R] box-whisker plot from pre-summarized data?
To: "Avram Aelony" <aavram at mac.com>
Cc: r-help at r-project.org
Message-ID:
	<f8e6ff050809291520n103bb35bref71159affa5cfa0 at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

On Mon, Sep 29, 2008 at 4:27 PM, Avram Aelony <aavram at mac.com> wrote:
> Hello,
>
> Although my summary descriptives are generated outside of R (dataset is
> huge), I would like to produce a box-whisker plot using bxp or perhaps a
> function from the ggplot2 library using the precomputed summaries.

You should be able to do it like:

+ geom_boxplot(aes(ymin = lower.whisker, lower=lower.hinge,
middle=median, upper=upper.hinge, ymax=upper.whisker), stat =
"identity")

(where lower.whisker etc are the variables from your precomputed data set)

and then add on the outliers with geom_point

Hadley

-- 
http://had.co.nz/



------------------------------

Message: 83
Date: Mon, 29 Sep 2008 19:39:14 -0400
From: "jim holtman" <jholtman at gmail.com>
Subject: Re: [R] count data with a specific range
To: sandsky <realstone at hotmail.com>
Cc: r-help at r-project.org
Message-ID:
	<644e1f320809291639o1842625dq2540f23bd0475420 at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

> data<-c(2,6,13,26,19,25,18,11,22,25)
> table(cut(data, breaks=c(0,10,20,30)))

 (0,10] (10,20] (20,30]
      2       4       4


On Mon, Sep 29, 2008 at 5:41 PM, sandsky <realstone at hotmail.com> wrote:
>
> Hi there,
>
> The data is
>
> data<-c(2,6,13,26,19,25,18,11,22,25)
>
> I want to count data for these rages:
>
> [0~10]:
> [11~20]:
> [21-30]:
>
> Is anyone can help me?
>
> Thank you in advance
> --
> View this message in context: http://www.nabble.com/count-data-with-a-specific-range-tp19732290p19732290.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at 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?



------------------------------

Message: 84
Date: Mon, 29 Sep 2008 16:57:13 -0700 (PDT)
From: ashky <ashokkrish at gmail.com>
Subject: [R]  Logistic Regression using optim() give "L-BFGS-B" error,
	please help
To: r-help at r-project.org
Message-ID: <19733974.post at talk.nabble.com>
Content-Type: text/plain; charset=us-ascii


Sorry, I deleted my old post. Pasting the new query below.

Dear R Users/Experts, 

I am using a function called logitreg() originally described in MASS (the
book 4th Ed.) by Venebles & Ripley, p445. I used the code as provided but
made couple of changes to run a 'constrained' logistic regression, I set the
method = "L-BFGS-B", set lower/upper values for the variables. 

Here is the function, 

logitregVR <- function(x, y, wt = rep(1, length(y)), intercept = T, start =
rep(0, p), ...)
{
#-------------------------------------------#
# A function to be minimized (or maximized) #
#-------------------------------------------#
fmin <- function(beta, X, y, w) 
{
  p <- plogis(X %*% beta)
  #p <- ifelse(1-p < 1e-6, 1-1e-6, p) 
 cat("----------", "\n")
 cat(paste("X = "), X, "\n")
 cat(paste("beta = "), beta, "\n")
 cat(paste("p = "), p, "\n")
 cat(paste("1-p = "), 1-p, "\n")
 cat(paste("y = "), y, "\n")
 cat(paste("length(p) ="), length(p), "\n")
 cat(paste("class(p) ="), class(p), "\n")
 cat("----------", "\n")

 -sum(2*w*ifelse(y, log(p), log(1-p))) # Residual Deviance: D =
-2[Likelihood Ratio]
 print(-sum(2*w*ifelse(y, log(p), log(1-p))))
}

#----------------------------------------------------------------------#
# A function to return the gradient for the "BFGS", "L-BFGS-B" methods #
#----------------------------------------------------------------------#
gmin <- function(beta, X, y, w) 
{
  eta <- X %*% beta; p <- plogis(eta)
  #p <- ifelse(1-p < 1e-6, 1-1e-6, p) 
  -2*matrix(w*dlogis(eta)*ifelse(y, 1/p, -1/(1-p)), 1) %*% X # Gradient
  print(-2*matrix(w*dlogis(eta)*ifelse(y, 1/p, -1/(1-p)), 1) %*% X)
}

  if(is.null(dim(x))) dim(x) <- c(length(x), 1)
  dn <- dimnames(x)[[2]]
  if(!length(dn)) dn <- paste("Slope", 1:ncol(x), sep="")
  p <- ncol(x) + intercept # 1 + 1
  if(intercept) {x <- cbind(1, x); dn <- c("(Intercept)", dn)}
  if(is.factor(y)) y <- (unclass(y) != 1)

#fit <- optim(start, fmin, gmin, X = x, y = y, w = wt, method = "L-BFGS-B",
lower = c(-Inf, 0.05), upper = c(Inf, Inf), ...)
fit <- optim(start, fmin, gmin, X = x, y = y, w = wt, control = list(trace =
6), method = "L-BFGS-B", lower = c(-Inf, 0.05), upper = c(Inf, Inf), ...)

  names(fit$par) <- dn
  cat("\nCoefficients:\n"); print(fit$par)
  cat("\nResidual Deviance:", format(fit$value), "\n")
  if(fit$convergence > 0) cat("\nConvergence code:", fit$convergence, "\n")
  return(list(fitpar = fit$par))
  invisible(fit)
}

And here is my data, 

# ---------------------- 
# Dose 0 1 emp.prop 
# ---------------------- 
# 1 3 0 0.000 
# 2 1 0 0.000 
# 3.3 4 0 0.000 
# 5.016 3 0 0.000 
# 7.0224 4 0 0.000 
# 9.3398 2 0 0.000 
# 12.4219 2 0 0.000 
# 16.5211 47 1 0.021 
# 21.9731 1 1 0.500 
# ---------------------- 

I have used the glm(family = binomial) and the lrm() function. But my
interest is to constraint the slope parameter (beta) to some specified value
(say, a non negative number, 0.05 for instance). If you notice in the above
code by Venebles and Ripley, for the optim() part I chose method =
"L-BFGS-B" and set lower and upper values for my two parameters. Here is the
code and the error I am getting, 

y <- c(rep(0,3), rep(0,1), rep(0,4), rep(0,3), rep(0,4), rep(0,2), rep(0,2),
rep(0,47), rep(1,1), rep(0,1), rep(1,1)) 
x <- c(rep(1,3), rep(2,1), rep(3.3,4), rep(5.016,3), rep(7.0224,4),
rep(9.3398,2), rep(12.4219,2), rep(16.5211,48), rep(21.9731,2)) 

length(x) 
length(y) 

#------------------# 
# Method 1 - Works # 
#------------------# 
glm(y~x, family = binomial)$coefficients 

# summary(glm(y~x, family = binomial)) 

#------------------# 
# Method 2 - Works # 
#------------------# 
  library(Design) 
  lrm(y ~ x)$coef 

#-------------------# 
# Method 3 - Works # 
#-------------------# 
lgtreg <- function(beta, x, y) 
{ 
       eta <- exp(beta[1] + beta[2]*x) 
       p <- eta/(1+eta) 
       return(-sum(ifelse(y,log(p),log(1-p)))) # This is the log-likelihood 
} 

optim(c(0,0), lgtreg, x = x, y = y, method = "BFGS", hessian = TRUE)$par 

#-----------------------------------------------------------------# 
# Method 4 - Veneble and Ripley's Method with different start values # 
#-----------------------------------------------------------------# 

logitregVR(x, y) # No error 
logitregVR(x, y, start = rep(0.1, 2)) # Gives error 
logitregVR(x, y, start = rep(0.5, 2)) # No error 
logitregVR(x, y, start = rep(1, 2)) # Gives error 

I am getting this error, 

Error in optim(start, fmin, gmin, X = x, y = y, w = wt, method = "L-BFGS-B",
: L-BFGS-B needs finite values of 'fn'

If you see, at each iteration I printed the X, beta, p, Deviance etc. But
for certain start values this function is failing on me and giving an
infinite value for Deviance. Can someone please help me and tell what I am
doing wrong.

Any comments/replies highly appreciated, 

Thank you very much,
Ashky
-- 
View this message in context: http://www.nabble.com/Logistic-Regression-using-optim%28%29-give-%22L-BFGS-B%22-error%2C-please-help-tp19733974p19733974.html
Sent from the R help mailing list archive at Nabble.com.



------------------------------

Message: 85
Date: Mon, 29 Sep 2008 18:54:14 -0500 (CDT)
From: "snoweye" <snoweye at iastate.edu>
Subject: [R] SET_VECTOR_ELT() and mkChar()
To: r-help at r-project.org
Message-ID: <14541829810812721 at webmail.iastate.edu>

Dear R's friends,

I have a C code with a lot of SEXP objects and I want to return them as a list.
Does any function I can use in SET_VECTOR_ELT() as mkChar() in
SET_STRING_ELT()? For example, this is my code,

SEXP my_code(){
  int i;
  SEXP a1, a2, a3, res, res_names;
  char *names[3] = {"a1", "a2", "a3"};

  PROTECT(a1 = allocVector(REALSXP,  3));
  PROTECT(a2 = allocVector(REALSXP,  4));
  PROTECT(a3 = allocVector(REALSXP,  5));
  PROTECT(res = allocVector(LISTSXP, 3));
  PROTECT(res_names = allocVector(STRSXP, 3));
  for(i = 0; i < 3; i++){
    SET_STRING_ELT(res_names, i, mkChar(names[i])); 
/* What should I do at here? May I use eval()?
    SET_VECTOR_ELT(res, i, ????);
*/
  }

  setAttrib(res, R_NamesSymbol, ret_names);

  UNPROTECT(5);
  return(res);
}


I need a function to replace these things,
    SET_VECTOR_ELT(res, 0, a1);
    SET_VECTOR_ELT(res, 0, a2);
    SET_VECTOR_ELT(res, 0, a3);
    ...
Does it possible? Thanks.

Sincerely,
Wei-Chen Chen

==========
Don't ever let somebody tell you, "you can't do something."
Not even me. You got a dream.  You gotta protect it.
People can't do something themselves. They wanna tell you,
"you can't do it." If you want something, go get it, period!
-- Chris Gardner (Will Smith in The Pursuit of Happyness)



------------------------------

Message: 86
Date: Mon, 29 Sep 2008 20:50:45 -0500
From: Frank E Harrell Jr <f.harrell at vanderbilt.edu>
Subject: Re: [R] FW:  logistic regression
To: Greg Snow <Greg.Snow at imail.org>
Cc: "dieter.menne at menne-biomed.de" <dieter.menne at menne-biomed.de>,
	"r-help at stat.math.ethz.ch" <r-help at stat.math.ethz.ch>,
	"ted.harding at manchester.ac.uk" <ted.harding at manchester.ac.uk>
Message-ID: <48E185F5.6040505 at vanderbilt.edu>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Greg Snow wrote:
>> -----Original Message-----
>> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
>> project.org] On Behalf Of Frank E Harrell Jr
>> Sent: Saturday, September 27, 2008 7:15 PM
>> To: Darin Brooks
>> Cc: dieter.menne at menne-biomed.de; r-help at stat.math.ethz.ch;
>> ted.harding at manchester.ac.uk
>> Subject: Re: [R] FW: logistic regression
>>
>> Darin Brooks wrote:
>>> Glad you were amused.
>>>
>>> I assume that "booking this as a fortune" means that this was an
>> idiotic way
>>> to model the data?
>> Dieter was nominating this for the "fortunes" package in R.  (Thanks
>> Dieter)
>>
>>> MARS?  Boosted Regression Trees?  Any of these a better choice to
>> extract
>>> significant predictors (from a list of about 44) for a measured
>> dependent
>>> variable?
>> Or use a data reduction method (principal components, variable
>> clustering, etc.) or redundancy analysis (to remove individual
>> predictors before examining associations with Y), or fit the full model
>> using penalized maximum likelihood estimation.  lasso and lasso-like
>> methods are also worth pursuing.
> 
> Frank (and any others who want to share an opinion):
> 
> What are your thoughts on model averaging as part of the above list?

Model averaging has good performance but no advantage over fitting a 
single complex model using penalized maximum likelihood estimation.

Frank

> 
> 
> --
> Gregory (Greg) L. Snow Ph.D.
> Statistical Data Center
> Intermountain Healthcare
> greg.snow at imail.org
> 801.408.8111
> 
> 
> 


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



------------------------------

Message: 87
Date: Tue, 30 Sep 2008 14:33:57 +1300
From: Paul Murrell <p.murrell at auckland.ac.nz>
Subject: Re: [R] example - export a data frame to an XML file
To: zubin <binabina at bellsouth.net>
Cc: r-help at r-project.org, Duncan Temple Lang <duncan at wald.ucdavis.edu>
Message-ID: <48E18205.30005 at stat.auckland.ac.nz>
Content-Type: text/plain; charset=ISO-8859-1

Hi

Is this what you are after ... ?


data <-
read.csv(textConnection('"date","UYG.Open","UYG.High","UYG.Low","UYG.Close","UYG.Volume","UYG.Adjusted"
"2007-02-01",71.32,71.34,71.32,71.34,200,69.23
"2007-02-02",72.2,72.2,72.2,72.2,200,70.06
"2007-02-05",71.76,71.76,71.76,71.76,5100,69.63
"2007-02-06",72.85,72.85,72.85,72.85,3800,70.69
"2007-02-07",72.85,72.85,72.85,72.85,0,70.69'),
                  as.is=TRUE)

library(XML)

xml <- xmlTree()
xml$addTag("document", close=FALSE)
for (i in 1:nrow(data)) {
    xml$addTag("row", close=FALSE)
    for (j in names(data)) {
        xml$addTag(j, data[i, j])
    }
    xml$closeTag()
}
xml$closeTag()

# view the result
cat(saveXML(xml))


Paul


zubin wrote:
> Duncan, thanks for the note - the schema looks like this - is this what 
> your asking for?
> 
> <document>
>  <row>
>   <date>2007-02-01</date >
>   <UYG_Open>71.32</UYG_Open >
>   <UYG_High>71.34</UYG_High >
>   <UYG_Low>71.32</UYG_Low >
>   <UYG_Close>71.34</UYG_Close >
>   <UYG_Volume>200</UYG_Volume >
>   <UYG_Adjusted>69.23</UYG_Adjusted >
>  </row>
>  <row>
>   <date>2007-02-02</date >
>   <UYG_Open>72.2</UYG_Open >
>   <UYG_High>72.2</UYG_High >
>   <UYG_Low>72.2</UYG_Low >
>   <UYG_Close>72.2</UYG_Close >
>   <UYG_Volume>200</UYG_Volume >
>   <UYG_Adjusted>70.06</UYG_Adjusted >
>  </row>
> </document>
> 
> Duncan Temple Lang wrote:
>> Hi Zubin.
>>
>>
>>   The first thing is to send us a link to the schema that the
>> other application expects. That would give us a "one-to-one"
>> mapping; otherwise, data.frame to arbitrary XML is to vague.
>>
>>   Currently, there is nothing in the XML package that would
>> be able to take an XML schema and write an R object to such a
>> structure. However, I am in the process of creating an XMLSchema
>> package which can read XML schema and make the description available to
>> R so that we can read data from an XML file corresponding to that schema
>> and this could be adapted in some ways to automate the creation of
>> XML from an R object (under certain assumptions).
>>
>>  So please send us all a link to the XML schema.
>>
>>   D.
>>
>>
>> zubin wrote:
>>> In need of exporting an XML file from R, I scrub some data in R and 
>>> push the data into another application requiring XML.  The data set 
>>> is a very straightforward data frame of stock prices- see below.  I 
>>> know the package XML is the one to use, but need an example or some 
>>> direction on where to start.  I know we need to define the schema - 
>>> can this be done in the R XML package?
>>>> "date","UYG.Open","UYG.High","UYG.Low","UYG.Close","UYG.Volume","UYG.Adjusted" 
>>>>
>>>> "2007-02-01",71.32,71.34,71.32,71.34,200,69.23
>>>> "2007-02-02",72.2,72.2,72.2,72.2,200,70.06
>>>> "2007-02-05",71.76,71.76,71.76,71.76,5100,69.63
>>>> "2007-02-06",72.85,72.85,72.85,72.85,3800,70.69
>>>> "2007-02-07",72.85,72.85,72.85,72.85,0,70.69
>>>>
>>>>
>>>>
>>>>
>>> ______________________________________________
>>> R-help at 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 at 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.

-- 
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
paul at stat.auckland.ac.nz
http://www.stat.auckland.ac.nz/~paul/



------------------------------

Message: 88
Date: Mon, 29 Sep 2008 21:33:51 -0700 (PDT)
From: Michael Grant <mwgrant2001 at yahoo.com>
Subject: Re: [R] Bug in "is" ?
To: Stefan Evert <stefan.evert at uos.de>,	R-help Mailing List
	<r-help at r-project.org>,	"Lucke, Joseph F" <Joseph.F.Lucke at uth.tmc.edu>
Message-ID: <575629.37449.qm at web52008.mail.re2.yahoo.com>
Content-Type: text/plain; charset=us-ascii


Tie a rock to the 7 and tie another rock of equal mass to the 7.0. Throw them both into opposite ends of a large pond on the first Tuesday after after a new moon. If the former number floats it is not the integer 10. If the latter floats it likely is not the larger integer 13. This is because of the greater buoyancy of the '0'. Divide the difference (13-10) into 1 and you have 1/3, but you do not have 7 or even 7.0. Since this result is neither '7' nor '7.0', it absolutely must be a '7.'.  This is why pi is irrational. 

Now, I hope that settles everything. It is easily demonstrated in four and a half lines of R code or one line of APL.

HTH :O)
Michael Grant








--- On Mon, 9/29/08, Lucke, Joseph F <Joseph.F.Lucke at uth.tmc.edu> wrote:

> From: Lucke, Joseph F <Joseph.F.Lucke at uth.tmc.edu>
> Subject: Re: [R] Bug in "is" ?
> To: "Stefan Evert" <stefan.evert at uos.de>, "R-help Mailing List" <r-help at r-project.org>
> Date: Monday, September 29, 2008, 10:24 AM
> Stefan
> You are right.  Briefly put, the existence of 7 requires
> only Peano's
> axiom for successive integers.  Strictly speaking, 7 is not
> an integer
> but a natural number. But natural numbers can be embedded
> in the
> integers which can be embedded in the rationals which can
> be embedded
> the reals which can be embedded in the complex. Little of
> this is
> relevant to a programming language's two basic storage
> modes for
> numbers. Confusing a variable type with a mathematical set
> is an
> elementary, if entertaining, logical error.
> Joe
> 
> -----Original Message-----
> From: r-help-bounces at r-project.org
> [mailto:r-help-bounces at r-project.org]
> On Behalf Of Stefan Evert
> Sent: Saturday, September 27, 2008 12:27 PM
> To: R-help Mailing List
> Subject: Re: [R] Bug in "is" ?
> 
> Hi everyone!
> 
> Sorry for taking an already overlong discussion thread
> slightly off-
> topic, but ...
> 
> > quote:
> > No doubt, 7.0 is integer in math. But if people can
> write 7 why people
> 
> > need to write 7.0 (I do not see any reason to do
> this).
> > endquote
> 
> > What is true in mathematics is not necessarily true in
> R.
> 
> ... am I the only one who thinks that the integer 7 is
> something
> entirely different from the real number 7.0? (The latter
> most likely
> being an equivalence class of sequences of rational
> numbers, but that
> depends on your axiomatisation of real numbers.) Integers
> can be
> embedded in the set of real numbers, but that doesn't
> make them the same
> mathematically.
> 
> So the original complaint should really have said that
> is.integer()
> doesn't do what a naive user (i.e. someone without a
> background in
> computer science or maths) might expect it to do. :-)
> 
> That said, I've fallen into the same trap more than
> once, and painfully,
> myself (often in connection with MySQL).
> 
> 
> Best wishes, and with a tiny grain of salt, Stefan Evert
> 
> [ stefan.evert at uos.de | http://purl.org/stefan.evert ]
> 
> 
> 
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at 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 at 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.



------------------------------

Message: 89
Date: Mon, 29 Sep 2008 22:14:28 -0700
From: Dave DeBarr <Dave.DeBarr at microsoft.com>
Subject: Re: [R] R-2.7.2 infected?
To: "r-help at r-project.org" <r-help at r-project.org>
Message-ID:
	<3A40832EDA5ED541862093713985F7B56B6490232E at NA-EXMSG-C105.redmond.corp.microsoft.com>
	
Content-Type: text/plain; charset="iso-8859-1"

For what it's worth, Computer Associates updated their signatures; and eTrust no longer reports the installation program for the Windows version of R-2.7.2 as infected.

I found it surprisingly difficult to learn about how the Win32/Adclicker.JO virus operates, and how eTrust detects it.  I couldn't even get anyone to admit it was a false positive (though it seems clear now).

Regards,
Dave
________________________________________
From: r-help-bounces at r-project.org [r-help-bounces at r-project.org] On Behalf Of Ajay ohri [ohri2007 at gmail.com]
Sent: Tuesday, September 23, 2008 1:06 AM
To: Peter Dalgaard
Cc: r-help at r-project.org; Dave DeBarr; Duncan Murdoch
Subject: Re: [R] R-2.7.2 infected?

This is what it does. It seems like a false alarm because in case of
actual infection it seems
quite conspicious

Ajay

www.decisionstats.com



http://www.spywareguide.com/product_show.php?id=2569


Full Name:
Win32.AdClicker Websearch   Read More
Type:Trojan
SG Index: 5 [Explain]
Removal tools:List of products that detect/remove/protect against
Win32.AdClicker:
Desktop Anti-malware: Pro User: X-Cleaner
Control IM and P2P use, block spyware and other malware: RTGuardian
Endpoint Spyware Remediation: Greynet Enterprise Manager
IM, P2P control, malware prevention and web filtering in single
appliance: Unified Security Gateway
Category Description:A Trojan is a program that enables an attacker to
get nearly complete control over an infected PC. Frequently used tool
by malicious hackers. When this program executes, the program performs
a specific set of actions. This usually works toward the goal of
allowing the trojan to survive on a system and open up a backdoor

.
Comment:This Trojan downloads many executable.It changes the
autostarter randomly. It also hijacks the desktop and puts a wall
paper saying that the system is affected and advertises a sites
?smart-security.info?.It duplicates each and every file which the user
creates with the same name and in the same Directory.


Properties:
 Adds other software
 Autostarts/Stays Resident
 Installs Through Exploit
 Opens ports
On Tue, Sep 23, 2008 at 1:29 PM, Peter Dalgaard
<P.Dalgaard at biostat.ku.dk> wrote:
>
> Peter Dalgaard wrote:
> > Dave DeBarr wrote:
> >>> Did you check the md5 checksum on it?
> >>>
> >>
> >> Yes; it matched: 540090dd892657804d1099c54d6f770d
> >>
> >>
> > And it is binary identical to the Austria CRAN one.
> >>
> >>> You're the first to report it, and 2.7.2 has been out for almost a
> >>> month, so I think it's likely that the CRAN copy is uninfected.
> >>>
> >>
> >> Sounds promising.  Perhaps it's a false positive from eTrust.
> >>
> >>
> >>
> > Likely. A quick Googling indicates that other programs have been
> > "caught" too.
> > This link is illuminative:
> > http://www.cccp-project.net/forums/index.php?topic=2897.0
>
> (I wanted to do the same thing with R, but http://www.virustotal.com has
> a 20M cap on the file size.)
>
> --
>   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.dalgaard at biostat.ku.dk)              FAX: (+45) 35327907
>
> ______________________________________________
> R-help at 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.



--
Regards,

Ajay Ohri
http://tinyurl.com/liajayohri
______________________________________________
R-help at 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.



------------------------------

Message: 90
Date: Tue, 30 Sep 2008 08:05:36 +0200
From: J?rg Gro? <joerg at licht-malerei.de>
Subject: Re: [R] histogram-like plot - multiple bars side by side
	*solved*
To: r-help at r-project.org
Message-ID: <1A7D7955-6A48-4699-AA52-0682AF6C2689 at licht-malerei.de>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Thanks!
That helped a lot.


Am 29.09.2008 um 22:13 schrieb Greg Snow:

> Do you mean something like this:
>
> x <- 0:14
> y1 <- dbinom(x,14,0.7)
> y2 <- dbinom(x,14,0.5)
> y3 <- dbinom(x,14,0.3)
>
> barplot( rbind(y1,y2,y3), names=x, beside=TRUE)
>
> Hope this helps,
>
> --
> Gregory (Greg) L. Snow Ph.D.
> Statistical Data Center
> Intermountain Healthcare
> greg.snow at imail.org
> 801.408.8111
>
>
>> -----Original Message-----
>> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
>> project.org] On Behalf Of J?rg Gro?
>> Sent: Monday, September 29, 2008 2:06 PM
>> To: r-help at r-project.org
>> Subject: [R] histogram-like plot - multiple bars side by side
>>
>> Hi,
>>
>> I found this example for producing multiple histograms;
>>
>>  require(plotrix)
>>  l <- list(rnorm(50),rnorm(50,sd=2),rnorm(50,mean=3))
>>  multhist(l)
>>
>>
>> Now I want something like that, for creating multiple density
>> distributions (in one plot).
>>
>> But I have two variables for one density distribution and "multhist"
>> only allows me to add one variable;
>>   x <- seq(from=0, to=14, by=1)
>>   y <- dbinom(x, 14, 0.7, log = FALSE)
>>
>>
>> Is there a way to make a histogram-like plot with multiple bars side
>> by side (for different distributions) like in the example?
>>
>> ______________________________________________
>> R-help at 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.



------------------------------

Message: 91
Date: Tue, 30 Sep 2008 09:03:45 +0200
From: " Tomislav Pu?a " <xxk363 at gmail.com>
Subject: [R]  crashes while using Rattle (GTK+)
To: r-help at r-project.org
Message-ID:
	<c9468c960809300003n43605ef0ydbfd5c5071549e6e at mail.gmail.com>
Content-Type: text/plain

Hi,

I'm using R 2.7.2 for Windows.I have also installed gtk-dev-2.12.9 and
rattle 2.3.65. When I work in rattle, I occasionally get these messages :

GLib-WARNING (recurser) **: g_main_context_prepare() called recursively from
within a source's check() or prepare() member. aborting....

or

GLib-WARNING (recurser) **: g_main_context_prepare() called recursively from
within a source's check() or prepare() member. aborting....
(Rgui.exe : 3580): GLib-WARNING **: g_main_context_prepare() called
recursively from within a source's check() or prepare() member.

and then R crashes. I tried to reinstall R, reinstall all packages (i have
all dependent packages installed), I was looking on GTK+ pages and Google
but I only found similar post without an answer.

I think that problem lies in GTK. But I don't have any idea how to get the
things working.

Please help !

	[[alternative HTML version deleted]]



------------------------------

Message: 92
Date: Tue, 30 Sep 2008 09:40:56 +0200
From: Gregor Rolshausen <gregor.rolshausen at biologie.uni-freiburg.de>
Subject: [R] Version 2.7.2 GUI acts awkward?
To: r-help at r-project.org
Message-ID: <48E1D808.1010600 at biologie.uni-freiburg.de>
Content-Type: text/plain; charset=ISO-8859-15; format=flowed

hi,
I am running R 2.7.2 Windows - recently the GUI-windows (for example to 
"change directory" or "read in R-scripts") do not open - well, they 
open, but close down directly afterwards. I can't select a directory or 
file ...

I tried re-installing R - same problem again.

does anybody have an idea?

thanks
gregor

-- 
Gregor Rolshausen
	
PhD Student; University of Freiburg, Germany

e-mail: gregor.rolshausen at biologie.uni-freiburg.de	
tel.  : ++49 761 2032559



------------------------------

Message: 93
Date: Tue, 30 Sep 2008 09:17:39 +0100
From: tolga.i.uzuner at jpmorgan.com
Subject: [R] snow: Problems with cluster
To: r-help at r-project.org
Message-ID:
	<OFC79CE925.1D2756C8-ON802574D4.002D65A7-802574D4.002D8FDB at jpmchase.com>
	
Content-Type: text/plain

Dear R Users,

I have come across a problem with the snow package across two PCs 
recently. 

The error message is : 
"Error in unserialize(node$con) : error reading from connection"

I was wondering if anyone else has ever come across this and if there are 
any suggestions as to what it may mean and how it can be fixed ?

Thanks in advance,
Tolga


Generally, this communication is for informational purposes only
and it is not intended as an offer or solicitation for the purchase
or sale of any financial instrument or as an official confirmation
of any transaction. In the event you are receiving the offering
materials attached below related to your interest in hedge funds or
private equity, this communication may be intended as an offer or
solicitation for the purchase or sale of such fund(s).  All market
prices, data and other information are not warranted as to
completeness or accuracy and are subject to change without notice.
Any comments or statements made herein do not necessarily reflect
those of JPMorgan Chase & Co., its subsidiaries and affiliates.

This transmission may contain information that is privileged,
confidential, legally privileged, and/or exempt from disclosure
under applicable law. If you are not the intended recipient, you
are hereby notified that any disclosure, copying, distribution, or
use of the information contained herein (including any reliance
thereon) is STRICTLY PROHIBITED. Although this transmission and any
attachments are believed to be free of any virus or other defect
that might affect any computer system into which it is received and
opened, it is the responsibility of the recipient to ensure that it
is virus free and no responsibility is accepted by JPMorgan Chase &
Co., its subsidiaries and affiliates, as applicable, for any loss
or damage arising in any way from its use. If you received this
transmission in error, please immediately contact the sender and
destroy the material in its entirety, whether in electronic or hard
copy format. Thank you.
Please refer to http://www.jpmorgan.com/pages/disclosures for
disclosures relating to UK legal entities.
	[[alternative HTML version deleted]]



------------------------------

Message: 94
Date: Tue, 30 Sep 2008 10:21:40 +0200
From: "Benoit Boulinguiez" <benoit.boulinguiez at ensc-rennes.fr>
Subject: [R]  par() default values
To: <r-help at r-project.org>
Message-ID: <002d01c922d5$905fb6a0$50111481 at PR017080>
Content-Type: text/plain

Hi all,
 
Is that possible to get back to the par() default values easily?
I played a bit with par()
 

Regards/Cordialement

-------------
Benoit Boulinguiez
Ph.D
Ecole de Chimie de Rennes (ENSCR) Bureau 1.20
Equipe CIP UMR CNRS 6226 "Sciences Chimiques de Rennes"
Campus de Beaulieu, 263 Avenue du Général Leclerc
35700 Rennes, France
Tel 33 (0)2 23 23 80 83
Fax 33 (0)2 23 23 81 20
http://www.ensc-rennes.fr/ 

 

	[[alternative HTML version deleted]]



------------------------------

Message: 95
Date: Tue, 30 Sep 2008 01:18:22 -0700 (PDT)
From: quant15 <alexandre.bombal at bnpparibas.com>
Subject: [R]  Desperatly seeking Parallel R simulation with Windows XP
To: r-help at r-project.org
Message-ID: <19737748.post at talk.nabble.com>
Content-Type: text/plain; charset=us-ascii


Hello R experts,

I've been searching for weeks a way to use my quad core xeon to increase
speed of a very-very computer-intensive simulation I must do for my works.

It seems that most purpose-made packages for R : Snow, Rmpi, snowfall,...
are designed for Linux based OS. I do not have access to Linux due to
professionnal reasons ... so I must work with windows XP.

Do somebody know a way to unleash the calculation power of all four cores
under windows XP ? 

Thanks for your help !!

Quant15
-- 
View this message in context: http://www.nabble.com/Desperatly-seeking-Parallel-R-simulation-with-Windows-XP-tp19737748p19737748.html
Sent from the R help mailing list archive at Nabble.com.



------------------------------

Message: 96
Date: Tue, 30 Sep 2008 15:38:43 +1000
From: "Elena Wilson" <wilson_family at optusnet.com.au>
Subject: [R] calculating weighted correlation coefficients
To: <r-help at R-project.org>
Message-ID: <4052E585F7F8457ABC1B784A0C5B267C at ITAdminPC>
Content-Type: text/plain

Dear Help, 

 

I'm trying to calculate a weighted correlation matrix from a data frame with
6 columns (variables) and 297 observations extracted from the regression.
The last column is a weight column which I want to apply.

 

$ model        :'data.frame':  297 obs. of  6 variables:

  ..$ VAR1   : num [1:297] 5.21 9.82 8.08 0.33 8.7 6.82 3.94 4 0 5 ...

  ..$ VAR2   : num [1:297] 7.82 9.79 8.5 5.59 7.82 7.13 5.59 7 0 5 ...

  ..$ VAR3   : num [1:297] 8.07 9.82 8.07 5.19 8.69 7.45 6.08 5 0 8 ...

  ..$ VAR4   : num [1:297] 6.66 9.81 8.62 4.97 8.62 5.9 5.9 0 0 6 ...

  ..$ VAR5  : num [1:297] 4.79 9.8 7.9 0.27 7.9 5.76 3.44 5 0 4 ...

  ..$ (weights): num [1:297] 1.01e-05 4.05e-01 1.24e-02 2.68e-05 3.02e-01
...

 

I use cov.wt() function (as this is the only function I could find to
calculate weighted correlations). If I use it without weight, it works OK:

 

> cov.wt(y$model[1:5],cor=TRUE)

$cov

          VAR1   VAR2   VAR3   VAR4  VAR5

VAR1  7.250067 5.558081 5.342363 5.771774 6.049620

VAR2  5.558081 8.079245 6.616040 6.552380 5.122272

VAR3  5.342363 6.616040 7.985783 6.447208 4.867224

VAR4  5.771774 6.552380 6.447208 8.610053 5.077627

VAR5 6.049620 5.122272 4.867224 5.077627 6.717658

 

$center

  VAR1   VAR2   VAR3   VAR4  VAR5 

4.574175 4.450438 5.250236 4.439731 4.635421 

 

$n.obs

[1] 297

 

$cor

           VAR1    VAR2    VAR3    VAR4   VAR5

VAR1  1.0000000 0.7262204 0.7021075 0.7305256 0.8668584

VAR2  0.7262204 1.0000000 0.8236714 0.7856168 0.6952937

VAR3  0.7021075 0.8236714 1.0000000 0.7775173 0.6645285

VAR4  0.7305256 0.7856168 0.7775173 1.0000000 0.6676501

VAR5 0.8668584 0.6952937 0.6645285 0.6676501 1.0000000

 

If I try to apply weight, it doesn't work and gives me an error message:

 

> cov.wt(y$model[1:5],wt=y$model[6],cor=TRUE)

Error in cov.wt(y$model[1:5], wt = y$model[6], cor = TRUE) : 

  length of 'wt' must equal the number of rows in 'x'

 

The length of the weight variable is the same as for the other variables.
What do I do wrong? 

 

Thanks in advance, 

Lena


	[[alternative HTML version deleted]]



------------------------------

Message: 97
Date: Tue, 30 Sep 2008 10:55:38 +0200
From: "Rainer M Krug" <r.m.krug at gmail.com>
Subject: Re: [R] Desperatly seeking Parallel R simulation with Windows
	XP
To: quant15 <alexandre.bombal at bnpparibas.com>
Cc: r-help at r-project.org
Message-ID:
	<fb7c7e870809300155k4532f6d0i6e7f4b13ce59f100 at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

On Tue, Sep 30, 2008 at 10:18 AM, quant15
<alexandre.bombal at bnpparibas.com> wrote:
>
> Hello R experts,
>
> I've been searching for weeks a way to use my quad core xeon to increase
> speed of a very-very computer-intensive simulation I must do for my works.
>
> It seems that most purpose-made packages for R : Snow, Rmpi, snowfall,...
> are designed for Linux based OS. I do not have access to Linux due to
> professionnal reasons ... so I must work with windows XP.
>
> Do somebody know a way to unleash the calculation power of all four cores
> under windows XP ?

Just tried snow under Windows 2000 and it works. Just follow the
examples on http://www.sfu.ca/~sblay/R/snow.html
but create a cluster as follow:

cl <- makeSOCKcluster(c("localhost", "localhost", "localhost", "localhost"))

and you have a cluster of all your four cores.

As I don't have a dual or quadcore running windows, I can't confirm
that it is actually using all cores (it does under Linux), but the
cluster is created.

If you have further questions, just ask - I am learning tio use snow as well.

Rainer



>
> Thanks for your help !!
>
> Quant15
> --
> View this message in context: http://www.nabble.com/Desperatly-seeking-Parallel-R-simulation-with-Windows-XP-tp19737748p19737748.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at 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.
>



-- 
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
Biology, UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Faculty of Science
Natural Sciences Building
Private Bag X1
University of Stellenbosch
Matieland 7602
South Africa



------------------------------

Message: 98
Date: Tue, 30 Sep 2008 11:03:20 +0200
From: Eik Vettorazzi <E.Vettorazzi at uke.uni-hamburg.de>
Subject: Re: [R] par() default values
To: Benoit Boulinguiez <benoit.boulinguiez at ensc-rennes.fr>
Cc: r-help at r-project.org
Message-ID: <48E1EB58.9040200 at uke.uni-hamburg.de>
Content-Type: text/plain; charset=ISO-8859-15; format=flowed

How about reading the help file of "par"?
The first example exactly demonstrates what you want to do.

hth.

Benoit Boulinguiez schrieb:
> Hi all,
>  
> Is that possible to get back to the par() default values easily?
> I played a bit with par()
>  
>
> Regards/Cordialement
>
> -------------
> Benoit Boulinguiez
> Ph.D
> Ecole de Chimie de Rennes (ENSCR) Bureau 1.20
> Equipe CIP UMR CNRS 6226 "Sciences Chimiques de Rennes"
> Campus de Beaulieu, 263 Avenue du G?n?ral Leclerc
> 35700 Rennes, France
> Tel 33 (0)2 23 23 80 83
> Fax 33 (0)2 23 23 81 20
> http://www.ensc-rennes.fr/ 
>
>  
>
> 	[[alternative HTML version deleted]]
>
>   
> ------------------------------------------------------------------------
>
> ______________________________________________
> R-help at 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.
>   

-- 
Eik Vettorazzi
Institut f?r Medizinische Biometrie und Epidemiologie
Universit?tsklinikum Hamburg-Eppendorf

Martinistr. 52
20246 Hamburg

T ++49/40/42803-8243
F ++49/40/42803-7790



------------------------------

Message: 99
Date: Tue, 30 Sep 2008 10:07:16 +0100
From: tolga.i.uzuner at jpmorgan.com
Subject: [R] rpvm for windows anyone ?
To: r-help at r-project.org
Message-ID:
	<OF17B55F4E.C5AA0B61-ON802574D4.00320A0F-802574D4.00321A9E at jpmchase.com>
	
Content-Type: text/plain

Dear R Users,

Is there a version of rpvm available for windows ? I have recently had 
some problems with snow using SOCKS and was considering PVM as an 
alternative.

Thanks in advance,
Tolga


Generally, this communication is for informational purposes only
and it is not intended as an offer or solicitation for the purchase
or sale of any financial instrument or as an official confirmation
of any transaction. In the event you are receiving the offering
materials attached below related to your interest in hedge funds or
private equity, this communication may be intended as an offer or
solicitation for the purchase or sale of such fund(s).  All market
prices, data and other information are not warranted as to
completeness or accuracy and are subject to change without notice.
Any comments or statements made herein do not necessarily reflect
those of JPMorgan Chase & Co., its subsidiaries and affiliates.

This transmission may contain information that is privileged,
confidential, legally privileged, and/or exempt from disclosure
under applicable law. If you are not the intended recipient, you
are hereby notified that any disclosure, copying, distribution, or
use of the information contained herein (including any reliance
thereon) is STRICTLY PROHIBITED. Although this transmission and any
attachments are believed to be free of any virus or other defect
that might affect any computer system into which it is received and
opened, it is the responsibility of the recipient to ensure that it
is virus free and no responsibility is accepted by JPMorgan Chase &
Co., its subsidiaries and affiliates, as applicable, for any loss
or damage arising in any way from its use. If you received this
transmission in error, please immediately contact the sender and
destroy the material in its entirety, whether in electronic or hard
copy format. Thank you.
Please refer to http://www.jpmorgan.com/pages/disclosures for
disclosures relating to UK legal entities.
	[[alternative HTML version deleted]]



------------------------------

Message: 100
Date: Tue, 30 Sep 2008 11:22:30 +0200
From: "Hoeks, Luis" <Luis.Hoeks at tedrive.com>
Subject: [R] Weibull Verteilung
To: <r-help at r-project.org>
Message-ID:
	<A5722AA0260E414D945649DED23EDF8E01B41DB1 at TDASN140.tedrive.org>
Content-Type: text/plain

Hallo r-Projekt Team,

ich bin Anfänger in R und könnte ein wenig Hilfe gebrauchen. Ich möchte eine Weibullverteilung (Weibullgerade und Genauigkeitskurven) berechnen und plotten. Außerdem benötige ich den Formfaktor, den Skalierungsfaktor und Werte wie B5, B10, B50, B90, B95. In der Regel habe ich 6-20 Datenpunkte, z.B. aus Bruchlastversuchen. Ich kann mir Vorstellen, dass es dafür schon fertige Scripte oder How-Tos existieren, habe aber beim googeln nichts gefunden.

Wäre nett, wenn mir jemand hier einen Anstoß geben könnte.

Gruß

Luis

 


	[[alternative HTML version deleted]]



------------------------------

Message: 101
Date: Tue, 30 Sep 2008 11:33:24 +0200
From: "Tsjerk Wassenaar" <tsjerkw at gmail.com>
Subject: Re: [R] Weibull Verteilung
To: R-help <r-help at stat.math.ethz.ch>, "Hoeks, Luis"
	<Luis.Hoeks at tedrive.com>
Message-ID:
	<8ff898150809300233oe9b61f1v4c25bc73d55998a9 at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

Beste Luis,

Ten eerste wil ik graag meedelen dat het aanbeveling verdient als
iedereen zich bedient van een gezamenlijke taal (Gesamtsprache)
wanneer het internationale communicatie betreft. Hoewel de taal van
voorkeur uiteraard discutabel is, schijnt er toch redelijke consensus
te zijn dat heden ten dage de taal van voorkeur Engels dient te zijn.
Dit heeft als voordeel dat er meer mensen de mogelijkheid hebben de
vraag te begrijpen en een antwoord te geven, zodat je sneller, meer en
waarschijnlijk betere feedback krijgt.

Maar in dit geval is het met name ook zaak zelf de help te raadplegen,
hetgeen gedaan kan worden met:

help.search("weibull")
apropos("weibull")

To all others, I do apologize for replying in Dutch... :) Fortunately,
the commands are unambiguous.

Tsjerk


2008/9/30 Hoeks, Luis <Luis.Hoeks at tedrive.com>:
> Hallo r-Projekt Team,
>
> ich bin Anf?nger in R und k?nnte ein wenig Hilfe gebrauchen. Ich m?chte eine Weibullverteilung (Weibullgerade und Genauigkeitskurven) berechnen und plotten. Au?erdem ben?tige ich den Formfaktor, den Skalierungsfaktor und Werte wie B5, B10, B50, B90, B95. In der Regel habe ich 6-20 Datenpunkte, z.B. aus Bruchlastversuchen. Ich kann mir Vorstellen, dass es daf?r schon fertige Scripte oder How-Tos existieren, habe aber beim googeln nichts gefunden.
>
> W?re nett, wenn mir jemand hier einen Ansto? geben k?nnte.
>
> Gru?
>
> Luis
>
>
>
>
>        [[alternative HTML version deleted]]
>
>
> ______________________________________________
> R-help at 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.
>
>



-- 
Tsjerk A. Wassenaar, Ph.D.
Junior UD (post-doc)
Biomolecular NMR, Bijvoet Center
Utrecht University
Padualaan 8
3584 CH Utrecht
The Netherlands
P: +31-30-2539931
F: +31-30-2537623



------------------------------

_______________________________________________
R-help at 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.

End of R-help Digest, Vol 67, Issue 31
**************************************


More information about the R-help mailing list