Spectroscopic analysis of LiHoF4 and LiErF4