Update fit_maes_trend.r

Changing the way p-values are calculated to get more correct two-sided p-values.
Some parts are rewritten to make to code a bit more elegant.
Adding some white space for readability.