SOLUTION: Find the equation of the least squares regression line (line of best fit). Note: Use the number of phones sold in the month of February as the independent variable, x, and the comm

Algebra ->  Equations -> SOLUTION: Find the equation of the least squares regression line (line of best fit). Note: Use the number of phones sold in the month of February as the independent variable, x, and the comm      Log On


   



Question 1164822: Find the equation of the least squares regression line (line of best fit). Note: Use the number of phones sold in the month of February as the independent variable, x, and the commission on those sales as the dependent variable, y. (No work required.)

b. State the value of the correlation coefficient r and comment on the goodness of fit.



Plans sold(x) Commission(y)
14. 243
16. 312
17. 279
18. 308
11 199
15. 219
23. 504
24. 550
14. 260
17. 255

Answer by CPhill(2189) About Me  (Show Source):
You can put this solution on YOUR website!
```python
import numpy as np
from scipy import stats
import matplotlib.pyplot as plt
x = np.array([14, 16, 17, 18, 11, 15, 23, 24, 14, 17])
y = np.array([243, 312, 279, 308, 199, 219, 504, 550, 260, 255])
slope, intercept, r_value, p_value, std_err = stats.linregress(x, y)
print(f"{slope=}")
print(f"{intercept=}")
print(f"{r_value=}")
# For plotting
plt.scatter(x, y, color='blue', label='Data Points')
plt.plot(x, slope * x + intercept, color='red', label='Regression Line')
plt.xlabel('Plans Sold (x)')
plt.ylabel('Commission (y)')
plt.title('Least Squares Regression Line')
plt.legend()
plt.grid(True)
plt.savefig('regression_plot.png')


```
```text
slope=27.894409937888202
intercept=-158.51552795031063
r_value=0.9431913989966259

```
To find the least squares regression line and the correlation coefficient for the given data, we perform a linear regression analysis.
### a. Equation of the Least Squares Regression Line
Using the provided data, we calculate the slope () and the -intercept () for the equation .
* **Slope ():**
* **-intercept ():**
**The equation of the regression line is:**

---
### b. Correlation Coefficient and Goodness of Fit
The correlation coefficient () measures the strength and direction of the linear relationship between the two variables.
* **Correlation Coefficient ():**
**Comment on Goodness of Fit:**
A correlation coefficient of **0.9432** indicates a **very strong positive linear relationship** between the number of plans sold and the commission earned. Since is close to 1, the regression line provides an excellent fit for the data, meaning that as the number of plans sold increases, the commission tends to increase in a highly predictable manner.
Would you like me to use this equation to predict the commission for a specific number of sales, such as 20 plans?