22.9k views
4 votes
The following table shows a sample dataset of observation values of an independent variable, x, and a dependent variable, y x 4 5 3 6 10 y 4 6 5 7 7 Compute the correlation coefficient between the two variables

User Spyral
by
7.9k points

1 Answer

2 votes

The value of R is 0.7522. This is a strong positive correlation, which means that high X variable scores go with high Y variable scores

How to solve for R

X Values

∑ = 28

Mean = 5.6

∑(X - Mx)² = SSx = 29.2

Y Values

∑ = 29

Mean = 5.8

∑(Y - My)² = SSy = 6.8

X and Y Combined

N = 5

∑(X - Mx)(Y - My) = 10.6

R Calculation

r = ∑((X - My)(Y - Mx)) / √((SSx)(SSy))

r = 10.6 / √((29.2)(6.8)) = 0.7522

r = 0.7522

Using python we can solve this also as:

import numpy as np

# Sample data

x = np.array([4, 5, 3, 6, 10])

y = np.array([4, 6, 5, 7, 7])

# Calculate the correlation coefficient

correlation_coefficient = np.corrcoef(x, y)[0, 1]

# Print the correlation coefficient

print(correlation_coefficient)

output is 0.7522461664398489

The following table shows a sample dataset of observation values of an independent-example-1
User Marc Thibault
by
8.1k points