wrote a function to compute log lh