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
0
votes
1 answer

Can we generate data from two exponential distributions with correlation -1

https://stats.stackexchange.com/questions/66775/attainable-correlations-for-exponential-random-variables With reference to the above link I want to ask if it is impossible to generate two exponential distributions with correlation -1 ?
0
votes
1 answer

t-test of the Pearson correlation in R

While looking at the cor.test function in R, used to compute (among others) the Pearson correlation, I saw that the t-statistics, used later to calculate the p-value is STATISTIC <- c(t = sqrt(df) * r/sqrt(1 - r^2)) where r is the correlation…
Xavier Prudent
  • 1,570
  • 3
  • 25
  • 54
0
votes
1 answer

R: construct data frame with all pairwise correlations & significance levels between numeric variables

To be able to get the pairwise correlations and significance levels between all numeric variables in a data frame, I wrote the following little function: corwithsign=function(df,type="pearson") { df=df[,sapply(df, is.numeric)] # only keep numeric…
Tom Wenseleers
  • 7,535
  • 7
  • 63
  • 103
0
votes
1 answer

Pearson's Correlation in Python

I have a python's code about similarity user with Pearson's Correlation and I want to analysis the step of calculation because I'm a beginner with Python hehe. When I try to calculate manually and compare with the result of this program, the result…
0
votes
1 answer

Is this an approach to user-item recommendations that could work

I am designing an application that incorporates a recommendation system base on user interactions (collaborative filtering). The user on his homepage is presented a set of 6 items to interact with. There will be between 50 and 300 items. The…
0
votes
1 answer

comparing two frequency spectra

I'm trying to compare two frequency spectra but I am confused over a number of points. One device samples at 40 Hz the other at 100 Hz and so I'm not sure if I need to take this into account. Anyway I have produced frequency spectra from both…
branny12000
  • 185
  • 1
  • 1
  • 10
0
votes
1 answer

Feature selection for sparse and unbalanced high dimensional data

I have a highly unbalanced data with very scarce positive labels. The data is very high dimensional. On top of that my features are also very sparse. So what would be the best way to do feature selection in this case. Any correlation measure rank…
user34790
  • 2,020
  • 7
  • 30
  • 37
0
votes
1 answer

Outputting N and significance for Pearson Correlation in R

I've got 400 store departments and I'm running (Pearson) correlations between all the departments. How can I output the 'N' (number of cases) and the significance level (p value)? I'm using the cor function. Here is my current code which works…
Lucas
  • 401
  • 1
  • 8
  • 20
0
votes
1 answer

Pearson correlation condidency interval

I am newbie on statistic and need to do some simple correlation test on my thesis work, I am following this guilde to calculate person correlation between 2 sample result n1 and n2. The input data: n1: 2 2 3 5 3 4 4 4 4 4 2 4 4 2 2 4 2 2 2 5 3 2…
fuyi
  • 2,573
  • 4
  • 23
  • 46
0
votes
2 answers

Pearson Product-Moment Correlation Coefficient Weighting in Python

I am currently using the following function to calculate the Pearson Product-Moment Correlation Coefficient in python. def PearsonCoefficient(x, y): assert len(x) == len(y) n = len(x) assert n > 0 avg_x = float(sum(x)) / n avg_y =…
fungus1487
  • 1,760
  • 2
  • 20
  • 39
0
votes
1 answer

how to find correlation between different dimension matrices in matlab

I have 2 matrices of dim 15*3 and 10*3 . I want to find their correlation (Pearson coefficient) between the 2 matrices. I used the command result=corr2(A,B) But i got the error stating that A and B of same size. Can anyone tell me what is wrong in…
Keerthana
  • 157
  • 4
  • 18
0
votes
2 answers

Draw Graph for Pearson's Correlation Algo

I am using Pearson's Correlation Algorithm to find dependency between two variables. This algorithm return a value between -1 and 1, which tell relation b/w two variables. My problem is that i want to visualize output graphically, not discrete…
0
votes
1 answer

How to produce a data set in MATLAB in which variables will correlate to a prespecified level?

I'm looking to create a data set with three columns and an arbitrary number of rows. I'd like column 1 to have a Pearson correlation .20 with column 2, column 1 to correlate .24 with column 3, and column 2 to correlate .3 with column 3. How do I…
0
votes
2 answers

How to calculate correlation if one value is 0

For calculation the pearsons coefficient between two arrays I use the following : double[] arr1 = new double[4]; arr1[0] = 1; arr1[1] = 1; arr1[2] = 1; arr1[3] = 1; double[] arr2 = new double[4]; arr2[0] = 1; …
blue-sky
  • 51,962
  • 152
  • 427
  • 752
0
votes
1 answer

Error in counter variable?

I have a quick question about a glitch in this coding. When I ran this program and it entered this loop (by inputting 1 as the number), everything went smoothly, except that even though I entered ++generalcounter1; into the body of the loop, it…
1 2 3
10
11