Constraining the anisotropic expansion of the universe with type ia supernovae and improving the treatment of selection effects within bayesian hierarchical models