A comparative study of electron energy losses in Sm and Yb