Group Abstract Group Abstract

Message Boards Message Boards

0
|
7.2K Views
|
3 Replies
|
1 Total Like
View groups...
Share
Share this post:

Fit a linear model in Mathematica ?

Posted 11 years ago
POSTED BY: irene mwei
3 Replies
Posted 11 years ago

The following will likely give you most of what you show above. The inline documentation has additional options.

salary = {1000, 12000, 12500, 14000, 15000, 17000, 25000, 30000, 50000};
experience = {2, 3, 4, 6, 8, 10, 12, 14, 15};
data = Table[{experience[[i]], salary[[i]]}, {i, Length[salary]}]
lm = LinearModelFit[data, x, x]
lm[{"ParameterTable", "RSquared", "AdjustedRSquared", "ANOVATable"}]

with output

Regression output

POSTED BY: Jim Baldwin
Posted 11 years ago

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.

POSTED BY: irene mwei
Posted 11 years ago

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.

POSTED BY: Jim Baldwin
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard