[R] permutation test for Cox proportional hazards regression model
I would like to perform a permutation test for Cox proportional hazards regression model. I only find it for t-test and other tests (e.g. comparing two medians). Is there a way that I can perform a Cox PH model in R or SAS for the LR-test? I am doing the following B <- 1000; LRtestx <- rep(NA,B); Srv <- Surv(Time, Event); for(j in 1:B){ LRtestx[j] <- cph(Srv~sample(x,length(x),replace=F))$stat[3]}; LRtest <- cph(Srv~x)$stat[3]; sum(LRtestx > LRtest)/B Many thanks Linda [[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] AUC, C-index and p-value of Wilcoxon
Dear all, I am using the ROCR library to compute the AUC and also the Hmisc library to compute the C-index of a predictor and a group variable. The results of AUC and C-index are similar and give a value of about 0.57. The Wilcoxon p-value is 0.001! Why the AUC is showing small value and the p-value is high significant? The AUC is based on Wilcoxon calculation? Many thanks, Lina [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] stepwise selection cox model
Sorry, my question was: Are these two functions (Stata and fastbw (rule=p) R function) should give the same results to the same data? Maybe I need to run these two functions on more than one datasets to answer myself. Many thanks, Linda 2011/5/25 David Winsemius dwinsem...@comcast.net On May 25, 2011, at 12:11 PM, linda Porz wrote: Many thanks for your reply. I have run a stepwise selection in Stata and R using the function fastbw (rule=p) from Design package. Both functions give the same results. Is this because both functions do the same job or can it be that for different data one will have different results? I don't understand your question. Why would giving the same results be a concern? And why would one expect that with different data one would _not_ get different results? The point of the critique against stepwise procedures is that they assume too much determinism (i.e. that all of the internal structure of the small sample of data will be present in the wider universe) and that they generate too much confidence on the part of the unwary and insufficiently educated user. -- David. Many thanks, Linda 2011/5/25 Bert Gunter gunter.ber...@gene.com See the Vignette in the glmnet package for one alternative approach to variable selection. Of course, you need to gain some background to know what you're doing here. -- Bert On Wed, May 25, 2011 at 8:38 AM, Marc Schwartz marc_schwa...@me.com wrote: Hi, You are unlikely to find one, as fundamentally, stepwise procedures are a bad way to engage in covariate selection. Search the list archives at rseek.org using 'stepwise' as the keyword to see a plethora of discussion on this point. This is not a new issue BTW, as I happened to stumble upon this 1998 Stata FAQ recently during a related search: http://www.stata.com/support/faqs/stat/stepwise.html and there are more recent literature citations and books that reinforce those points. HTH, Marc Schwartz On May 25, 2011, at 4:28 AM, linda Porz wrote: Sorry, I have wrote a wrong subject in the first email! Regards, Linda -- Forwarded message -- From: linda Porz linda.p...@gmail.com Date: 2011/5/25 Subject: combined odds ratio To: r-help@r-project.org Cc: r-help-requ...@stat.math.ethz.ch Dear all, I am looking for an R function which does stepwise selection cox model in r (delta chisq likelihood ratio test) similar to the stepwise, pe (0.05) lr: stcox in STATA. I am very thankful for any reply. Regards, Linda __ 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. -- Men by nature long to get on to the ultimate truths, and will often be impatient with elementary studies or fight shy of them. If it were possible to reach the ultimate truths without the elementary studies usually prefixed to them, these would not be preparatory studies but superfluous diversions. -- Maimonides (1135-1204) Bert Gunter Genentech Nonclinical Biostatistics David Winsemius, MD West Hartford, CT [[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] combined odds ratio
Dear all, I am looking for an R function which does stepwise selection cox model in r (delta chisq likelihood ratio test) similar to the stepwise, pe (0.05) lr: stcox in STATA. I am very thankful for any reply. Regards, Linda [[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] stepwise selection cox model
Sorry, I have wrote a wrong subject in the first email! Regards, Linda -- Forwarded message -- From: linda Porz linda.p...@gmail.com Date: 2011/5/25 Subject: combined odds ratio To: r-help@r-project.org Cc: r-help-requ...@stat.math.ethz.ch Dear all, I am looking for an R function which does stepwise selection cox model in r (delta chisq likelihood ratio test) similar to the stepwise, pe (0.05) lr: stcox in STATA. I am very thankful for any reply. Regards, Linda [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] stepwise selection cox model
Many thanks for your reply. I have run a stepwise selection in Stata and R using the function fastbw (rule=p) from Design package. Both functions give the same results. Is this because both functions do the same job or can it be that for different data one will have different results? Many thanks, Linda 2011/5/25 Bert Gunter gunter.ber...@gene.com See the Vignette in the glmnet package for one alternative approach to variable selection. Of course, you need to gain some background to know what you're doing here. -- Bert On Wed, May 25, 2011 at 8:38 AM, Marc Schwartz marc_schwa...@me.com wrote: Hi, You are unlikely to find one, as fundamentally, stepwise procedures are a bad way to engage in covariate selection. Search the list archives at rseek.org using 'stepwise' as the keyword to see a plethora of discussion on this point. This is not a new issue BTW, as I happened to stumble upon this 1998 Stata FAQ recently during a related search: http://www.stata.com/support/faqs/stat/stepwise.html and there are more recent literature citations and books that reinforce those points. HTH, Marc Schwartz On May 25, 2011, at 4:28 AM, linda Porz wrote: Sorry, I have wrote a wrong subject in the first email! Regards, Linda -- Forwarded message -- From: linda Porz linda.p...@gmail.com Date: 2011/5/25 Subject: combined odds ratio To: r-help@r-project.org Cc: r-help-requ...@stat.math.ethz.ch Dear all, I am looking for an R function which does stepwise selection cox model in r (delta chisq likelihood ratio test) similar to the stepwise, pe (0.05) lr: stcox in STATA. I am very thankful for any reply. Regards, Linda __ 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. -- Men by nature long to get on to the ultimate truths, and will often be impatient with elementary studies or fight shy of them. If it were possible to reach the ultimate truths without the elementary studies usually prefixed to them, these would not be preparatory studies but superfluous diversions. -- Maimonides (1135-1204) Bert Gunter Genentech Nonclinical Biostatistics [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] median test
Hello, I can't have different data these data came from mice that have lived under certain condition in the lab! I have just read the mentioned publication Should the median test be retired from general use? It says in the conclusion If one felt that the data could not come from a Cauchy or slash distribution, the Wilcoxon should be used.! What is this? Is there is any test in R for a Cauchy or slash distribution? Can I used the unpaired Wilcoxon, or I have a Cauchy distributed data? Many thanks, Linda 2010/5/27 Joshua Wiley jwiley.ps...@gmail.com Hello Linda, The problem is actually the median of your data. What the function median.test() does first is combine both groups. Look at this: median(c(group1, group2)) the median is 1, but the lowest value of the groups is also 1. So when the function does the logical check z m where z = c(group1, group2) and m is the median, there are no values that are less than the median value. Therefore there is only 1 level, and the fisher test fails. You would either need different data or adjust the function to be: fisher.test(z = m, g)$p.value that way it's less than or equal to the median. Hope that helps, Josh On Thu, May 27, 2010 at 7:24 AM, linda Porz linda.p...@gmail.com wrote: Hi all, I have found the following function online median.test-function(y1,y2){ z-c(y1,y2) g - rep(1:2, c(length(y1),length(y2))) m-median(z) fisher.test(zm,g)$p.value } in http://www.mail-archive.com/r-help@r-project.org/msg95278.html I have the following data group1 - c(2, 2, 2, 1, 4, 3, 1, 1) group2 - c(3, 1, 3, 1, 4, 1, 1, 1, 7, 1, 1, 1, 1, 1, 2) median.test(w1,group1) [1] 1 median.test(group1,group2) Error in fisher.test(z m, g) : 'x' and 'y' must have at least 2 levels I am very thankful in advance for any suggestion and help. Regards, Linda [[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. -- Joshua Wiley Senior in Psychology University of California, Riverside http://www.joshuawiley.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.
[R] median test
Hi all, I have found the following function online median.test-function(y1,y2){ z-c(y1,y2) g - rep(1:2, c(length(y1),length(y2))) m-median(z) fisher.test(zm,g)$p.value } in http://www.mail-archive.com/r-help@r-project.org/msg95278.html I have the following data group1 - c(2, 2, 2, 1, 4, 3, 1, 1) group2 - c(3, 1, 3, 1, 4, 1, 1, 1, 7, 1, 1, 1, 1, 1, 2) median.test(w1,group1) [1] 1 median.test(group1,group2) Error in fisher.test(z m, g) : 'x' and 'y' must have at least 2 levels I am very thankful in advance for any suggestion and help. Regards, Linda [[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.