Displaying 20 results from an estimated 20000 matches similar to: "correlation question"
2009 May 26
2
(OT) Does pearson correlation assume bivariate normality of the data?
Dear all,
The other day I was reading this post [1] that slightly surprised me:
"To reject the null of no correlation, an hypothsis test based on the
normal distribution. If normality is not the base assumption your
working from then p-values, significance tests and conf. intervals
dont mean much (the value of the coefficient is not reliable) " (BOB
SAMOHYL).
To me this implied that in
2008 Oct 10
1
Correlation among correlation matrices cor() - Interpretation
Hello,
If I have two correlation matrices (e.g. one for each of two treatments) and
then perform cor() on those two correlation matrices is this third
correlation matrix interpreted as the correlation between the two
treatments?
In my sample below I would interpret that the treatments are 0.28
correlated. Is this correct?
> var1<- c(.000000000008, .09, .1234, .5670008, .00110011002200,
2009 Nov 06
2
another question: how to delete one of columes in two ones with high correlation(0.95)
my programe is below:
a=c(1,2,1,1,1); b=c(1,2,3,4,1); c=c(3,4,3,3,3); d=c(1,2,3,5,1);
e=c(1,5,3,5,1)
data.f=data.frame(a,b,c,d,e)
origin.data<-data.f
cor.matrix<-cor(origin.data)
origin.cor<-cor.matrix
m<-0
for(i in 1:(cor.matrix[1]-1))
{
for(j in (i+1):(cor.matrix[2]))
{
if (cor.matrix[i,j]>=0.95)
{
data.f<-data.f[,-i];
i<-i+1
}
2008 Feb 08
2
correlation
Dear list
I would like to compare two measurements of disease severity (M1 and
M2), one of the is continuous (M1 ranging from 1 to 10) and the other
is ordinal (M2 takes Low, Medium, high and very high). Do you think is
ok to use cor() function to test whether the two agree, i.e correlate?
I am afraid that if I set M2 to 1,2,3 and 4, the function cor() will
take them as continuous and
2024 Jul 25
1
please help generate a square correlation matrix
Hi R users,
I generated a square correlation matrix for the dat dataframe below;
dat<-data.frame(g1=c(1,0,0,1,1,1,0,0,0),
g2=c(0,1,0,1,0,1,1,0,0),
g3=c(1,1,0,0,0,1,0,0,0),
g4=c(0,1,0,1,1,1,1,1,0))
library("Hmisc")
dat.rcorr = rcorr(as.matrix(dat))
dat.r <-round(dat.rcorr$r,2)
however, I want to modify this correlation calculation;
2002 Mar 07
8
linear correlation?
Whether the two variables have the same units does not matter. Moreover,
even if there were some way of converting cm to kg the correlation would
still be the same because the correlation is invariant under unit conversion
as it is invariant under multiplication of its arguments by a constant.
As for your second question, the correlation estimator is a continuous
function of each of the
2004 Apr 10
1
confidential interval of correlation coefficient using bootstrap
I tried 2 methods to estimate C.I. of correlation coefficient of variables x and y:
> 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)
#METHOD 1: Pearson's
**********************************************************
> cor.test(x, y, method = "pearson", conf.level = 0.95)
Pearson's
2008 Feb 24
1
Jitter in correlation matrix?
Hi,
I am just starting to use R for a graduate course, and I like how the
correlation matrix at
http://addictedtor.free.fr/graphiques/RGraphGallery.php?graph=137
I did something similar by copying from the examples(pairs), but it
seems that I need to jitter the bottom panel... and I have no idea how
to do that, and I mean no idea at all. I'd appreciate any help...
Here are the graphs:
2024 Jul 25
1
please help generate a square correlation matrix
?s 17:39 de 25/07/2024, Yuan Chun Ding via R-help escreveu:
> Hi R users,
>
> I generated a square correlation matrix for the dat dataframe below;
> dat<-data.frame(g1=c(1,0,0,1,1,1,0,0,0),
> g2=c(0,1,0,1,0,1,1,0,0),
> g3=c(1,1,0,0,0,1,0,0,0),
> g4=c(0,1,0,1,1,1,1,1,0))
> library("Hmisc")
> dat.rcorr =
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
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
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
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
2008 Jun 23
2
Correlation Help
Hi,
I have recently been using the R program and encountered a recurring problem. I have been trying calculate the correlation of a 16 column table. Everytime I type in cor(test), where test is data that I uploaded into R using the read.table function, I get an error:
Error in cor(test) : missing observations in cov/cor
In addition: Warning message:
In cor(test) : NAs introduced by coercion
2009 Sep 18
1
Within-group correlation confidence intervals
I'm trying to obtain within-group correlations on a subset of variables. I
first selected my variables using the following command:
mydata$x<-mydata[c("iq","education","achievement")]
I'd like to look at correlations among those variables separately for men
and women. My gender variable in mydata is coded 1 (women) and 0 (men).
I have successfully used
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):
>
2003 Nov 26
1
Spearman correlation and missing observations
Hi,
I am using R 1.8.1 on WinXP. I encounter a problem when trying to
compute a Spearman correlation under certain conditions (at least I
think there is a problem, but maybe this is the normal behavior).
> X<-array(0,c(20,2))
>
> X[,1]<-c(runif(10),rep(NA,10))
> X[,2]<-c(runif(10),rep(NA,10))
>
> Y<-X[1:10,]
>
>
2024 Jul 25
1
please help generate a square correlation matrix
HI Rui,
Thank you for the help!
You did not remove a row if zero values exist in both column pair, right?
Ding
From: Rui Barradas <ruipbarradas at sapo.pt>
Sent: Thursday, July 25, 2024 11:15 AM
To: Yuan Chun Ding <ycding at coh.org>; r-help at r-project.org
Subject: Re: [R] please help generate a square correlation matrix
?s 17:?39 de 25/07/2024, Yuan Chun Ding via R-help
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))
2008 Nov 26
2
Very slow: using double apply and cor.test to compute correlation p.values for 2 matrices
My two matrices are roughly the sizes of m1 and m2. I tried using two apply and cor.test to compute the correlation p.values. More than an hour, and the codes are still running. Please help to make it more efficient.
m1 <- matrix(rnorm(100000), ncol=100)
m2 <- matrix(rnorm(10000000), ncol=100)
cor.pvalues <- apply(m1, 1, function(x) { apply(m2, 1, function(y) { cor.test(x,y)$p.value