in Others edited by
1,703 views
0 votes
0 votes

The Pearson's correlation coefficient between $\mathrm{x}$ and $\mathrm{y}$ rounded to the first decimal point for the given data in below table is:

$\mathbf{x}$ $\mathbf{y}$
$-6$ $6.4$
$2$ $4.7$
$0.2$ $8$
$7$ $2$
$-4$ $3.4$

 

  1. $-0.5$
  2. $0.5$
  3. $0.3$
  4. $-0.3$ 

     

in Others edited by
by
1.7k views

2 Answers

2 votes
2 votes

Ans: 
It is direct application of formula for Pearson correlation coefficient. 

 

0 votes
0 votes
import pandas as pd
 
# Create the data
data = {
    "x": [-6, 2, 0.2, 7, -4],
    "y": [6.4, 4.7, 8, 2, 3.4]
}
 
# Load data into DataFrame
df = pd.DataFrame(data)
 
# Calculate Pearson's correlation coefficient
correlation = df['x'].corr(df['y'], method='pearson')
 
# Round to one decimal place
rounded_correlation = round(correlation, 1)
 
# Print the result
print(rounded_correlation)
# answer is -0.5

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

64.3k questions

77.9k answers

244k comments

80.0k users