# linearmodels.panel.results.RandomEffectsResults.wald_test¶

RandomEffectsResults.wald_test(restriction=None, value=None, *, formula=None)

Test linear equality constraints using a Wald test

Parameters
restriction

q by nvar array containing linear weights to apply to parameters when forming the restrictions. It is not possible to use both restriction and formula.

value

q element array containing the restricted values.

formulaUnion[str, list[str]]

formulaic linear constraints. The simplest formats are one of:

• A single comma-separated string such as “x1=0, x2+x3=1”

• A list of strings where each element is a single constraint such as [“x1=0”, “x2+x3=1”]

• A single string without commas to test simple constraints such as “x1=x2=x3=0”

• A dictionary where each key is a parameter restriction and the corresponding value is the restriction value, e.g., {“x1”: 0, “x2+x3”: 1}.

It is not possible to use both restriction and formula.

Returns
WaldTestStatistic

Test statistic for null that restrictions are valid.

Notes

Hypothesis test examines whether $$H_0:C\theta=v$$ where the matrix C is restriction and v is value. The test statistic has a $$\chi^2_q$$ distribution where q is the number of rows in C.

Examples

>>> from linearmodels.datasets import wage_panel
>>> import statsmodels.api as sm
>>> import numpy as np
>>> import pandas as pd
>>> year = pd.Categorical(data.year)
>>> data = data.set_index(["nr", "year"])
>>> data["year"] = year
>>> from linearmodels.panel import PanelOLS
>>> exog_vars = ["expersq", "union", "married", "year"]

>>> mod = PanelOLS(data.lwage, exog, entity_effects=True)
>>> fe_res = mod.fit()


Test the restriction that union and married have 0 coefficients

>>> restriction = np.zeros((2, 11))
>>> restriction[0, 2] = 1
>>> restriction[1, 3] = 1
>>> value = np.array([0, 0])
>>> wald_res = fe_res.wald_test(restriction, value)


The same test using formulas

>>> formula = "union = married = 0"
>>> wald_res = fe_res.wald_test(formula=formula)

Return type

WaldTestStatistic