import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
# Residuals should follow a normal distribution
residuals = model.resid
# Create a 1x2 plot figure.
fig, axes = plt.subplots(1, 2, figsize = (8,4))
# Create a histogram with the residuals.
sns.histplot(residuals, ax=axes[0])
# Set the x label of the residual plot.
axes[0].set_xlabel("Residual Value")
# Set the title of the residual plot.
axes[0].set_title("Histogram of Residuals")
# Create a QQ plot of the residuals.
sm.qqplot(residuals, line='s',ax = axes[1])
# Set the title of the QQ plot.
axes[1].set_title("Normal QQ Plot")
# Use matplotlib's tight_layout() function to add space between plots
# for a cleaner appearance.
plt.tight_layout()
# Show the plot.
plt.show()