similar to: Error in cor.default(x1, x2) : missing observations in cov/cor

Displaying 20 results from an estimated 9000 matches similar to: "Error in cor.default(x1, x2) : missing observations in cov/cor"

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
2000 Nov 10
1
Modification to cov and cor
Can I suggest that in cov and cor the lines if (is.data.frame(x)) x <- as.matrix(x) if (is.data.frame(y)) y <- as.matrix(y) be replaced by if (is.data.frame(x)) x <- data.matrix(x) # coerce logical and factors if (is.data.frame(y)) y <- data.matrix(y) # likewise This would allow things like > data(iris) > cor(iris) which
2008 Sep 05
2
typo in cov()? var() fails on NA in R 2.7.2 but not R 2.6.1
I recently started using R 2.7.2, and noticed a surprising change in the behavior of var() on NA data: R 2.6.1 (Patched), 2007-11-26, svn.rev 43541, x86_64-unknown-linux-gnu: > stdev(rep(NA,3), na.rm=F) [1] NA > stdev(rep(NA,3), na.rm=T) [1] NA > var(rep(NA,3), na.rm=T, use="complete.obs") [1] NA R 2.7.2 (Patched), 2008-09-02, svn.rev 46491,
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
2000 Jan 31
1
Feature requests for princomp(.) : Allow cor() specifications
(all in subject). If I want to do a PC analysis in a situation with missing data, I may want to have same flexibility as with "cor(.)", e.g., I may want princomp(x, ..., use.obs = "pairwise.complete") Actually, I may want even more flexibility. Currently, princomp(.) has if (cor) cv <- get("cor", envir = .GlobalEnv)(z) else cv <-
2004 Dec 21
3
R code for var-cov matrix given variances and correlations
Dear list members, Where can I find code for computing the p*p variance-covariance matrix given a vector of p variances (ordered varA, varB, ..., varp) and a vector of all possible correlations (ordered corAB, corAC, ..., corp-1,p)? I know that the covariance between 2 variables is equal to the product of their correlation and their standard deviations: corAB * varA^.5 * varB^.5 and so:
2007 Dec 03
1
cor(data.frame) infelicities
In using cor(data.frame), it is annoying that you have to explicitly filter out non-numeric columns, and when you don't, the error message is misleading: > cor(iris) Error in cor(iris) : missing observations in cov/cor In addition: Warning message: In cor(iris) : NAs introduced by coercion It would be nicer if stats:::cor() did the equivalent *itself* of the following for a data.frame:
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) +
2007 Jul 05
1
cor() and cor.test() (PR#9781)
Hello, I am trying to make a correlation matrix in R using cor() and also to get the p-value for each correlation using cor.test(). I can't get these commands to work. I'm getting errors like the following: cor(Pollution, Wet.days) Error in inherits(x, "data.frame") : Object "Wet.days" not found cor("Pollution", "Wet.days") Error in
2004 Sep 16
1
cor() fails with big dataframe
Hello, I have a big dataframe with *NO* na's (9 columns, 293380 rows). # doing memory.limit(size = 1000000000) cor(x) #gives Error in cor(x) : missing observations in cov/cor In addition: Warning message: NAs introduced by coercion #I found the obvious workaround: COR <- matrix(rep(0, 81),9,9) for (i in 1:9) for (j in 1:9) {if (i>j) COR[i,j] <- cor (x[,i],x[,j])} #which works fine,
2007 Jul 03
1
MASS library rob.cov ellipse
Hi, I used to get a really useful graph when I ran the following command using the MASS library: > cov.rob(cbind(dekeyser$AGE,dekeyser$GJTSCORE),cor=T) Besides the regular output, a graph appeared that had the classical correlation and the robust correlation, and two ellipses, one surrounding the data that would be used in the classical correlation and the other surrounding the data in the
2004 Jul 19
1
Bug in cor() with named array and matrix (PR#7116)
Full_Name: Ju-Sung Lee Version: 1.9.1 OS: Windows XP Submission from: (NULL) (128.2.79.102) The following commands causes R to crash: a = array(1:3) dimnames(a)[[1]] = c('1','2','3') cor(a,matrix(1:3)) not naming the array seems to work.
2001 Nov 01
1
cor.test for a correlation matrix
Is there a simple way to run cor.test on for a matrix of correlations? Of course, cor on a data frame produces a correlation matrix, but cor.test will only take two variables at a time. Is there a way to get behavior similar to that of cor with cor.test? I suppose the programming alternative would be to run two for loops with the number of items and cor test embedded accessing the columns of
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",
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
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(
2008 Dec 03
2
Null values In R.
Hi everyone. I am having problems with NULL values. I understand in R one can command the program to skip null values. Can some one help me on the command line for that. Do i enter is as part of the string in: a<- read.table("filename.csv", header = T, row.names=1, sep=","); My problem is largely when i attempt to use correlation for my data... xcc <- cor(a); The
2008 Apr 05
2
pearson's correlation
Hello, I used the function cor to calculate the pearson correlation coefficient between variables. However, the resulting values do not correspond to the outcome of my excel-calculations, for which I used the formula Cor(x,y)=Cov(x,y)/(SD(x)*SD(y)) So my question is: How does the function "cor" compute the pearson correlation coefficient? Thank you in advance, Ake Nauta
2003 Jan 29
3
na.rm in sd()
Hello, I think this qualify as a bug > x<-c(1,2,3,4,NA,6,7) > mean(x) [1] NA > mean(x,na.rm=T) [1] 3.833333 > sd(x) Error in var(as.vector(x)) : missing observations in cov/cor > sd(x,na.rm=T) Error in sd(x, na.rm = T) : unused argument(s) (na.rm ...) > var(x) Error in var(x) : missing observations in cov/cor > var(x,na.rm=T) [1] 5.366667 > why sd() does not
2002 Aug 22
3
correlation
Dear All, I have a file (a matrix) on which I have to compute the correlations. The function "cov" compute the correlations between the columns of a matrix, but I want to compute the correlations between the raws. Can somebody say to me how I can carry out that? Thanks Laurence -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list --