06 Introduction to residuals and least-squares regression
06 Introduction to residuals and least-squares regression#
%%html
<iframe width="700" height="400" src="https://www.youtube.com/embed/VqD-nf1YUks/" frameborder="0" allowfullscreen></iframe>
import numpy as np
import pandas as pd
from pandas import Series, DataFrame
import matplotlib.pyplot as plt
import seaborn as sns
from scipy import stats
x = [35, 40, 45, 50, 55, 55, 60, 60, 70, 70]
y = [45, 100, 45, 100, 125, 175, 125, 165, 165, 200 ]
plt.scatter(x, y)
plt.xlabel('Height (inches)')
plt.ylabel('Weight')
plt.show()
sns.scatterplot(x,
y,
x_bins=[0, 10, 20, 30, 40, 50, 60, 70, 80],
y_bins=[0, 50, 100, 150, 200, 250, 300])
plt.xlabel('Height (inches)')
plt.ylabel('Weight')
plt.show()
/opt/hostedtoolcache/Python/3.9.13/x64/lib/python3.9/site-packages/seaborn/_decorators.py:36: FutureWarning: Pass the following variables as keyword args: x, y. From version 0.12, the only valid positional argument will be `data`, and passing other arguments without an explicit keyword will result in an error or misinterpretation.
warnings.warn(