Questions tagged [pearson]

in statistics, Pearson's r, the Pearson product moment correlation coefficient, shows the extent of a linear relationship between two data sets on a scale from -1 to 1.

Overview

Pearson product-moment correlation coefficient is given by the following equation:

enter image description here

where,

pXY = Pearson’s correlation coefficient;
Cov(X,Y) = covariance of random variables X and Y;
Var(X) = variance of random variable X;
Var(Y) = variance of random variable Y;


Tag usage

Questions on tag should be about implementation and programming problems, not about the statistical or theoretical properties of the technique. Consider whether your question might be better suited to Cross Validated, the StackExchange site for statistics, machine learning and data analysis.

155 questions
1
vote
1 answer

Need some pointing in the right direction with regards to calculating Pearson's correlation in java

I am trying to calculate Pearsons correlation between 13 variables in a tab delimited text file where each column is a variable. I am using java and was hoping that somebody can give me some guidance as to which libraries or which functions I…
Jetnor
  • 521
  • 2
  • 11
  • 26
1
vote
0 answers

Pearson Correlation and P values for large data matrices python

So here is the issue I am having. I have a bunch of large data matrices ~ 500 x 30000. I need to calculate the Pearson correlation coefficient and if it has a significant p value. scipy.stats.pearsonr does not handle matrices so I wrote the…
1
vote
1 answer

R - how to limit output for hmisc rcorr?

I have two data frames motivation_on with 60 observations and motivation_off with 146 observations, each consists of 21 vars and 1 ID column, which is in the first column. Now I want to know how the vars correlate with each other so I…
florian
  • 604
  • 8
  • 31
1
vote
1 answer

Not getting expected correlation values - R cor()

I was getting all NA values except for the diagonal entries while finding correlation using R's cor(). I removed NAs pairwise. When I explicitly removed the NAs then I got the desired results. Have I misunderstood the arguments? I tried > c <-…
Shivendra
  • 1,076
  • 2
  • 12
  • 26
1
vote
2 answers

How to loop subset of lists in R?

I have a list of 9 lists, see the following code where I want to loop only three lists p, r and t for Pearson, Spearson and Kendall correlations, respectively, instead of all 9 lists. The current pseudocode is the following where the test function…
Léo Léopold Hertz 준영
  • 134,464
  • 179
  • 445
  • 697
1
vote
1 answer

computationally singular Error in cortest .mat function

I have some correlation matrices and would like to test whether they are statistically equal. For this, I am using the cortest.mat function from the psych package, but get the following error: Error in solve.default(R1) : system is computationally…
NKGon
  • 55
  • 8
1
vote
1 answer

How do I resolve an error below in R when doing a Pearson correlation?

This is the error message: "In writeBin(v, x@file@con, size = x@file@dsize) : problem writing to connection 6: In .rasterFromRasterFile(grdfile, band = band, objecttype) : size of values file does not match the number of cells (given the…
Tyruno
  • 25
  • 1
  • 8
1
vote
1 answer

Correlation surface in R

This is my third attempt on explaining my problem. Hope I can get it right this time, it is difficult problem to explain. I have 90x19 matrix where each of the 90 rows is a series of 19 measurements on a certain wavelength. The 90 wavelengths goes…
Emiliano
  • 47
  • 9
1
vote
2 answers

report unique combinations of cor() output

I want to report all unique values in a (melted) correlations matrix. If I do: melt(cor(x,method="pearson",use="complete.obs")) I will get: VarA VarA 1 VarA VarB 0.001 VarA VarC -0.002 VarB VarB 1 VarB VarA 0.001 VarB …
brucezepplin
  • 9,202
  • 26
  • 76
  • 129
1
vote
1 answer

R - How to select specific values

I'm working in healthcare and I need help on how to use R. I explain: I have a set of data like that: S1 S2 S3 S4 S5 0.498 1.48 1.43 0.536 0.548 2.03 1.7 3.74 2.13 2.02 0.272 0.242 0.989 0.534 …
3273
  • 13
  • 1
  • 4
1
vote
1 answer

Pearson Hash implementation in Haskell

I have to write this Pearson Hash for school, but I never heard of it so it's difficult to imagine how it works. That is makes things more difficult that I learned haskell a long time ago and I almost forgot it. Here is the thing: They gave me that…
1
vote
2 answers

Invalid use of group function; attempting to find pearson correlation

I'm trying to figure how to calculate the pearson correlation coefficient using sql. Here is the formula I'm using: and here is the table I'm using: This is what I have so far for a query but it's giving me this message: Invalid use of group…
Connor Pearson
  • 63,902
  • 28
  • 145
  • 142
1
vote
2 answers

Correlation matrix for different treatments in R

With the code below I have created a correlation matrix. The code below just creates a matrix for all of the data, regardless of treatment. However, a column in my data is treatment. I would like to make two different matrices (one for each…
user1977802
  • 313
  • 6
  • 10
  • 18
1
vote
1 answer

Finding correlation in an enum type data

I have the following dataset containing information about countries 5,1,648,16,10,2,0,3,5,1,1,0,1,1,1,0,0,0,0,0,1,0,0,1,0,0, 3,1,29,3,6,6,0,0,3,1,0,0,1,0,1,0,0,0,0,0,1,0,0,0,1,0, 4,1,2388,20,8,2,2,0,3,1,1,0,0,1,0,0,0,0,0,0,1,1,0,0,0,0, ... The…
Drakthal
  • 193
  • 3
  • 14
1
vote
1 answer

Correlation between first and third variable

Let's say we have correlation between x and y as corr(x,y) and correlation between y and z as corr(y,z). What can be said of the correlation between x and z i.e. corr(x,z)? Thank you for reading.
nth
  • 141
  • 1
  • 1
  • 9