code: def test_calc_grad():
      # separately tests that _calc_grad returns
      # sensible results
      #
      # regression test
  
      np.random.seed(435265)
      X = np.random.normal(size=(50, 3))
      y = np.random.randint(0, 2, size=50)
      beta = np.random.normal(size=3)
      mod = OLS(y, X)
      grad = _calc_grad(mod, beta, 0.01, 1, {})
      assert_allclose(
          grad,
          np.array([19.75816, -6.62307, 7.324644]),
          atol=1e-6,
          rtol=0,
      )
  
imports: import numpy
  from numpy.testing import assert_equal, assert_, assert_allclose
  from statsmodels.regression.linear_model import OLS
  from statsmodels.genmod.generalized_linear_model import GLM
  from statsmodels.genmod.families import Binomial
  from statsmodels.base.distributed_estimation import _calc_grad, _calc_wdesign_mat, _est_regularized_debiased, _join_debiased, _est_regularized_naive, _est_unregularized_naive, _join_naive, DistributedModel
label_desc: Use image node_id 2 for calling a global function with example usage: test_calc_grad() without return types