HTML tutorial
CSS3 tutorial
Bootstrap tutorial
JavaScript tutorial
JQuery tutorial
AngularJS tutorial
React tutorial
NodeJS tutorial
PHP tutorial
Python tutorial
Python3 tutorial
Django tutorial
Linux tutorial
Docker tutorial
Ruby tutorial
Java tutorial
C tutorial
C ++ tutorial
Perl tutorial
JSP tutorial
Lua tutorial
Scala tutorial
Go tutorial
ASP.NET tutorial
C # tutorial
R-Squared and Adjusted R-Squared describes how well the linear regression model fits the data points
R-Squared and Adjusted R-Squared describes how well the linear regression model fits the data points:
The value of R-Squared is always between 0 to 1 (0% to 100%).
Our regression model shows a R-Squared value of zero, which means that the linear regression function line does not fit the data well.
This can be visualized when we plot the linear regression function through the data points of Average_Pulse and Calorie_Burnage.
However, if we plot Duration and Calorie_Burnage, the R-Squared increases. Here, we see that the data points are close to the linear regression function line:
Here is the code in Python:
import pandas as pd
import matplotlib.pyplot as plt
from scipy
import stats
full_health_data = pd.read_csv("data.csv", header=0, sep=",")
x = full_health_data["Duration"]
y =
full_health_data ["Calorie_Burnage"]
slope, intercept, r, p, std_err =
stats.linregress(x, y)
def myfunc(x):
return slope * x + intercept
mymodel = list(map(myfunc, x))
print(mymodel)
plt.scatter(x,
y)
plt.plot(x, mymodel)
plt.ylim(ymin=0, ymax=2000)
plt.xlim(xmin=0,
xmax=200)
plt.xlabel("Duration")
plt.ylabel ("Calorie_Burnage")
plt.show()
How can we summarize the linear regression function with Average_Pulse as explanatory variable?