Skip to content

Homogeneity of Regression Slopes: Dummy Variables 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: Homogeneity of Regression Slopes: Dummy Variables in Python (Spyder) and Homogeneity of Regression Slopes: Dummy Variables 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.head())
print(houseprices_object.__doc__)

3. Model

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

4. Homogeneity

Wald Test

waldtest = mlr.wald_test(r_matrix="aircon[T.yes] = \
                         lotsize:aircon[T.yes] = \
                         bedrooms:aircon[T.yes] = 0", use_f=True)
print(waldtest)

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.
+