similar to: Bug in cor.test - Spearman

Displaying 20 results from an estimated 900 matches similar to: "Bug in cor.test - Spearman"

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:
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 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
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.
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,
2005 Oct 07
1
cor() function, method="spearman"
Hello, Does anyone know if the cor function, when method = "spearman", returns a correlation coefficient corrected for any ties in the ranks of the data? I have data with quite a few ties and am thinking that I should use a calculation of the coefficient corrected for ties, but before I try and code this calculation myself, I thought I should check whether or not cor() automatically
2004 Jan 21
1
cor( x, y , method = "spearman" ) incorrect if any( is.na(c( x, y (PR#6448)
> version _ platform i686-pc-linux-gnu arch i686 os linux-gnu system i686, linux-gnu status major 1 minor 8.1 year 2003 month 11 day 21 language R > cor( 1:3, rep(NA,3) ) # OK Error in cor(1:3, rep(NA, 3)) :
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
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 Jul 20
1
how to determine/assign a numeric vector to "Y" in the cor.test function for spearman's correlations?
Hello to all of you, R-expeRts! I am trying to compute the cor.test for a matrix that i labelled mydata according to mydata=read.csv... then I converted my csv file into a matrix with the mydata=as.matrix(mydata) NOW, I need to get the p-values from the correlations... I can successfully get the spearman's correlation matrix with: cor(mydata, method="s",
2010 Jan 06
0
Unconsistent behaviour of function cor()
Odd behaviour of function cor() in R-2.10.1-64bit-Unix In a dataset with 1366 patients and 244 clinical variables Spearman's Rho was calculated for some fatty acids and BMI and came over something rather odd: R seems to calculate Rho differently on 2.10.1-64bit-Unix and 2.9.0-32bit-Windows when I calculate the complete (244x244) correlation matrix and then pick out the values I am
2003 Oct 22
6
Something strange in cor.test in R-1.8.0 (PR#4718)
Full_Name: Ian Wilson Version: R-1.8.0 OS: Windows (but own compilation) Submission from: (NULL) (139.133.7.38) the p-value is incorrect for cor.test using method "spearman" in R-1.8.0. This was not the case in R-1.7.1. Version R-1.8.0 on Windows > cor.test(rnorm(50),rnorm(50),method="spearman") Spearman's rank correlation rho data: rnorm(50) and rnorm(50) S
2004 May 20
1
Spearman probabilities and SuppDists
cor.test and SuppDists give me different P-values for the same Spearman's rho. Which is correct, or am I doing something wrong? > x <- c(44.4, 45.9, 41.9, 53.3, 44.7, 44.1, 50.7, 45.2, 60.1) > y <- c( 2.6, 3.1, 2.5, 5.0, 3.6, 4.0, 5.2, 2.8, 3.8) > cor.test(x,y,method="spearman") Spearman's rank correlation rho data: x and y S = 48, p-value =
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))
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
2011 Nov 01
1
How to interpret Spearman Correlation
Hi, I am not really familiar with Correlation foundations, although I read a lot. So maybe if someone kindly help me to interpret the following results. I had the following R commands: correlation <-cor( vector_CitationProximity , vector_Impact, method = "spearman", use="na.or.complete") cor_test<-cor.test(vector_CitationProximity, vector_Impact,
2003 May 01
3
Test statistic for Spearman correlation
In the ouput below, what is the "S" statistic (S = 96) that is used for Spearman? I don't have easy access to the books cited on the help page. Other texts and web sources that I have found use t or z as a test for Spearman, perhaps inappropriately. Can anyone tell me how S is computed or refer to a web resource? I see from the code for that: q <- as.integer((n^3 - n) * (1
2005 Mar 17
1
exact p-value for Spearman, with ties
Dear R, I'm looking for exact p-values for Spearman's rank correlation in the presence of ties. This is available in StatXact and SPSS, but I haven't yet found it in R. Has anyone implemented this? -- Paul H Artes Assist Prof, Ophth Vis Sci Dalhousie University, QEII Eye Care Centre Halifax, NS, CANADA
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