## What is a Pearson Correlation Analysis?

Correlation describes the strength and direction of the linear relationship between two variables. Pearson’s correlation coefficient is used for interval variables, and Pearson’s correlation coefficient can only take values from -1 to +1. The sign indicates whether the correlation is positive (both variables decrease or increase) or negative (one variable decreases when the other increases and vice versa). A perfect correlation, 1 or -1, indicates that the value of one variable can be accurately determined when we know the value of the other. A correlation equal to 0 indicates no relationship between the two variables.

**When Should a Pearson Correlation be Used?**

**Pearson’s correlation coefficient**is the test statistic that measures the statistical relationship, or association, between two continuous variables. So, you should use the Pearson correlation coefficient when (1) the relationship is linear and (2) both variables are quantitative and (3) normally distributed, and (4) have no outliers.

### An Example Of **Pearson Correlation Test**

For example, a teacher wants to examine the relationship between the level of anxiety and the exam score. Then we have two variables: the level of anxiety and the exam score.

**What are the use of null and alternative hypothesis for the correlation analysis?**

Therefore, we test the following hypotheses:

* Null hypothesis:* There is no significant effect relationship between the level of anxiety and exam score.

* Alternative hypothesis*: There is a significant effect relationship between the level of anxiety and exam score

## R function to Compute Pearson Correlation

The code to run a Pearson Correlation Analysis using R is as follows:

cor.test (x, y, method=(“pearson”, “kendall”, “spearman”), data = dataframe)

**x, y**: numeric vectors with the same length

**method**: correlation method