<gh_stars>0
'''
For practice, perform a linear regression on the data set from Anscombe's quartet that is most reasonably interpreted with linear regression.
'''
# Perform linear regression: a, b
a, b = np.polyfit(x, y, 1)

# Print the slope and intercept
print(a, b)

# Generate theoretical x and y data: x_theor, y_theor
x_theor = np.array([3, 15])
y_theor = a * x_theor + b

# Plot the Anscombe data and theoretical line
_ = plt.plot(x, y, marker='.', linestyle='none')
_ = plt.plot(x_theor, y_theor, marker='.', linestyle='none')

# Label the axes
plt.xlabel('x')
plt.ylabel('y')

# Show the plot
plt.show()
'''
For practice, perform a linear regression on the data set from Anscombe's quartet that is most reasonably interpreted with linear regression.
'''
# Perform linear regression: a, b
a, b = np.polyfit(x, y, 1)

# Print the slope and intercept
print(a, b)

# Generate theoretical x and y data: x_theor, y_theor
x_theor = np.array([3, 15])
y_theor = a * x_theor + b

# Plot the Anscombe data and theoretical line
_ = plt.plot(x, y, marker='.', linestyle='none')
_ = plt.plot(x_theor, y_theor, marker='.', linestyle='none')

# Label the axes
plt.xlabel('x')
plt.ylabel('y')

# Show the plot
plt.show()
For practice, perform a linear regression on the data set from Anscombe's quartet that is most reasonably interpreted with linear regression. # Perform linear regression: a, b # Print the slope and intercept # Generate theoretical x and y data: x_theor, y_theor # Plot the Anscombe data and theoretical line # Label the axes # Show the plot