Thanks for your reply.my professor send a file in java and clearly I dont really understand how to go about.I have really tried but I have not managed.
I'm assuming that your question is "How do I translate R code that fits a linear model into Mathematica?" If so, the LinearModelFit function is what you need.