similar to: strange behavior of cor() with pairwise.complete.obs

Displaying 20 results from an estimated 11000 matches similar to: "strange behavior of cor() with pairwise.complete.obs"

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
2004 May 24
1
bug in cor (..., use= ...)?
Dear R users, I have not found anything on this in the archives. Does anyone know whehther the parameter use= is not functioning in cor or enlighten me what it is supposed to do? My R version is "R version 1.8.1, 2003-11-21" on Windows 2000. I am hoping to be able to update to 1.9.1 as soon as it has appeared (we are not allowed here to install software on our own and thus I am trying
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"))
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(
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",
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 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) +
2004 May 13
1
Bootstrapping kendall cor
Dear R-helpers, I'm fighting with the following problem : I want to do bootstrapping on a Kendall correlation with the following code : > cor.function <- function(data,i) cor(data[i, 1], data[i, 2],method="kendall") > boot.ci <- boot.ci(boot.cor <- boot(cbind(x,y),cor.function, R=1000),conf=c(0.95,0.99)) However, I've got problems because I've got ties
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 Jun 18
1
the way to look at all the codings of any functions
Dear SIr, In case of looking at the codes of the fuction, "cov", we find all the codings below. But, incase of "mean", we don't find the contents. Please show me the way to look at all the codings of any functions. Best regards, Kei ----------------------- > cov function (x, y = NULL, use = "all.obs", method = c("pearson",
2005 May 25
2
cor vs cor.test
Using Windows System, R 2.1.0 d is a data frame, 48 rows, 10 columns cor(d) works properly providing all pairwise Pearson correlation coefficients among columns cor.test(d) gives error message "Error in cor.test.default(d) : argument "y" is missing, with no default" Why? Thanks, MCG
2011 Nov 16
4
Pairwise correlation
Dear All, I am not familiar with R yet I want to use it to perform some task, hence my posting here. I hope someone can help. I have a set of data, genes (rows) and samples (columns). I want to do a Pearson correlation on all the possible pairwise combinations of all the genes (2000). Does anyone have an idea of how to execute this in R? Thanks in advance. -- View this message in context:
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",
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
2006 Aug 08
3
Pairwise n for large correlation tables?
Hello, I'm using a very large data set (n > 100,000 for 7 columns), for which I'm pretty happy dealing with pairwise-deleted correlations to populate my correlation table. E.g., a <- cor(cbind(col1, col2, col3),use="pairwise.complete.obs") ...however, I am interested in the number of cases used to compute each cell of the correlation table. I am unable to find such a
2008 Aug 24
1
howto optimize operations between pairs of rows in a single matrix like cor and pairs
Hi, I calculating the output of a function when applied to pairs of row from a single matrix or dataframe similar to how cor() and pairs() work. This is the code that I have been using: pairwise.apply <- function(x, FUN, ...){ n <- nrow(x) r <- rownames(x) output <- matrix(NA, nc=n, nr=n, dimnames=list(r, r)) for(i in 1:n){ for(j
2008 Nov 21
1
Bug in Kendall for n<4?
> library(Kendall) > Kendall(1:3,1:3) WARNING: Error exit, tauk2. IFAULT = 12 <<<<<< tau = 1, 2-sided pvalue =1 I believe Kendall tau is well-defined for this case and the reported value is correct; isn't it a bug to give a warning? (And if, e.g., the pvalue is not well-defined in this case, wouldn't it be better to return NA or NaN or something?) Also,
2011 Apr 30
1
Kendall's tau code
I discovered that the Kendall's tau calculation in R uses all pairwise comparisons which is O(n^2) and takes a long time for large vectors. I implemented a O(n*log(n)) algorithm based on merge-sort. Is this of interest to be included in core R? The code (fortran and R wrapper) is available in my package clinfun v0.9.7 (not exported in NAMESPACE). Thanks, Venkat -- Venkatraman E. Seshan,
2006 Jun 22
2
programming advice
Dear R users I want to compute Kendall's Tau between two vectors x and y. But x and y may have zeros in the same position(s) and I wrote the following function to be sure to drop out those "double zeros" "cor.kendall" <- function(x,y) { nox <- c() noy <- c() # for (i in 1:length(x)) if (x[i]!= 0 | y[i] != 0) nox[length(nox)+1]<- x[i] for (i in
2013 Mar 29
1
pairs(X,Y) analog of cor(X,Y)?
With a data frame containing some X & Y variables I can get the between set correlations with cor(X,Y): > cor(NLSY[,1:2], NLSY[3:6]) antisoc hyperact income educ math 0.043381307 -0.07581733 0.25487753 0.2876875 read -0.003735785 -0.07555683 0.09114299 0.1884101 Is there somewhere an analog of pairs(X,Y) that will produce the pairwise plots of each X against each