Test gradients for GLM