modify a function estBetaParams to handle 0 or 1