Visualizing Regression Plots
Explore how to visualize regression models and smoothing techniques with Plotly. Understand scatter plot smoothing, linear regression, LOWESS curves, moving averages, exponential smoothing, and 3D scatter plots to analyze complex datasets effectively.
Scatter plot smoothing
Scatter plot smoothing is a statistical technique used to gain an understanding of the general patterns in the data by creating a curve with a smoothed estimate of the relationship between two variables, x and y. It is also particularly useful for assessing bivariate outliers and influential observations that may affect the relationship between the variables.
This is a
-
GNP.deflator: GNP implicit price deflator (1954=100) -
GNP: Gross National Product -
Unemployed: Number of unemployed -
Armed.Forces: Number of people in the armed forces -
Population: ‘noninstitutionalized’ population ≥ 14 years of age -
Year: The year (time) -
Employed: Number of people employed
Note: This dataset is often used to demonstrate how regressing
Employedon the remaining variables causes multicollinearity.
Linear regression
Plotly Express allows us to fit a linear regression to a dataset with an x and y variable. We do this by placing a trendline="ols" argument to specify that we wish to use an ordinary least squares regression model. We can set the color of the line using trendline_color_override. By hovering over the trend line, we gain an insight into the slope, intercept, coefficient of determination (), and prediction ...