Displaying 20 results from an estimated 6000 matches similar to: "[Help] a Correlation Problem"
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
2009 Aug 16
2
bootstrapped correlation confint lower than -1 ?
Dear R users,
Does the results below make any sense? Can the the interval of the
correlation coefficient be between *-1.0185* and -0.8265 at 95%
confidence level?
Liviu
> library(boot)
> data(mtcars)
> with(mtcars, cor.test(mpg, wt, met="spearman"))
Spearman's rank correlation rho
data: mpg and wt
S = 10292, p-value = 1.488e-11
alternative hypothesis: true rho is not
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))
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,
2003 May 01
3
Test statistic for Spearman correlation
In the ouput below, what is the "S" statistic (S = 96) that is used for Spearman? I don't have easy access to the books cited on the help page. Other texts and web sources that I have found use t or z as a test for Spearman, perhaps inappropriately. Can anyone tell me how S is computed or refer to a web resource?
I see from the code for that:
q <- as.integer((n^3 - n) * (1
2003 Apr 29
4
thick plot lines
Dear People,
In a qqplot I am doing, I get lines/points that are very thick. I've tried
setting the lwd variable to 0.1, but it doesn't seem to have any effect.
Also, I have set the value of lty to dashed, but I still get dots. The
command looks like
qqplot(cdf.inv(seq(0,1,length=size),theta,pos,len),empmargdistvec(len,theta,pos,size),
xlim=c(-theta,theta), ylim=c(-theta,theta),
2011 Aug 09
1
Correlation Matrix - p value?
Hello all,
I've run a Spearman's Rank test to discern relationships between landscape
characteristics and a specific aspect of river behaviour.
I've executed a correlation matrix between the one dependent variable and
all of the predictors, which gives me a nice output of Spearman's Rho
values.
However, I also need to somehow find the "p" value, to assess the strength
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]]
2003 Oct 22
6
Something strange in cor.test in R-1.8.0 (PR#4718)
Full_Name: Ian Wilson
Version: R-1.8.0
OS: Windows (but own compilation)
Submission from: (NULL) (139.133.7.38)
the p-value is incorrect for cor.test using method "spearman" in R-1.8.0. This
was not the case in R-1.7.1.
Version R-1.8.0 on Windows
> cor.test(rnorm(50),rnorm(50),method="spearman")
Spearman's rank correlation rho
data: rnorm(50) and rnorm(50)
S
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")
>
2003 Oct 17
1
correlation matrix in Hmisc
Dear all,
I am trying to compute a matrix of Pearson's `r' or Spearman's `rho'
rank correlation coefficients using rcorr (Hmisc) the following way:
> mx<-rcorr(x, type="spearman")[1]
but then ...
> is.matrix(mx)
[1] FALSE
Even if I use as.matrix the result is not better.
What can I do?
Thank you all
Luca
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 =
2010 Jun 08
2
cor.test() -- how to get the value of a coefficient
Hi, all.
Yet another beginner to R : )
I wonder, how it's possible to get the value of a coefficient from the
object produced by cor.test() ?
> cor.test(a, b, method="spearman")
Spearman's rank correlation rho
data: a and b
S = 21554.28, p-value = 2.496e-11
alternative hypothesis: true rho is not equal to 0
sample estimates:
rho
0.6807955
Warning message:
In
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):
>
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",
2023 Nov 15
1
Cannot calculate confidence intervals NULL
I believe the problem is here:
cor1 <- cor(x1, y1, method="spearman")
cor2 <- cor(x2, y2, method="spearman")
The x's and y's are not looked for in data (i.e. NSE) but in the
environment where the function was defined, which is standard evaluation.
Change the above to:
cor1 <- with(d, cor(x1, y1, method="spearman"))
cor2 <- with(d, cor(x2, y2,
2011 Jun 18
1
Conditional Correlation
Hi,
How can I accomplish this in R. Example:
I have the following data.frame:
data <- data.frame(x=c(1,2,3,4,5,6,5,3,7,1,0,4,8),y=c(1,2,1,2,2,2,1,1,1,2,2,2,2),z=c(5,8,4,3,4,1,6,3,3,6,3,5,7))
Supposing that data$y is a factor, I would like to find the Spearman correlation between data$x and data$z indexing it by data$y.
To be more specific, I want to find two correlations: between x and z
2023 Nov 15
2
Cannot calculate confidence intervals NULL
R-Experts,
Here below my R code working without error message but I don't get the results I am expecting.
Here is the result I get:
[1] "All values of t are equal to 0.28611928397257 \n Cannot calculate confidence intervals"
NULL
If someone knows how to solve my problem, really appreciate.
Best,
S
#########################################################
# Difference in Spearman
2010 Apr 24
1
Multiple Correlation coefficient (spearman, Kenall)
Hi,
I'm currently trying to find/define a relationship between one dependent and
several independant variables.
The problem is that i cannot use the normal multiple regression/correlation
in Spss because the data is not normal distributed.
i calculated the spearman roh and Kendalls tau Correlation and also some
partial correlations in R.
Now i wanna find out the the multiple correlation
2009 Apr 17
1
Turning off warnings from cor.test
I would like to turn off the warnings from cor.test while retaining
exact=NULL. Is that possible ?
> cor.test(c(1,2,3,3,4,5), c(1,2,3,3,4,5), method = "spearman")
Spearman's rank correlation rho
data: c(1, 2, 3, 3, 4, 5) and c(1, 2, 3, 3, 4, 5)
S = 0, p-value < 2.2e-16
alternative hypothesis: true rho is not equal to 0
sample estimates:
rho
1
Warning message:
In