calculating log likelihood