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.
Merge pull request #30 from ThierryO/patch-1

Update fit_maes_trend.r