similar to: bug? in stats::cor for use=complete.obs with NAs

Displaying 20 results from an estimated 3000 matches similar to: "bug? in stats::cor for use=complete.obs with NAs"

2004 Apr 09
6
Incorrect handling of NA's in cor() (PR#6750)
Full_Name: Marek Ancukiewicz Version: 1.8.1 OS: Linux Submission from: (NULL) (132.183.12.87) Function cor() incorrectly handles missing observation with method="spearman": > x <- c(1,2,3,NA,5,6) > y <- c(4,NA,2,5,1,3) > cor(x,y,use="complete.obs",method="s") [1] -0.1428571 >
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,
2008 Jan 02
2
strange behavior of cor() with pairwise.complete.obs
Hi all, I'm not quite sure if this is a feature or a bug or if I just fail to understand the documentation: If I use cor() with pairwise.complete.obs and method=pearson, the result is a scalar: ->cor(c(1,2,3),c(3,4,6),use="pairwise.complete.obs",method="pearson") [1] 0.9819805 The documentation says that " '"pairwise.complete.obs"' only
2012 Mar 07
2
how to see inbuilt function(cor.test) & how to get p-value from t-value(test of significance) ?
i can see source code of function > cor function (x, y = NULL, use = "everything", method = c("pearson", "kendall", "spearman")) { na.method <- pmatch(use, c("all.obs", "complete.obs", "pairwise.complete.obs", "everything", "na.or.complete"))
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",
2003 Sep 13
2
what does this error mean?
Dear R-users: I am runing R 1.6.2 with Windows XP. I try to calculate Pearson correlation and Spearman correlation of any pairwise columns of 8000 x 80 data matrix with missing values and randomize the matix 1000 times and calculate this two correlations again. The code bellow for Pearson is working fine but for Spearman got the error bellow for randomized data matrix and R console is stop
2006 Jun 01
1
progressive slowdown during script execution?
I'm an R novice, so I hope my question is a valid one. I'm trying to run the following script in the current version of R. for (i in 1:1640){for (j in (i+1):1641){ if (i == 1 && j == 2){x <- cor(sage[i,],sage[j,],method="spearman"); y <- cor(frie[i,],frie[j,],method="spearman")} if (i != 1 || j != 2){x <-
2016 Apr 29
2
lm() with spearman corr option ?
Hi, A following function was kindly provided by GGally?s maintainer, Barret Schloerke. function(data, mapping, ...) { p <- ggplot(data = data, mapping = mapping) + geom_point(color = I("blue")) + geom_smooth(method = "lm", color = I("black"), ...) + theme_blank() + theme(panel.border=element_rect(fill=NA, linetype =
2011 Jan 21
0
Possible bug in Spearman correlation with use="pairwise.complete.obs"
Hi, I have just encountered a strange behaviour from 'cor' with regards to the treatment of NAs when calculating Spearman correlations. I guess it is a subtle bug. If I understand the help page correctly, the two modes 'complete.obs' and 'pairwise.complete.obs' specify how to deal with correlation coefficients when calculating a correlation _matrix_. When calculating
2007 Mar 15
1
Incorrect matrix of spearman correlations .... in 64-bit Linux ... (PR#9568)
Full_Name: Vladimir Obolonkin Version: tested in 2.0 to 2.4.1 OS: linux, win, mac Submission from: (NULL) (202.14.96.194) {{ Subject shortened manually -- to pass anti-spam filters Original-subject: Incorrect matrix of spearman correlations working \ large (24000 by 425 and 78 by 425 data frames) in 64-bit Linux machines;\ the same code gives correct results in 32-bits Win and
2004 Oct 22
1
cor, cov, method "pairwise.complete.obs"
Hi UseRs, I don't want to die beeing idiot... I dont understand the different results between: cor() and cov2cov(cov()). See this little example: > x=matrix(c(0.5,0.2,0.3,0.1,0.4,NA,0.7,0.2,0.6,0.1,0.4,0.9),ncol=3) > cov2cor(cov(x,use="pairwise.complete.obs")) [,1] [,2] [,3] [1,] 1.0000000 0.4653400 -0.1159542 [2,] 0.4653400 1.0000000
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)
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
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): >
2009 Dec 16
1
number of observations used in cor when use="pairwise.obs"
Dear R gurus, to compute the correlation matrix of "n" variables with "n_obs" observations each, possibly including NA, I use cor(M, use="pairwise.obs") where m is a "n" x "nobs" matrix. Now I want to know the number of observations actually used in this computation, namely for each pair of columns in M, say pair (i,j), I want to compute sum(
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
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
2003 Apr 01
2
cor.test observations limit
Hi, Is there a limit on the number of observations for using cor.test. For example, > library(ctest) > cor.test(rnorm(3000), rnorm(3000), method="spearman") Error in if (q > (n^3 - n)/6) pspearman(q - 1, n, lower.tail = FALSE) else pspearman(q, : missing value where logical needed In addition: Warning message: NAs introduced by coercion I mainly want to calculate
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
2005 Feb 13
1
Bug in cor function (PR#7689)
I can't hardly accept the result of cor function with pairwize.colplete.obs or complete.obs insert print statements in cor function, + if (method != "pearson") { + Rank <- function(u) if (is.matrix(u)) + apply(u, 2, rank, na.last = "keep") + else rank(u, na.last = "keep") + x <- Rank(x) +