pythonlinearmodelsseemingly-unrelated-regression

Constraining select coefficients to be the same across equations in a SUR system


I want to estimate Labor Force Participation Rates for different age groups in a system of seemingly unrelated regressions (SUR), regressing them on some age group specific variables and shared birth-cohort dummies. This is the typical cohort-based approach (see for example Grigoli et al (2018).

I manage to estimate the system as a SUR using linearmodels, but I cannot figure out how one would specify constraints that force the coefficients on the birth-cohort dummies to be equal across all equations where they appear. Is this at all possible with current libraries?

To make an easily replicable example, lets leave Labor Force Participation Rates in favor of a commonly used dataset: Let's say I wanted the estimated "male" coefficient to be the same across the two equations from the example in the package linearmodels vignette:

import numpy as np
import pandas as pd
from linearmodels.datasets import fringe
from collections import OrderedDict
from linearmodels.system import SUR

data = fringe.load()
formula = OrderedDict()
formula["benefits"] = "hrbens ~ nrthcen + male"
formula["earnings"] = "hrearn ~ married + male"

mod = SUR.from_formula(formula, data)
print(mod.fit(cov_type="unadjusted"))

I'm trying to do this:

constraints_matrix=pd.DataFrame([0,0,0,1]).transpose()
constraints_values=pd.Series(['benefits_male'])
mod.add_constraints(constraints_matrix,constraints_values)

Solution

  • Answering my own question after I got inspired by a friend. This is easily formulated in a linear constraint. The coefficient of benefits_male minus earnings_male needs to equal 0:

    constraints_matrix=pd.DataFrame([0,1,0,-1]).transpose()
    constraints_values=pd.Series([0])
    mod.add_constraints(constraints_matrix,constraints_values)
    print(mod.fit(cov_type="unadjusted"))