writing the likelihood function and a unit test