Refactor R script logregr_group_test.R