[R] adding a hex sticker to a package

2019-01-21 Thread Therneau, Terry M., Ph.D. via R-help
I've created a hex sticker for survival.  How should that be added to the package directory?   It's temporarily in man/figures on the github page. Terry T. (Actually, the idea was from Ryan Lennon. I liked it, and we found someone with actual graphical skills to execute it. ) [[alter

[R] temporary clipping

2020-10-26 Thread Therneau, Terry M., Ph.D. via R-help
In one of my plot functions it is convenient to use clipping to restrict the range of some output. But at the end of the function I'd like to turn it off, i.e., so that a subsequent use of legend(), text() or whatever is not affected. I don't quite see how to do this -- it seems that the only w

Re: [R] "exact" p-values

2021-03-20 Thread Therneau, Terry M., Ph.D. via R-help
I am late to this discussion -- I read R-help as a once-a-day summary.  A few comments. 1. In the gene-discovery subfield of statistics (SNP studies, etc.)  there is a huge multiple-testing problem.  In defense, the field thinks in terms of thresholds like 1e-5 or 1e-10 rather than the .05 or

Re: [R] evil attributes

2021-04-11 Thread Therneau, Terry M., Ph.D. via R-help
I wrote: "I confess to being puzzled WHY the R core has decided on this definition..." After just a little more thought let me answer my own question. a. The as.vector() function is designed to strip off everything extraneous and leave just the core.   (I have a mental image of Jack Webb saying

[R] inverse of the methods function

2021-05-03 Thread Therneau, Terry M., Ph.D. via R-help
Is there a complement to the methods function, that will list all the defined methods for a class?    One solution is to look directly at the NAMESPACE file, for the package that defines it, and parse out the entries.   I was looking for something built-in, i.e., easier. -- Terry M Therneau

Re: [R] syvcoxph and cox.zph for testing the PH assumption

2021-07-12 Thread Therneau, Terry M., Ph.D. via R-help
On 7/11/21 5:00 AM, r-help-requ...@r-project.org wrote: Hello, is it kosher to call cox.zph on a syvcoxph model fit? I see that someone proposed a modified version of cox.zph that uses resid(fit, 'schoenfeld', **weighted=TRUE**). https://stats.stackexchange.com/questions/265307/assessing-prop

Re: [R] coxph means not equal to means of model matrix

2021-09-03 Thread Therneau, Terry M., Ph.D. via R-help
See ?coxph, in particular the new "nocenter" option. Basically, the "mean" component is used to center later computations.� This can be critical for continuous variables, avoiding overflow in the exp function, but is not necessary for 0/1 covariates.�� The fact that the default survival curve

Re: [R] coxph means not equal to means of model matrix

2021-09-03 Thread Therneau, Terry M., Ph.D. via R-help
On 9/3/21 12:59 PM, Bond, Stephen wrote: > > I looked at the nocenter and it says (-1,0,1) values but it seems that any > three-level > factor is included in that (represented as 1,2,3 in R) . > A factor is turned into a set of 0/1 dummy variable, so the nocenter applies.� I will add more cla

Re: [R] how to find "first" or "last" record after sort in R

2021-09-10 Thread Therneau, Terry M., Ph.D. via R-help
I prefer the duplicated() function, since the final code will be clear to a future reader. (Particularly when I am that future reader). last <- !duplicated(mydata$ID, fromLast=TRUE) # point to the last ID for each subject mydata$data3[last] <- NA Terry T. (I read the list once a day in dige

[R] extract from a list of lists

2022-12-27 Thread Therneau, Terry M., Ph.D. via R-help
I not uncommonly have the following paradym    fits <- lapply(argument, function) resulting in a list of function results.   Often, the outer call is to mclapply, and the function encodes some long calculation, e.g. multiple chains in an MCMC. Assume for illustration that each function returns

[R] MCMC tools

2022-12-27 Thread Therneau, Terry M., Ph.D. via R-help
Is there a convenient package that computes standard covergence summaries for and MCMC run?    This is something that I likely knew once and have now forgotton.  More detail:  I'm trying to understand the MCMC done by a particular model called Subtype and Stage Inference (SuStaIn), suffice it

Re: [R] extract from a list of lists

2022-12-27 Thread Therneau, Terry M., Ph.D. via R-help
quot;function" is a string or integer, then it >> is taken as the piece to be extracted, so you should be able to do >> something like: >> >> library(purrr) >> map(fits, 'iter') >> # or >> map_int(fits, 'iter') >> # or >> m

Re: [R] Trying to understand the magic of lm (Still trying)

2019-05-13 Thread Therneau, Terry M., Ph.D. via R-help
John,  The text below is cut out of a "how to write a package" course I gave at the R conference in Vanderbilt.   I need to find a home for the course notes, because it had a lot of tidbits that are not well explained in the R documentation. Terry T. Model frames: One of the first task

Re: [R] conflicting results for a time-varying coefficient in a Cox model

2019-08-08 Thread Therneau, Terry M., Ph.D. via R-help
This is an excellent question. The answer, in this particular case, mostly has to do with the outlier time values.  (I've never been convinced that the death at time 999 isn't really a misplaced code for "missing", actually).    If you change the knots used by the spline you can get quite dif

Re: [R] "chi-square" | "chi-squared" | "chi squared" | "chi, square"

2019-10-19 Thread Therneau, Terry M., Ph.D. via R-help
Martin,   A fun question. Looking back at my oldest books, Feller (1950) used chi-square. Then I walked down the hall to our little statistics library and looked at Johnson and Kotz, "Continous Univariate Distributions", since each chapter therein has comments about the history of the distrib

[R] X11 font

2023-08-16 Thread Therneau, Terry M., Ph.D. via R-help
I get the following error out of R, on a newer Ubuntu installation. Error in `axis()`: ! X11 font -adobe-helvetica-%s-%s-*-*-%d-*-*-*-*-*-*-*, face 1 at size 12 could not be loaded Backtrace:  1. graphics::matplot(...)  3. graphics::plot.default(...)  4. graphics (local) localAxis(...)  6. gr