Bug fix: margins did not deal with expression in dependent variable

After this fix, expression can be directly used as dependent variable in
regression and margins will not give error.