Hi there

does anybody know if the p-values in coxme are given one- or two-tailed by default?

Thank you
David


-----Messaggio originale-----
Da: r-help-bounces@r-project.org per conto di r-help-request@r-project.org
Inviato: gio 06/06/2013 11.00
A: r-help@r-project.org
Oggetto: R-help Digest, Vol 124, Issue 7
 
Send R-help mailing list submissions to
	r-help@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@r-project.org

You can reach the person managing the list at
	r-help-owner@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: How to display multiples lines with different color on
      the same plot? (Rui Barradas)
   2. Re: Post hoc power analysis for mixed-effects models
      (David Winsemius)
   3. Re: how to compute maximum of fitted polynomial? (David Winsemius)
   4. Re: how to compute maximum of fitted polynomial? (Hans W Borchers)
   5. Re: How to display multiples lines with different color on
      the	same plot? (David Winsemius)
   6. Re: read.csv and write.csv filtering for very big data ?
      (Duncan Murdoch)
   7. Re: Survival aareg problem (Terry Therneau)
   8. Re: Post hoc power analysis for mixed-effects models (Ben Bolker)
   9. SPlus script (Scott Raynaud)
  10. Re: dates and time series management (arun)
  11. Re: Loop FOR with histogram()  from lattice (Jeff Newmiller)
  12. Re: Lattice, ggplot, and pointsize (Deepayan Sarkar)
  13. Re: how to compute maximum of fitted polynomial? (Joseph Clark)
  14. Re: How to write a loop in R to select multiple regression
      model and validate it ? (beginner)
  15. Coefficients paths - comparison of ridge, lasso and elastic
      net regression (beginner)
  16. sample {base} (Xochitl CORMON)
  17. Re: split and common variables (Nico Met)
  18. Re: Trying to build up functions with its names by means of
      lapply (Julio Sergio)
  19. Re: read.csv and write.csv filtering for very big data ?
      (Duncan Murdoch)
  20. reshape2 issue (Neotropical bat risk assessments)
  21. Re: sample {base} (Sarah Goslee)
  22. Re: sample {base} (David Carlson)
  23. Re: SPlus script (Pascal Oettli)
  24. Re: reshape2 issue (Pascal Oettli)
  25. Re: split and common variables (arun)
  26. Re: sample {base} (Xochitl CORMON)
  27. reshape2 issue continued (Neotropical bat risk assessments)
  28. Re: dates and time series management (arun)
  29. Re: split and common variables (David Carlson)
  30. Re: reshape2 issue continued (Thomas Adams)
  31. Re: reshape2 issue continued (Ista Zahn)
  32. Re: Trying to build up functions with its names by means of
      lapply (Bert Gunter)
  33. Re: plyr _aply simplifying return-value dimensions (Adams, Jean)
  34. Re: sample {base} (arun)
  35. Re: SPlus script (Scott Raynaud)
  36. Re: reshape2 issue continued (John Kane)
  37. Re: SPlus script (peter dalgaard)
  38. Re: SPlus script (William Dunlap)
  39. reshape2 issue solved Tnx! (Neotropical bat risk assessments)
  40. Re: How to display multiples lines with different color on
      the same plot? (John Kane)
  41. Re: reshape2 issue solved Tnx! (John Kane)
  42. Re: Trying to build up functions with its names by means of
      lapply (Julio Sergio)
  43. Re: Trying to build up functions with its names by means	of
      lapply (William Dunlap)
  44. Re: Lattice, ggplot, and pointsize (Milan Bouchet-Valat)
  45. Re: SPlus script (Scott Raynaud)
  46. Re: Trying to build up functions with its names by means	of
      lapply (Julio Sergio)
  47. Re: probability weights in multilevel models (Thomas Lumley)
  48. Re: Trying to build up functions with its names by	means	of
      lapply (William Dunlap)
  49. multilevel binary and ordered regression models (Xu Jun)
  50. Re: dates and time series management (arun)
  51. rJava is not loading (Dimitri Liakhovitski)
  52. Map Antarctica (ejb)
  53. List into table (Andtrei89)
  54. sandwich matrix in gamm (Isabel Proen?a)
  55.  R error- "more columns than column names" (Sandro Magalh?es)
  56. Subsetting out missing values for a certain variable
      (Daniel Tucker)
  57. Re: Subsetting out missing values for a certain variable
      (Daniel Tucker)
  58. Re: Subsetting out missing values for a certain variable
      (Daniel Tucker)
  59. Re: read.csv and write.csv filtering for very big data ?
      (ivo welch)
  60. reshape2 issue (Bruce Miller)
  61. Re: installing package 'rqpd' (Regression quantiles for panel
      data) (Manish K. Srivastava)
  62. Temporally autocorrelated Poisson data (Ali Swanson)
  63. Error in anova.cca by="axis" after Vegan update
      (Edwards, Danielle)
  64. combining two different matrizes (ThomasH)
  65. Re: Subsetting out missing values for a certain variable
      (Jorge I Velez)
  66. Re: Map Antarctica (Michael Sumner)
  67. Re: Map Antarctica (Pascal Oettli)
  68. Re: SPlus script (Duncan Mackay)
  69. lme function cannot find object (Pfeiffer, Steven)
  70. Re: dates and time series management (arun)
  71. Re: Trying to build up functions with its names by means of
      lapply (Bert Gunter)
  72. multivariate multilevel model (Patty Haaem)
  73. highlighted a certain time period on multiple plots (Ye Lin)
  74. Re: rJava is not loading (Prof Brian Ripley)
  75. Re: multivariate multilevel model (Jose Iparraguirre)
  76. Re: Send Mail R and Socket Connections (Uwe Ligges)


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

Message: 1
Date: Wed, 05 Jun 2013 11:01:43 +0100
From: Rui Barradas <ruipbarradas@sapo.pt>
To: "Kaptue Tchuente, Armel" <armel.kaptue@sdstate.edu>
Cc: "r-help@r-project.org" <r-help@r-project.org>
Subject: Re: [R] How to display multiples lines with different color
	on the same plot?
Message-ID: <51AF0C87.80107@sapo.pt>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Hello,

See the help pages for

?abline
?par  # parameter 'col'

Hope this helps,

Rui Barradas

Em 04-06-2013 22:05, Kaptue Tchuente, Armel escreveu:
> Hi all,
>
> I'm struggling with the display of several regression lines (with different colors) on the same plot.
>
> I manually drew what I'm trying to do with 8 lines (see attached).
>
> Any thoughts for a code will be very much appreciated.
>
> Thanks
>
> Armel
>
>
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



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

Message: 2
Date: Wed, 5 Jun 2013 05:10:45 -0600
From: David Winsemius <dwinsemius@comcast.net>
To: Kota Hattori <kota.hattori@canterbury.ac.nz>
Cc: r-help@r-project.org
Subject: Re: [R] Post hoc power analysis for mixed-effects models
Message-ID: <C1688010-B655-493F-8D5F-B6F5F47C07C8@comcast.net>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes


On Jun 4, 2013, at 4:46 PM, Kota Hattori wrote:

> Dear all,
>
> I have been searching ways to run power analysis for mixed-effects  
> models. However, I have not been successful
> in the research. Today I would like to ask your help. As long as I  
> see from my search, Martin Julien wrote a package
> called pamm for the power analysis. One of the limitations in the  
> current version is that pamm cannot handle
> categorical fixed variables. Todd Jobes introduced his script to run  
> power analysis for mixed-effects models
> (http://toddjobe.blogspot.co.nz/2009/09/power-analysis-for-mixed-effect-models.html 
> ). However, some parts of
> the script is beyond my knowledge. I am not sure if I can run power  
> analysis with categorical variables either. Is there
> anybody who has run post hoc power analysis for mixed-effects  
> models? If you have experiences, I would like to
> ask your help. Thank you very much for taking your time.

Can you provide a sensible justification for "post hoc power analysis?  
I know the terminology has crept into widespread use due to its  
existence in either SAS or SPSS (I forget which), but I have doubts  
about its validity. It mixes up the order of statistical testing  
logic. Power analysis is something done _before_ the study. If a  
statistical procedure is done after a study's data is collected with  
the very dubious assumption that the sample statistics are the  
population statistics, it's not a power analysis.

-- 
David Winsemius, MD
Alameda, CA, USA



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

Message: 3
Date: Wed, 5 Jun 2013 05:32:03 -0600
From: David Winsemius <dwinsemius@comcast.net>
To: Hans W Borchers <hwborchers@googlemail.com>
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] how to compute maximum of fitted polynomial?
Message-ID: <38595B76-E9C2-4596-B41F-C4FB84575FAD@comcast.net>
Content-Type: text/plain; charset="US-ASCII"; format=flowed; delsp=yes


On Jun 4, 2013, at 10:15 PM, Hans W Borchers wrote:

> Bert Gunter <gunter.berton <at> gene.com> writes:
>>
>> 1. This looks like a homework question. We should not do homework  
>> here.
>> 2. optim() will only approximate the max.
>> 3. optim() is not the right numerical tool for this anyway.  
>> optimize() is.
>> 4. There is never a guarantee numerical methods will find the max.
>> 5. This can (and should?) be done exactly using elementary math  
>> rather
>> than numerical methods.
>>
>> Cheers,
>> Bert
>
> In the case of polynomials, "elementary math ... methods" can  
> actually be
> executed with R:
>
>    library(polynomial)                 # -6 + 11*x - 6*x^2 + x^3
>    p0 <- polynomial(c(-6, 11, -6, 1))  # has zeros at 1, 2, and 3
>    p1 <- deriv(p0); p2 <- deriv(p1)    # first and second derivative
>    xm <- solve(p1)                     # maxima and minima of p0
>    xmax = xm[predict(p2, xm) < 0]      # select the maxima
>    xmax                                # [1] 1.42265
>
> Obviously, the same procedure will work for polynomials p0 of higher  
> orders.

These look like the functions present in the 'polynom' package  
authored by Bill Venables [aut] (S original), Kurt Hornik [aut, cre]  
(R port), Martin Maechler. I wasn't able to find a 'polynomial'  
package on CRAN. The 'mpoly' package by David Kahle offers  
multivariate symbolic operations as well.

-- 
David.

>
> Hans Werner
>
>
>>> Em 04-06-2013 21:32, Joseph Clark escreveu:
>>>>
>>>> My script fits a third-order polynomial to my data with something  
>>>> like
>>>> this:
>>>>
>>>> model <- lm( y ~ poly(x, 3) )
>>>>
>>>> What I'd like to do is find the theoretical maximum of the  
>>>> polynomial
>>>> (i.e. the x at which "model" predicts the highest y).   
>>>> Specifically, I'd
>>>> like to predict the maximum between 0 <= x <= 1.
>>>>
>>>> What's the best way to accomplish that in R?
>>>>
>>>> Bonus question: can R give me the derivative or 2nd derivative of  
>>>> the
>>>> polynomial?  I'd like to be able to compute these at that maximum  
>>>> point.
>>>>
>>>> Thanks in advance!

--

David Winsemius, MD
Alameda, CA, USA



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

Message: 4
Date: Wed, 5 Jun 2013 11:41:53 +0000
From: Hans W Borchers <hwborchers@googlemail.com>
To: <r-help@stat.math.ethz.ch>
Subject: Re: [R] how to compute maximum of fitted polynomial?
Message-ID: <loom.20130605T133634-68@post.gmane.org>
Content-Type: text/plain; charset="us-ascii"

David Winsemius <dwinsemius <at> comcast.net> writes:

> [...]
> 
> On Jun 4, 2013, at 10:15 PM, Hans W Borchers wrote:
> 
> > In the case of polynomials, "elementary math ... methods" can  
> > actually be
> > executed with R:

    library(polynomial)                 # -6 + 11*x - 6*x^2 + x^3
    p0 <- polynomial(c(-6, 11, -6, 1))  # has zeros at 1, 2, and 3
    p1 <- deriv(p0); p2 <- deriv(p1)    # first and second derivative
    xm <- solve(p1)                     # maxima and minima of p0
    xmax = xm[predict(p2, xm) < 0]      # select the maxima
    xmax                                # [1] 1.42265

> These look like the functions present in the 'polynom' package  
> authored by Bill Venables [aut] (S original), Kurt Hornik [aut, cre]  
> (R port), Martin Maechler. I wasn't able to find a 'polynomial'  
> package on CRAN. The 'mpoly' package by David Kahle offers  
> multivariate symbolic operations as well.
> 

Sorry, yes of course, it should be `library(polynom)`.
Somehow I'm making this mistake again and again.
And one has to be a bit careful about complex roots.


Hans Werner



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

Message: 5
Date: Wed, 5 Jun 2013 05:53:23 -0600
From: David Winsemius <dwinsemius@comcast.net>
To: "Kaptue Tchuente, Armel" <armel.kaptue@sdstate.edu>
Cc: "r-help@r-project.org" <r-help@r-project.org>
Subject: Re: [R] How to display multiples lines with different color
	on the	same plot?
Message-ID: <1984C4B9-CF64-4E4F-A126-25F35212C3B1@comcast.net>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes


On Jun 4, 2013, at 3:05 PM, Kaptue Tchuente, Armel wrote:

> Hi all,
>
> I'm struggling with the display of several regression lines (with  
> different colors) on the same plot.
>
> I manually drew what I'm trying to do with 8 lines (see attached).

If you want lines that only span a portion of a plot area, then you  
should be looking at the segments function.

-- 

David Winsemius, MD
Alameda, CA, USA



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

Message: 6
Date: Wed, 5 Jun 2013 08:06:36 -0400
From: Duncan Murdoch <murdoch.duncan@gmail.com>
To: ivo welch <ivo.welch@gmail.com>
Cc: r-help <r-help@stat.math.ethz.ch>
Subject: Re: [R] read.csv and write.csv filtering for very big data ?
Message-ID: <51AF29CC.2010807@gmail.com>
Content-Type: text/plain; charset="ISO-8859-1"; format=flowed

On 13-06-05 12:08 AM, ivo welch wrote:
> thx, greg.
>
> chunk boundaries have meanings.  the reader needs to stop, and buffer one
> line when it has crossed to the first line beyond the boundary.  it is also
> problem that read.csv no longer works with files---readLines then has to do
> the processing.  (starting read.csv over and over again with different
> skip.lines is probably not a good idea for big files.)  it needs a lot of
> smarts to intelligently append to a data frame.  (if the input is a data
> matrix, this is much simpler, of course.)

As Greg said, you don't need to use skip.lines:  just don't close the 
file, and continue reading from where you stopped on the previous run.

If you don't know the size of blocks in advance this is harder, but it's 
not really all that hard.  The logic would be something like this:

open the file
read the first block including the header
while not done:
    if you have a complete block with some extra lines at the end,
    extract them and save them, then process the complete block.
    Initialize the next block with the extra lines.

    if the block is incomplete, read some more and append it
    to what you saved.
end while
close the file

Duncan Murdoch

>
> exporting large input files to sqlite data bases makes sense when the same
> file is used again and again, but probably not when it is a staged one-time
> processor.  the disk consumption is too big.
>
> the writer could become quasi-threaded by writing to multiple temp files
> and then concatenating at the end, but this would be a nasty
> solution...nothing like the parsimonious elegance and generality that a
> built-in R filter function could provide.
>
> ----
> Ivo Welch (ivo.welch@gmail.com)
>
>
>
> On Tue, Jun 4, 2013 at 2:56 PM, Greg Snow <538280@gmail.com> wrote:
>
>> Some possibilities using existing tools.
>>
>> If you create a file connection and open it before reading from it (or
>> writing to it), then functions like read.table and read.csv ( and
>> write.table for a writable connection) will read from the connection, but
>> not close and reset it.  This means that you could open 2 files, one for
>> reading and one for writing, then read in a chunk, process it, write it
>> out, then read in the next chunk, etc.
>>
>> Another option would be to read the data into an ff object (ff package) or
>> into a database (SQLite for one) which could have the data accessed in
>> chunks, possibly even in parallel.
>>
>>
>> On Mon, Jun 3, 2013 at 4:59 PM, ivo welch <ivo.welch@anderson.ucla.edu>wrote:
>>
>>> dear R wizards---
>>>
>>> I presume this is a common problem, so I thought I would ask whether
>>> this solution already exists and if not, suggest it.  say, a user has
>>> a data set of x GB, where x is very big---say, greater than RAM.
>>> fortunately, data often come sequentially in groups, and there is a
>>> need to process contiguous subsets of them and write the results to a
>>> new file.  read.csv and write.csv only work on FULL data sets.
>>> read.csv has the ability to skip n lines and read only m lines, but
>>> this can cross the subsets.  the useful solution here would be a
>>> "filter" function that understands about chunks:
>>>
>>>     filter.csv <- function( in.csv, out.csv, chunk, FUNprocess ) ...
>>>
>>> a chunk would not exactly be a factor, because normal R factors can be
>>> non-sequential in the data frame.  the filter.csv makes it very simple
>>> to work on large data sets...almost SAS simple:
>>>
>>>     filter.csv( pipe('bzcat infile.csv.bz2'), "results.csv", "date",
>>> function(d) colMeans(d))
>>> or
>>>     filter.csv( pipe('bzcat infile.csv.bz2'), pipe("bzip -c >
>>> results.csv.bz2"), "date", function(d) d[ unique(d$date), ] )  ##
>>> filter out obserations that have the same date again later
>>>
>>> or some reasonable variant of this.
>>>
>>> now that I can have many small chunks, it would be nice if this were
>>> threadsafe, so
>>>
>>>     mcfilter.csv <- function( in.csv, out.csv, chunk, FUNprocess ) ...
>>>
>>> with 'library(parallel)' could feed multiple cores the FUNprocess, and
>>> make sure that the processes don't step on one another.  (why did R
>>> not use a dot after "mc" for parallel lapply?)  presumably, to keep it
>>> simple, mcfilter.csv would keep a counter of read chunks and block
>>> write chinks until the next sequential chunk in order arrives.
>>>
>>> just a suggestion...
>>>
>>> /iaw
>>>
>>> ----
>>> Ivo Welch (ivo.welch@gmail.com)
>>>
>>> ______________________________________________
>>> R-help@r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide
>>> http://www.R-project.org/posting-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>>>
>>
>>
>>
>> --
>> Gregory (Greg) L. Snow Ph.D.
>> 538280@gmail.com
>>
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



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

Message: 7
Date: Wed, 05 Jun 2013 07:12:56 -0500
From: Terry Therneau <therneau@mayo.edu>
To: r-help@r-project.org, Troels Ring <tring@gvdnet.dk>
Subject: Re: [R] Surv

	[[alternative HTML version deleted]]

