Steps to evaluate Linear Regression in R

0 votes
Hi!!

I want to know the steps to build and evaluate linear regression in R.

Can someone explain in simple terms?
Jul 25, 2018 in Data Analytics by darklord
• 6,140 points
83 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

These are sequential steps which need to be followed while building a linear regression model:

1. Start off by dividing the data into train and test sets, this step is vital because you will be building the model on the train set and evaluating its performance on the test set.

  • You can do this using the sample.split() function from the “catools” package. This function gives an option of split-ratio, which you can specify according to your needs.

2. Once, you are done splitting the data into training and test sets, You can go ahead and build the model on the train set.

  • The lm() function is used to build a model.

3. Finally, you can predict the values on the test set, using the “predict()” function.

  • The final step would be to find out the RMSE, the lower the RMSE value, the better the prediction.

​​

answered Jul 25, 2018 by CodingByHeart77
• 3,680 points

Related Questions In Data Analytics

0 votes
1 answer

How to evaluate expression given as a string in R?

The eval() function evaluates an expression, but "5+5" is a string, ...READ MORE

answered Jun 7, 2018 in Data Analytics by DataKing99
• 8,100 points
77 views
0 votes
1 answer

how to run a logistic regression with clustered standard errors in R?

have a look at rms package. lrm is logistic ...READ MORE

answered Nov 6, 2018 in Data Analytics by Kalgi
• 36,650 points
105 views
+1 vote
1 answer

Need a hadoop engine in backend to run r server

Dear Koushik, Hope you are doing great. The hadoop ...READ MORE

answered Dec 17, 2017 in Data Analytics by Sudhir
• 1,610 points
30 views
0 votes
1 answer

How to change y axis max in time series using R?

The axis limits are being set using ...READ MORE

answered Apr 3, 2018 in Data Analytics by darklord
• 6,140 points
57 views
0 votes
1 answer
+4 votes
2 answers
0 votes
1 answer

R programming: Linear programming problems

The documentation for the lp package provides ...READ MORE

answered Feb 4 in Data Analytics by Tyrion anex
• 8,280 points
51 views
0 votes
1 answer

R programming: Linear Equation

Use expand.grid to get all possible combinations ...READ MORE

answered Apr 30 in Data Analytics by Sophie may
• 9,330 points
14 views
0 votes
1 answer

How to use group by for multiple columns in dplyr, using string vector input in R?

dplyr added versions for group_by. This allows you ...READ MORE

answered Apr 12, 2018 in Data Analytics by CodingByHeart77
• 3,680 points

edited Apr 12, 2018 by CodingByHeart77 1,940 views
0 votes
1 answer

How to sum a variable by group in R?

Easily by using Aggregate Func(): aggregate(x$points, by=list(Players=x$Players), FUN=sum) or ...READ MORE

answered Apr 13, 2018 in Data Analytics by CodingByHeart77
• 3,680 points

edited Apr 13, 2018 by CodingByHeart77 4,298 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.