The Pearson Method

Best Binary Options Brokers 2020:
  • Binarium

    Top Binary Options Broker 2020!
    Perfect For Beginners and Middle-Leveled Traders!
    Free Education How To Trade!
    Free Demo Account!
    Big Sign-up Bonus!

  • Binomo

    Good Choice For Experienced Traders!

Метод метод WorksheetFunction. Пирсон (Excel) WorksheetFunction.Pearson method (Excel)

Возвращает коэффициент корреляции Пирсона r, индекс, который не имеет размерности, в диапазоне от – 1,0 до 1,0 включительно и отражает степень линейного отношения между двумя наборами данных. Returns the Pearson product moment correlation coefficient, r, a dimensionless index that ranges from -1.0 to 1.0 inclusive and reflects the extent of a linear relationship between two data sets.

Синтаксис Syntax

Expression. Пирсон (Arg1, arg2) expression.Pearson (Arg1, Arg2)

Expression (выражение ) Переменная, представляющая объект метод WorksheetFunction . expression A variable that represents a WorksheetFunction object.

Параметры Parameters

Имя Name Обязательный или необязательный Required/Optional Тип данных Data type Описание Description
Arg1 Arg1 Обязательный Required Variant Variant Массив1 — набор независимых значений. Array1 – a set of independent values.
Arg2 Arg2 Обязательный Required Variant Variant Массив2 — набор зависимых значений. Array2 – a set of dependent values.

Возвращаемое значение Return value

Double Double

Примечания Remarks

Аргументы должны быть числами или именами, константами массива или ссылками, содержащими числа. The arguments must be either numbers or names, array constants, or references that contain numbers.

Если аргумент array или Reference содержит текст, логические значения или пустые ячейки, эти значения игнорируются; Тем не менее, ячейки с нулевым значением включены. If an array or reference argument contains text, logical values, or empty cells, those values are ignored; however, cells with the value zero are included.

Если массив1 и массив2 пусты или имеют различное количество точек данных, Пирсон возвращает значение ошибки #N/a. If array1 and array2 are empty or have a different number of data points, Pearson returns the #N/A error value.

Формула коэффициента корреляции Пирсона r имеет следующий вид, где x и y — пример среднего значения (массив1) и СРЗНАЧ (массив2): The formula for the Pearson product moment correlation coefficient, r, is as follows, where x and y are the sample means AVERAGE(array1) and AVERAGE(array2):

Поддержка и обратная связь Support and feedback

Есть вопросы или отзывы, касающиеся Office VBA или этой статьи? Have questions or feedback about Office VBA or this documentation? Руководство по другим способам получения поддержки и отправки отзывов см. в статье Поддержка Office VBA и обратная связь. Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.

Pearson Coefficient of Correlation with Python

As a data scientist, this is a very exciting area for me to touch on because it helps to uncover complex and unknown relationships between the variables in your data set.

I’ll go directly into how we can do this in Python using the Pearson r Coefficient.

Python is an amazing language for data analytics, primarily because of the fantastic ecosystem of data-centric Python packages. Pandas is one of those packages and makes importing and analyzing data much easier.

dataframe.corr() explained

Pandas dataframe.corr() is used to find the pairwise correlation of all columns in a dataframe.

Any na values are automatically excluded.

Any non-numeric data type column in the dataframe will be ignored.

dataframe.corr parameters: dataframe.corr(method=”,min_periods=1)

method : or callable

  • pearson: standard correlation coefficient — learn more here
  • kendall: Kendall Tau correlation coefficient
  • spearman: Spearman rank correlation

min_periods : int, optional

  • Minimum number of observations required per pair of columns to have a valid result. This is currently only available for pearson and spearman correlation

Let’s Get Practical!

First we import the packages that we need:

Now we need some data. For this, I’ve chosen a simple but interesting data set that I came across on Kaggle. You can read and download it here.

Let’s read the data and put it in a dataframe.

If you want a glance of the data on Python and have a look at what data is in there.

Calculating the Pearson Corellation

We’ll use method = ‘pearson’ for the dataframe.cor r since we want to calculate the pearson coefficient of correlation. Then we’ll print it out!

This is nice to have, but having a large number of variables in the data will quickly make this more time consuming to interpret.

This is the reason I imported the seaborn package in pandas:

Best Binary Options Brokers 2020:
  • Binarium

    Top Binary Options Broker 2020!
    Perfect For Beginners and Middle-Leveled Traders!
    Free Education How To Trade!
    Free Demo Account!
    Big Sign-up Bonus!

  • Binomo

    Good Choice For Experienced Traders!

Quick Description — Seaborn is a python library for visualizing data. It is built on top of matplotlib and closely integrated with pandas data structures.

To make this look beautiful and easier to interpret, add this after calculating the Pearson coefficient of correlation.

Results and Interpretation

A co-efficient close to 1 means that there’s a very strong positive correlation between the two variables. In our case, the maroon shows very strong correlations. The diagonal line is the correlation of the variables to themselves — so they’ll obviously be 1.

Looking at this we can quickly see that:

  • The Human Development Index (HDI) is strongly correlated to the GDP per Capita.
  • The population also has a strong correlation to the number of suicides. This is kind of what we’d expect right? A high population will have a higher number of suicides and vice versa.


Correlating variables will save any data ninja time before diving into performing any kind of analysis on the data. In my mind, it’s more like an X-Ray into the data. Performing this kind of correlation in any project is key — you might find something useful or might find nothing at all, either way you’ve learned something about the data!

Pearson : Pearson method


The Pearson method is the most well-known method for finding users’ similarity, so to compare the genetic-based method, the Pearson method has been implemented in this package.



A rating matrix whose rows are items and columns are users.


The id of an active user as an integer greater than zero (for example active_user Threshold_KNN

Maximum number of neighbor users.


Pearson Correlation Coefficient (PCC) is the similarity measure for Collaborative filtering recommender system, to evaluate how much two users are correlated [3].


An object of class “Pearson” , a list with components:


The similarity of the Pearson method.


The prediction of the Pearson method.


A list of recommended items by the Pearson method.


Neighbors of active user in the Pearson method orderly.


The elapsed time of the Pearson method.


[1] Bobadilla, J., Ortega, F., Hernando, A. and Alcala, J. (2020). Improving collaborative filtering recommender system results and performance using genetic algorithms. Knowledge-based systems, vol. 24, no. 8, pp. 1310-1316.

[2] Lu, J., Wu, D., Mao, M., Wang W. and Zhang, G. (2020). Recommender system application developments: a survey. Decision Support Systems, vol. 74, pp. 12-32.

Best Binary Options Brokers 2020:
  • Binarium

    Top Binary Options Broker 2020!
    Perfect For Beginners and Middle-Leveled Traders!
    Free Education How To Trade!
    Free Demo Account!
    Big Sign-up Bonus!

  • Binomo

    Good Choice For Experienced Traders!

Like this post? Please share to your friends:
Binary Options Trading, Strategies and Robots
Leave a Reply

;-) :| :x :twisted: :smile: :shock: :sad: :roll: :razz: :oops: :o :mrgreen: :lol: :idea: :grin: :evil: :cry: :cool: :arrow: :???: :?: :!: