similar to: cor() function, method="spearman"

Displaying 20 results from an estimated 4000 matches similar to: "cor() function, method="spearman""

2006 Sep 13
1
S in cor.test(..., method="spearman")
Dear HelpeRs, I have some data: "ice" <- structure(c(0.386, 0.374, 0.393, 0.425, 0.406, 0.344, 0.327, 0.288, 0.269, 0.256, 0.286, 0.298, 0.329, 0.318, 0.381, 0.381, 0.47, 0.443, 0.386, 0.342, 0.319, 0.307, 0.284, 0.326, 0.309, 0.359, 0.376, 0.416, 0.437, 0.548, 41, 56, 63, 68, 69, 65, 61, 47, 32, 24, 28, 26, 32, 40, 55, 63, 72, 72, 67, 60, 44, 40, 32, 27, 28, 33,
2004 Mar 15
1
spearman rank correlation problem
Hello R gurus, I want to calculate the Spearman rho between two ranked lists. I am getting results with cor.test that differ in comparison to my own spearman function: > my.spearman function(l1, l2) { if(length(l1) != length(l2)) stop("lists must have same length") r1 <- rank(l1) r2 <- rank(l2) dsq <- sapply(r1-r2,function(x) x^2) 1 - ((6 * sum(dsq))
2004 Aug 30
1
Wrong result with cor(x, y, method="spearman", use="complete.obs") with NA's???
Hallo! Is there an error in cor to calculate Spearman correlation with cor if there are NA's? cor.test gives the correct result. At least there is a difference. Or am I doing something wrong??? Does anybody know something about this? a<-c(2,4,3,NA) b<-c(4,1,2,3) cor(a, b, method="spearman", use="complete.obs") # -0.9819805 cor.test(a, b,
2003 Nov 07
2
Bug in cor.test - Spearman
Greetings. There seems to be a problem with the P-value computation in the cor.test with method="spearman". In R1.8.0 (MS Windows) I seem to be getting intermittently nonsense P-values, but the rho's are OK. I can get this reproducibly with the toy example attached where the first use is OK and subsequent calls with the same data give nonsense. (I have also seen the problem
2006 Dec 05
1
Spearman correlation ties and discrepancies
Hi. I am currently trying to run some Spearman correlations, and have encountered two issues. 1) When using cor.test() with a variable that includes ties, I get the "Cannot compute exact p-values with ties" error. I have read that this function now uses an asymptotic formula that allows for ties, so do not understand why I am getting this error. (I am running version 2.4.0.) I
2009 Nov 30
1
cor.test(method = spearman, exact = TRUE) not exact (PR#14095)
Full_Name: David Simcha Version: 2.10 OS: Windows XP Home Submission from: (NULL) (173.3.208.5) > a <- c(1:10) > b <- c(1:10) > cor.test(a, b, method = "spearman", alternative = "greater", exact = TRUE) Spearman's rank correlation rho data: a and b S = 0, p-value < 2.2e-16 alternative hypothesis: true rho is greater than 0 sample estimates:
2011 May 16
2
about spearman and kendal correlation coefficient calculation in "cor"
Hi, I have the following two measurements stored in mat: > print(mat) [,1] [,2] [1,] -14.80976 -265.786 [2,] -14.92417 -54.724 [3,] -13.92087 -58.912 [4,] -9.11503 -115.580 [5,] -17.05970 -278.749 [6,] -25.23313 -219.513 [7,] -19.62465 -497.873 [8,] -13.92087 -659.486 [9,] -14.24629 -131.680 [10,] -20.81758 -604.961 [11,] -15.32194 -18.735 To calculate the ranking
2007 Sep 20
1
Bug with Cor(..., method='spearman") and by() (PR#9921)
I posted this on R help, and a few others responded indicating they too were able to replicate the error as a function of missing data. I believe this should not be the case and hence and reporting it here. ### Code provided on R-Help by Ivar Herfindal # Simulate data testdata <- cbind.data.frame(gr=3Drep(letters[1:4], each=3D5), = aa=3Drnorm(20), bb=3Drnorm(20)) # Introduce some missingness
2007 May 29
2
R's Spearman
Hi all, I am trying to figure out the formula used by R's Spearman rho (using cor(method="spearman")) because I can't seem to get the same value as by calculating "by hand". Perhaps I'm using "cor" wrong, but I don't know where. Basically, I am running these commands: > y=read.table(file="tmp",header=TRUE,sep="\t") >
2004 Mar 19
1
cor.test() -> p-values may be incorrect due to tie
Hi R specialists, When testing the association between two time series the cor.test gives the following message...-> p-values may be incorrect due to tie What does it mean? (it is not described in the help) Thankx, Jan > cor.test(Origi[,1],Origi[,2], alternative = c("two.sided"),method = c("spearman"), conf.level = 0.95) Spearman's rank correlation rho
2011 Mar 29
1
R Help Question on cor() function
Hi, Does anyone know if the cor() function under the stats package adjusts for ties? Specifically, with method="spearman" does R compute the ties adjusted version of Sperman's rank correlation coefficient or the uncorrected version? If not, does anyone know of a function/package that will do this? Thanks! Courtney M.
2008 Sep 10
3
making spearman correlation cor() call fail with log(0) as input
Hi, How can I make the cor(x, y, method="spearman") call to produce an error when the input to it (x, y) produces an error? Here is a simple example: > a <- c(0, 1, 2) > b <- c(100, 2, 4) ## error: > log(a) [1] -Inf 0.0000000 0.6931472 ## error, as expected: > cor(log(a), log(b), method="pearson") [1] NaN ## not an error any more (not expected): >
2007 Aug 23
1
in cor.test, difference between exact=FALSE and exact=NULL
Pardon my ignorance, but is there a difference in cor.test between exact=FALSE and exact=NULL when method=spearman? Take for example: x<-c(1,2,2,3,4,5) y<-c(1,2,2,10,11,12) cor.test(x,y, method="spearman", exact=NULL) This gives an error message, Warning message: Cannot compute exact p-values with ties in: cor.test.default(x, y, method = "spearman", exact = NULL)
2004 Mar 03
1
cor(..., method="spearman") or cor(..., method="kendall") (PR#6641)
Dear R maintainers, R is great. Now that I have that out of the way, I believe I have encountered a bug, or at least an inconsistency, in how Spearman and Kendall rank correlations are handled. Specifically, cor() and cor.test() do not produce the same answer when the data contain NAs. cor() treats the NAs as data, while cor.test() eliminates them. The option use="complete.obs" has
2005 Aug 13
1
R/S-Plus/SAS yield different results for Kendall-tau and Spearman nonparametric regression
Colleagues, I ran some nonparametric regressions in R (run in RedHat Linux), then a colleague repeated the analyses in SAS. When we obtained different results, I tested S-Plus (same Linux box). And, got yet different results. I replicated the results with a small dataset: DATA: 37.5 23 37.5 13 25 16 25 12 100 15 12.5 19 50 20 100 13 100 10 100 10 100 16 50 10 87.5
2009 Jan 17
1
bug in cor.test(method = "spearman")
Dear R developers: There is a possible bug in calculating the p-value for Spearman's rank correlation. Line 155 in file R-patched/src/library/stats/R/cor.test.R is as.double(round(q) + lower.tail), I think, it should be as.double(round(q) + 2*lower.tail), The reason is that round(q) is expected to be an even number (the S statistic), so the next feasible value is round(q)+2.
2010 Jun 08
2
cor.test() -- how to get the value of a coefficient
Hi, all. Yet another beginner to R : ) I wonder, how it's possible to get the value of a coefficient from the object produced by cor.test() ? > cor.test(a, b, method="spearman") Spearman's rank correlation rho data: a and b S = 21554.28, p-value = 2.496e-11 alternative hypothesis: true rho is not equal to 0 sample estimates: rho 0.6807955 Warning message: In
2005 Jan 25
1
spearman rank test correlation
Hallo, does anybody know if there is an implementation of the Spearman rank correlation in R that gives a correct (or at least 'safe') p-value in the case of ties?? I have browsed the R-help archives but I found nothing. Thanks a lot in advance for any help, Antonino Casile
2010 Jun 09
1
bug? in stats::cor for use=complete.obs with NAs
Arrrrr, I think I've found a bug in the behavior of the stats::cor function when NAs are present, but in case I'm missing something, could you look over this example and let me know what you think: > a = c(1,3,NA,1,2) > b = c(1,2,1,1,4) > cor(a,b,method="spearman", use="complete.obs") [1] 0.8164966 > cor(a,b,method="spearman",
2009 Apr 17
1
Turning off warnings from cor.test
I would like to turn off the warnings from cor.test while retaining exact=NULL. Is that possible ? > cor.test(c(1,2,3,3,4,5), c(1,2,3,3,4,5), method = "spearman") Spearman's rank correlation rho data: c(1, 2, 3, 3, 4, 5) and c(1, 2, 3, 3, 4, 5) S = 0, p-value < 2.2e-16 alternative hypothesis: true rho is not equal to 0 sample estimates: rho 1 Warning message: In