# pyblp.ProblemResults.run_distance_test¶

ProblemResults.run_distance_test(unrestricted)

Test the validity of model restrictions with the distance test.

Following Newey and West (1987), the distance or likelihood ratio-like statistic is

(1)$\text{LR} = J(\hat{\theta}^r) - J(\hat{\theta}^u)$

where $$J(\hat{\theta}^r)$$ is the $$J$$ statistic defined in (1) for this restricted model and $$J(\hat{\theta}^u)$$ is the $$J$$ statistic for the unrestricted model.

Note

The statistic can equivalently be written as $$\text{LR} = N[q(\hat{\theta}^r) - q(\hat{\theta}^u)]$$ where the GMM objective value is defined in (10), or the same but without the $$N$$ if the GMM objective value was scaled by $$N$$, which is the default behavior.

If the restrictions in this model are valid, the distance statistic is asymptotically $$\chi^2$$ with degrees of freedom equal to the number of restrictions.

Warning

This test requires each model’s ProblemResults.W to be the optimal weighting matrix, so it should typically be run only after two-step GMM or after one-step GMM with pre-specified optimal weighting matrices.

Parameters

unrestricted (ProblemResults) – ProblemResults for the unrestricted model.

Returns

The distance statistic.

Return type

float

Examples