[R] [Help] a Correlation Problem
Gabor Grothendieck
ggrothendieck at gmail.com
Mon Apr 10 05:18:33 CEST 2006
Try this where g is f summed over j and k for given scalars
theta and rho and gv is g vectorized over theta. I have not
checked this carefully so be sure you do:
f <- function(theta = 0, rho = 0, j = 0, k = 0)
dnorm(theta+2*pi*j,0,1)*pnorm(2*pi*(k+1)-rho*(theta+2*pi*j))
g <- function(theta = 0, j = 0, k = 0)
sum(sapply(k, function(k) sum(f(theta, j = j, k = k))))
gv <- function(theta = 0, ...) sapply(theta, g, ...)
x <- seq(0, pi, length = 100)
plot(x, gv(x, j = -1:1, k = -1:1))
On 4/9/06, kenzy ken <lzlgboy at gmail.com> wrote:
> I encounter a statistic problem about correlation.
> I use R to test wether two variables are correlated or not.
>
>
> (pearson correlation)
> cor.test(x,y) give a p=5.87....
>
> Because the x, y is not normal distributed (qqplot indicate that) I
> also perform
> (spearman rank correlation)
> cor.test(x,y,method="spearman") give a very significant result p<10e-4
>
>
> I don't know how to explain this. Will this result tell us that x, y
> are correlated but not a linear one, and we can't
> use the coefficient estimated by spearman rank correlation because its
> interpretation is not quite clear.
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>
More information about the R-help
mailing list