Abstract The random-effects regression algorithm, made popular within engineering seismology by Abrahamson and Youngs (1992), is arguably the most commonly used approach for developing empirical ground-motion models. The original presentation of this algorithm relates to the most simple application of a far more general mixed-effects model formulation. In recent years, it has become increasingly common to incorporate nonlinear site response effects within empirical, or semi-empirical, ground-motion models, but the original random-effects algorithm does not apply to cases in which the random effects enter the model in a nonlinear manner. This article presents a more general algorithm for fitting mixed-effects models that can accommodate nonlinear site effects (among other effects). The presented algorithm deliberately mirrors that of Abrahamson and Youngs (1992) but allows for the treatment of far more elaborate variance structures.