likelihood code