Displaying 20 results from an estimated 10000 matches similar to: "p-value in Spearman rank order"
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))
2012 Aug 29
3
Help on calculating spearman rank correlation for a data frame with conditions
Dear all,
Suppose my data frame is as follows:
id price distance
1 2 4
1 3 5
...
2 4 8
2 5 9
...
n 3 7
n 8 9
I would like to calculate the rank-order correlation between price and
distance for each id.
cor(price,distance,method = "spearman") calculate a correlation for all.
Then I tried to use
apply(data,list='id',cor(price , distance , method =
2005 Jan 25
1
spearman rank test correlation
Hallo,
does anybody know if there is an implementation of the Spearman rank
correlation in R that gives a correct (or at least 'safe') p-value in
the case of ties??
I have browsed the R-help archives but I found nothing.
Thanks a lot in advance for any help,
Antonino Casile
2003 Jan 23
1
spearman rank correlation
hello help,
i''ve searched through the manual pages and the only reference i can find to spearman rank correlation is cor.test, which only seems to give the significance value of the correlation.
is there any way to get the actual value of rho?
david.
[[alternate HTML version deleted]]
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
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 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):
>
2007 May 29
2
R's Spearman
Hi all,
I am trying to figure out the formula used by R's Spearman rho (using
cor(method="spearman")) because I can't seem to get the same value as by
calculating "by hand". Perhaps I'm using "cor" wrong, but I don't know
where. Basically, I am running these commands:
> y=read.table(file="tmp",header=TRUE,sep="\t")
>
2007 Sep 19
2
By() with method = spearman
I have a data set where I want the correlations between 2 variables
conditional on a students grade level.
This code works just fine.
by(tmp[,c('mtsc07', 'DCBASmathscoreSPRING')], tmp$Grade, cor,
use='complete', method='pearson')
However, this generates an error
by(tmp[,c('mtsc07', 'DCBASmathscoreSPRING')], tmp$Grade, cor,
use='complete',
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
2002 Apr 26
2
Spearman Correlation
Hi all,
Is there a convenient way to calculate Spearman correlation coefficients in
R?
Nick
Nianqing Xiao, Ph.D
NCI Center for Bioinformatics, NIH
SAIC/Advanced Systems Group
> 6116 EXECUTIVE BLVD 4026J
> MSC 8335
> BETHESDA MD 20852
Phone: 301-451-6357
Fax: 301-480-4222
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read
2011 Nov 01
1
How to interpret Spearman Correlation
Hi,
I am not really familiar with Correlation foundations, although I read
a lot. So maybe if someone kindly help me to interpret the following
results.
I had the following R commands:
correlation <-cor( vector_CitationProximity , vector_Impact, method =
"spearman", use="na.or.complete")
cor_test<-cor.test(vector_CitationProximity, vector_Impact,
2013 Feb 13
5
spearman correlation and p-value as a matrix
I have two data matrices that I want to make the correlation between each column from data1 and each column from data 2 and also calculate the p-value Matrices dont have the same size and I tried such a script.
> bg <- read.table (file.choose(), header=T, row.names)
> bg
> Otu00022 Otu00029 Otu00039 Otu00042 Otu00101 Otu00105 Otu00125 Otu00131 Otu00137 Otu00155 Otu00158 Otu00172
2006 Sep 13
1
S in cor.test(..., method="spearman")
Dear HelpeRs,
I have some data:
"ice" <- structure(c(0.386, 0.374, 0.393, 0.425, 0.406, 0.344,
0.327, 0.288, 0.269, 0.256, 0.286, 0.298, 0.329, 0.318, 0.381,
0.381, 0.47, 0.443, 0.386, 0.342, 0.319, 0.307, 0.284, 0.326,
0.309, 0.359, 0.376, 0.416, 0.437, 0.548, 41, 56, 63, 68,
69, 65, 61, 47, 32, 24, 28, 26, 32, 40, 55, 63, 72, 72, 67,
60, 44, 40, 32, 27, 28, 33,
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
2013 Feb 28
1
PCA with spearman and kendall correlations
Hello,
I would like to do a PCA with dudi.pca or PCA, but also with the use of Spearman or Kendall correlations
Is it possible ?
Otherwise, how can I do, according to you ?
Thanking you in advance
Eric Bourgade
RTE
France
[[alternative HTML version deleted]]
2004 May 20
1
Spearman probabilities and SuppDists
cor.test and SuppDists give me different P-values for the same
Spearman's rho. Which is correct, or am I doing something wrong?
> 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)
> cor.test(x,y,method="spearman")
Spearman's rank correlation rho
data: x and y
S = 48, p-value =
2003 Nov 07
2
Bug in cor.test - Spearman
Greetings.
There seems to be a problem with the P-value computation in the
cor.test with method="spearman". In R1.8.0 (MS Windows) I
seem to be getting intermittently nonsense P-values, but the rho's
are OK. I can get this reproducibly with the toy example attached
where the first use is OK and subsequent calls with the same data
give nonsense. (I have also seen the problem
2007 Sep 20
1
Bug with Cor(..., method='spearman") and by() (PR#9921)
I posted this on R help, and a few others responded indicating they too
were able to replicate the error as a function of missing data. I
believe this should not be the case and hence and reporting it here.
### Code provided on R-Help by Ivar Herfindal
# Simulate data
testdata <- cbind.data.frame(gr=3Drep(letters[1:4], each=3D5), =
aa=3Drnorm(20),
bb=3Drnorm(20))
# Introduce some missingness
2005 Oct 07
1
cor() function, method="spearman"
Hello,
Does anyone know if the cor function, when method = "spearman", returns a correlation coefficient corrected for any ties in the ranks of the data? I have data with quite a few ties and am thinking that I should use a calculation of the coefficient corrected for ties, but before I try and code this calculation myself, I thought I should check whether or not cor() automatically