Re: [R] syvcoxph and cox.zph for testing the PH assumption
Thank you, Terry. We look forward to hearing from you again. Youyi On Mon, Jul 12, 2021 at 3:13 PM Therneau, Terry M., Ph.D. wrote: > > > 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-proportional-hazards-assumption-of-a-cox-model-with-caseweights > > Is that all it takes? > > Thanks, > > Youyi > > The cox.zph function does a formal score test. No, it does not account > for robust > variance. I hadn't considered that case, but will now think about it. It > is quite easy > to show that there is a problem: just give everyone a weight of 100. > > The stackexchange conversation was new to me. The solution there won't > work with the > current code, which does not make use of resid(). It has been updated to > do the proper > score test, the older version of cox.zph, which they modified, used an > approximation. > > Terry T. > [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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] syvcoxph and cox.zph for testing the PH assumption
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-proportional-hazards-assumption-of-a-cox-model-with-caseweights Is that all it takes? Thanks, Youyi [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] .Call using multiple cores on linux after R 3.3.3
Thanks, Jeff! You are absolutely correct. We have OPENBLAS installed in our environment that causes this. One way to "fix" it is: library(RhpcBLASctl) blas_get_num_procs() blas_set_num_threads(1) stopifnot(blas_get_num_procs()==1) On Sat, Apr 20, 2019 at 9:06 AM Jeff Newmiller wrote: > My guess would be that you are running with a non-CRAN distribution of R > like Anaconda or MRAN that has MKL enabled? > > On April 19, 2019 10:25:57 AM PDT, Youyi Fong wrote: > >Hi, I am wondering why it is the case that in R 3.3.3, calling > >chngpt:chngptm uses only 1 core, but in later releases, e.g. R 3.4.3, > >it > >uses multiple cores on linux. The function chngpt:chngptm has a .Call > >to > >invoke a C/C++ function that performs bootstrapping. No explicit > >parallel > >computing instructions are used. > >Thanks, > >Youyi > > > > [[alternative HTML version deleted]] > > > >__ > >R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > >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. > > -- > Sent from my phone. Please excuse my brevity. > [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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] .Call using multiple cores on linux after R 3.3.3
Hi, I am wondering why it is the case that in R 3.3.3, calling chngpt:chngptm uses only 1 core, but in later releases, e.g. R 3.4.3, it uses multiple cores on linux. The function chngpt:chngptm has a .Call to invoke a C/C++ function that performs bootstrapping. No explicit parallel computing instructions are used. Thanks, Youyi [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] match.arg: how to prevent users from not specifying a value
Great. missing is what I was looking for, and it seems to also work with interfaces like f=function( type=c("A","B,"C"), ... ) { } Thanks! Youyi On Wed, Aug 19, 2015 at 9:35 AM, Bert Gunter wrote: > ... and you could also use missing() (?missing for details) if you > wanted to give the user more verbose instructions, e.g. > >f1 <- function(type, ...) { >if(missing(type)){ >cat("You must enter a 'type' argument that is one of etc\n") >return(invisible()) >} >match.arg(type, c("A", "B", "C")) >} > Bert Gunter > > "Data is not information. Information is not knowledge. And knowledge > is certainly not wisdom." >-- Clifford Stoll > > > On Wed, Aug 19, 2015 at 9:19 AM, William Dunlap wrote: >> If you want to force the user to enter the 'type' argument, >> move the vector of choices out of the argument list >> and into the call to match.arg(): >> >>f1 <- function(type, ...) { >>match.arg(type, c("A", "B", "C")) >>} >>f1() >>#Error in match.arg(type, c("A", "B", "C")) : >># argument "type" is missing, with no default >>f1("X") >>#Error in match.arg(type, c("A", "B", "C")) : >># 'arg' should be one of “A”, “B”, “C” >>f1("B") >>#[1] "B" >> >> >> Bill Dunlap >> TIBCO Software >> wdunlap tibco.com >> >> On Tue, Aug 18, 2015 at 5:42 PM, Youyi Fong wrote: >> >>> Hello, I have a function that looks like >>> >>> f=function( type=c("dummy,"A","B,"C"), ... ) { >>> type<-match.arg(type) >>> if (type=="dummy") stop("Please choose a type that is not dummy.") >>> ... >>> } >>> >>> I put a "dummy" in the list of choices as a mechanism to prevent users >>> from not specifying a value for "type" when calling the function. My >>> question is whether there is a better way to achieve it that does not >>> need "dummy". >>> >>> Thanks, >>> Youyi >>> >>> __ >>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >>> https://stat.ethz.ch/mailman/listinfo/r-help >>> PLEASE do read the posting guide >>> http://www.R-project.org/posting-guide.html >>> and provide commented, minimal, self-contained, reproducible code. >>> >> >> [[alternative HTML version deleted]] >> >> __ >> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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] match.arg: how to prevent users from not specifying a value
Hello, I have a function that looks like f=function( type=c("dummy,"A","B,"C"), ... ) { type<-match.arg(type) if (type=="dummy") stop("Please choose a type that is not dummy.") ... } I put a "dummy" in the list of choices as a mechanism to prevent users from not specifying a value for "type" when calling the function. My question is whether there is a better way to achieve it that does not need "dummy". Thanks, Youyi __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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] Weighted Kaplan-Meier estimates using survey::svykm and survival::survfit
Hello, is there a way to convert a svykm object returned by survey::svykm into a survfit object? The reason I am asking is that plot.survfit can plot different transformations of survival curves, a functionality that is currently not afforded by plot.svykm. Thanks! Youyi [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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] GLMM, ML, PQL, lmer
Dear R community, I have two questions regarding fitting GLMM using maximum likelihood method. The first one arises from trying repeat an analysis in the Breslow and Clayton 1993 JASA paper. Model 3 of the epileptic dataset has two random effects, one subject specific, and one observation specific. Thus if we count random effects, there are more parameters than observations. When I try to run the following code, I get an error saying: "Error in mer_finalize(ans) : q = 295 > n = 236". require (lme4) require (glmmAK) data(epilepticBC) dat = epilepticBC dat$rand=1:nrow(dat) dat$V4=dat$visit==4 formula1 = Seizure ~ Base + Trt + I(Trt*Base) + Age + V4 fit=lmer (update (formula1, .~. + (1|id) + (1|rand)), family=poisson, data=dat, nAGQ=1) Is it true that there is no way to fit such a model in an ML analysis? In other words, is there a way to approximate the likelihood of fixed effects and variance components without relying on estimates of random effects? The second question is that when it is possible to obtain MLE of a GLMM model, how can I obtain an estimated variance of the variance component estimates using lmer or other functions? Thank you very much for your help! Youyi Fong ----- Youyi Fong, Graduate Student, Department of Biostatistics University of Washington, Box 357232, Seattle, WA 98195 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Rprintf and "C stack usage is too close to the limit"
Hi, I would appreciate if someone could comment on this problem I am experiencing. I am writing a C++ program to be called from R. In this program, there is a verbose switch that decides whether to print some debugging info using Rprintf. On windows, things work ok. On linux, things are fine in non-verbose mode, but in verbose mode, I get error saying "C stack usage is too close to the limit" after a few lines are printed. Is Rprintf the right function to use for showing message on R console? If yes, what should I do about the error message? Thank you very much in advance! This problem has been bugging me for a few days now. Youyi -- Youyi Fong, Graduate Student, Department of Biostatistics University of Washington, Box 357232, Seattle, WA 98195 [[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.