[R] is there a function to give significance to correlation?
Ranjan Maitra
maitra at iastate.edu
Thu Apr 19 14:47:46 CEST 2007
Hi Jenny,
On Thu, 19 Apr 2007 12:48:50 +0100 (BST) Jenny Barnes <jmb at mssl.ucl.ac.uk> wrote:
> Dear R-Help,
>
> I am trying to find a function that will give me the significance of the
> correlation of 2 variables (in the same dimension arrays) correcting for serial
> autocorrelation.
I am not sure what you mean. It appears that you have correlated pairs of observations and you want to find if the correlation between the pairs are significant. I guess you can use a linear model of one array index observation against the other with autocorrelated errors for each pair of your data below.
> How can I view the function cor.test's code? I would like to know a lot more
> detail about the function than written in the documentation at
> http://finzi.psych.upenn.edu/R/library/stats/html/cor.test.html
> to see if this would do the job?
You could download the .tgz file, extract it and look at cor.test.R. It is in
/usr/local/maitra/Desktop/R-2.4.0/src/library/stats/R/cor.test.R
depending on which .tgz file you downloaded: I have an old one (R-2.4.0) sitting on this computer (not binary).
Note that even if you assume each of your (31, 31) grid to be independent, you will run into the problem of multiple testing, for which you can use false discovery rate methods. However, your (31, 31) grid may not be close to independent.
HTH,
Best wishes,
Ranjan
>
> I would gratefully appreciate any help you can offer me on these two interlinked
> issues,
>
> Many thanks for your time and consideration,
>
> Jenny
>
> PS. If you would like more detail I have two arrays both of dimensions
> [31,31,43]. 31x31 is latitude and longitude, 43 is years of rainfall data. I
> have produced a spearmans rank correlation map of these 2 arrays over this 43
> year period. I now need to find the significance for each of the 31x31 grid
> points........
>
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Jennifer Barnes
> PhD student: long range drought prediction
> Climate Extremes Group
> Department of Space and Climate Physics
> University College London
> Holmbury St Mary
> Dorking, Surrey, RH5 6NT
> Tel: 01483 204149
> Mob: 07916 139187
> Web: http://climate.mssl.ucl.ac.uk
>
> ______________________________________________
> 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
> and provide commented, minimal, self-contained, reproducible code.
>
More information about the R-help
mailing list