likelihood function in r