lm_glm_sample modified