an adaptation of the SGL package to allow observation weights