Practical - 5 Test for correlation coefficient using Python 1. Find the value of the correlation coefficient and the regression equation to the following table: Age 43 21 25 42 57 59 Glucose Level 99 65 79 75 87 81 import numpy as np import pandas as pd import matplotlib.pyplot as plt # To visualize from scipy.stats import pearsonr from sklearn.linear_model import LinearRegression table = pd.read_excel("C:/Users/Naveen/OneDrive/Desktop/measures of central tendency.xlsx") print(table.head()) corr = pearsonr(table.marks, table.hours) corr plt.scatter(table.marks, table.hours) plt.xlabel(“Age”) plt.ylabel(“Glucose Level”)
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter