Skip to content

Linear Regression: Analysis of Variance ANOVA Table in Python Videos

Last Update: March 22, 2022

My online video tutorials are hosted at YouTube channel.

For learning this concept, you can view my online video tutorials: Linear Regression: Analysis of Variance ANOVA Table in Python (Spyder) and Linear Regression: Analysis of Variance ANOVA Table in Python (Jupyter).

Videos Code

1. Package

import statsmodels.api as sm
import statsmodels.formula.api as smf

2. Data

houseprices_object = sm.datasets.get_rdataset(dataname="HousePrices",
                                              package="AER", cache=True)
houseprices = houseprices_object.data
print(houseprices.iloc[:, 0:3].head())
print(houseprices_object.__doc__)

3. Model

mlr = smf.ols(formula="price ~ lotsize + bedrooms", 
              data=houseprices).fit()
print(mlr.summary())

4. Analysis of Variance

lr1 = smf.ols(formula="price ~ 1", data=houseprices).fit()
anova = sm.stats.anova_lm(lr1, mlr, test="F", typ="I")
print(anova)

Courses

My online courses are hosted at Teachable website.

For more details on this concept, you can view my Linear Regression in Python Course.

My online courses are closed for enrollment.
+