Mentor says I cannot be first author of my paper because I am an undergraduate
My mentor tells me that no magazines will accept me as a first author


This is clearly wrong. Of course I cannot speak for every journal in your particular subfield, but rejecting papers only because of the academic rank of the first author would be ethically dubious. At the very least, there are some megajournals that do not have such criteria and which should accept your work – given that it is scientifically sound, etc. (Mind that I am not saying that megajournals are your best or only choice; they are just the easiest counter example.)

Moreover, a typical journal won’t even ask for your academic rank and may not bother to investigate it and neither do the peer reviewers. The journal may even practice double-blind peer review, in which the reviewers won’t even know your name and thus probably lack all means of finding out your academic rank.

Finally, while there are some people who judge a work by whether they know the authors (though they shouldn’t), they usually do not look at authorship positions. If somebody is going to be more benign to your work because your mentor’s name is on it, they will likely not care whether they are the first or last author.


  by the rules, mentor must to [the statistics]


There are certainly no universal rules for this. Where did this come from?



Anyway, your problems rather are these:


Doing the statistics almost certainly qualifies your mentor for authorship, so he must agree on all publishing decisions. (The opposite also applies.) Even if you re-do the statistics, it will be difficult to argue that you did so completely independently. Also mind that any intellectual contribution qualifies for authorship, so think about any feedback or advice you got from your mentor on this work.
Your mentor may have some power over you. I don’t know them, but you must consider the possibility that they freak out over this and try to sabotage your career and particular this very paper.
The biggest advantage of having an experienced mentor contributing to your paper is their experience in writing. It is very unlikely that anybody produces proper scientific writing on their first attempt without help from somebody experienced with it.


Unfortunately, you have to judge your mentor’s mentality yourself.
However, unless you are sure that they do not abuse their power, I strongly suggest that you find another professor or similar who can advise you and possibly act as an arbiter in this situation.