def test_deriv2():
 np.random.seed(24235)
 for link in Links:
  if (type(link) == type(probit)):
   continue
  for k in range(10):
   p = np.random.uniform(0, 1)
   p = np.clip(p, 0.01, 0.99)
   if (type(link) == type(cauchy)):
    p = np.clip(p, 0.03, 0.97)
   d = link.deriv2(p)
   da = nd.approx_fprime(np.r_[p], link.deriv)
   assert_allclose(d, da, rtol=1e-06, atol=1e-06, err_msg=str(link))

def test_deriv2 ( ) : np . random . seed ( 24235 ) for link in Links : if ( type ( link ) == type ( probit ) ) : continue for k in range ( 10 ) : p = np . random . uniform ( 0 , 1 ) p = np . clip ( p , 0.01 , 0.99 ) if ( type ( link ) == type ( cauchy ) ) : p = np . clip ( p , 0.03 , 0.97 ) d = link . deriv2 ( p ) da = nd . approx_fprime ( np . r_ [ p ] , link . deriv ) assert_allclose ( d , da , rtol = 1e-06 , atol = 1e-06 , err_msg = str ( link ) )
check link function second derivatives using numeric differentiation .