...

/

Exercise: Visualizing Regression Plots

Exercise: Visualizing Regression Plots

Practice with some lab exercises.

Exercise 1

Create a scatter plot with the Sales variable plotted against TV. Include a red trendline of the line of best fit using Ordinary Least Squares (OLS). What is the R2R^2 value?

Solution

  • A scatter plot is created using the px.scatter() function on line 2 with the advertising DataFrame. The x parameter is set to TV to specify the x-axis data, and the y parameter is set to Sales to specify the y-axis data. The trendline parameter is set to ols ...