'Parameters
restricted : Result instance
The restricted model is assumed to be nested in the current
model. The result instance of the restricted model is required to
have two attributes, residual sum of squares, `ssr`, residual
degrees of freedom, `df_resid`.
Returns
nested : bool
True if nested, otherwise false
Notes
A most nests another model if the regressors in the smaller
model are spanned by the regressors in the larger model and
the regressand is identical.'

def _is_nested(self, restricted):

    if (self.model.nobs != restricted.model.nobs):
        return False
    full_rank = self.model.rank
    restricted_rank = restricted.model.rank
    if (full_rank <= restricted_rank):
        return False
    restricted_exog = restricted.model.wexog
    full_wresid = self.wresid
    scores = (restricted_exog * full_wresid[:, None])
    score_l2 = np.sqrt(np.mean((scores.mean(0) ** 2)))
    return np.allclose(score_l2, 0)
