in contrast to its neighbors who lurched from one military dictator or civilian strongman to another , chile lived in relatively prosperous stability in the years after achieving independence from spain in 1818 .