generalized residual bootstrap for 3+ levels