Bayesian nonparametric methods for randomized clinical trials and observational studies