Analytical study of anisotropic compact star models