similar to: Incorrect handling of NA's in cor() (PR#6750)

Displaying 20 results from an estimated 10000 matches similar to: "Incorrect handling of NA's in cor() (PR#6750)"

2005 Apr 04
2
Problems with predict.lm: incorrect SE estimate (PR#7772)
Full_Name: Marek Ancukiewicz Version: 2.01 OS: Linux Submission from: (NULL) (132.183.12.87) It seems that the the standard error of prediction of the linear regression, caclulated with predict.lm is incorrect. Consider the following example where the standard error is first calculated with predict.lm, then using delta method. and finally, using the formula rms*sqrt(1+1/n+(xp-x0)^2/Sxx). Marek
2010 Feb 08
2
Incorrect Kendall's tau for ordered variables (PR#14207)
Full_Name: Marek Ancukiewicz Version: 2.10.1 OS: Linux Submission from: (NULL) (74.0.49.2) Both cor() and cor.test() incorrectly handle ordered variables with method="kendall", cor() incorrectly handles ordered variables for method="spearman" (method="person" always works correctly, while method="spearman" works for cor.test, but not for cor()). In
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",
1999 May 27
1
Factor structures not preserved after dump/dput (PR#200)
Full_Name: Marek Ancukiewicz Version: 0.64.0 OS: Linux (RedHat 6.0) Submission from: (NULL) (132.183.12.87) I've noticed that factor structures get recoded when the data is dumped using either dump or dput and then restored with source or dget. This occurs when the values taken by factors do not include 1. For example: a <-
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
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 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,
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)
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",
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
2006 Jul 31
3
na.rm problem
hi, i am a new member. i am using R in finding correlation between two variables of unequal length. when i use cor(x,y,na.rm=T,use="complete") where x has observations from 1928 to 2006 & y has observations from 1950 to 2006. I used na.rm=T to use the "complete observations". So missing values should be handled by casewise deletion. But it gives me error Error in
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"))
2003 Apr 24
3
Missing Value And cor() function
Hi r lovers! I 'd like to apply the cor() function to a matrix which have some missing values As a matter of fact and quite logically indeed it doesn't work Is there a trick to replace the missing value by the mean of each variable or by any other relevant figures ? Or should I apply a special derivate of the cor() function, (I don't have any idea if it exists and have some trouble to
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(
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) +
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
2008 Feb 27
4
Error in cor.default(x1, x2) : missing observations in cov/cor
Hello, I'm trying to do cor(x1,x2) and I get the following error: Error in cor.default(x1, x2) : missing observations in cov/cor A few things: 1. I've used cor() many times and have never encountered this error. 2. length(x1) = length(x2) 3. is.numeric(x1) = is.numeric(x2) = TRUE 4. which(is.na(x1)) = which(is.na(x2)) = integer(0) {the same goes for is.nan()} 5. I also try
2012 Feb 23
5
cor() on sets of vectors
suppose I have two sets of vectors: x1,x2,...,xN and y1,y2,...,yN. I want N correlations: cor(x1,y1), cor(x2,y2), ..., cor(xN,yN). my sets of vectors are arranged as data frames x & y (vector=column): x <- data.frame(a=rnorm(10),b=rnorm(10),c=rnorm(10)) y <- data.frame(d=rnorm(10),e=rnorm(10),f=rnorm(10)) cor(x,y) returns a _matrix_ of all pairwise correlations: cor(x,y)
2005 Jul 23
2
cor(X) with P-Value
Friends I am new to R (and statistics) so am struggling a bit. Briefly... I am interested in getting the P-Value from cor(X) where X is a matrix. I have found cor.test. Verbosely... I have 4 vectors and can generate the corellation matrix... > cor(cbind(X1, X2, X3, X4)) X1 X2 X3 X4 X1 1.00000000 -0.06190365 -0.156972795 0.182547517 X2
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