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 Sahiti
• 6,370 points
957 views

1 answer to this question.

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,740 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,240 points
4,225 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
• 52,360 points
1,505 views
+2 votes
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 18, 2017 in Data Analytics by Sudhir
• 1,610 points
610 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 Sahiti
• 6,370 points
3,541 views
0 votes
1 answer
+5 votes
2 answers
+1 vote
1 answer

R programming: Linear programming problems

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

answered Feb 4, 2019 in Data Analytics by Tyrion anex
• 8,700 points
699 views
0 votes
1 answer

R programming: Linear Equation

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

answered Apr 30, 2019 in Data Analytics by Sophie may
• 10,610 points
654 views
0 votes
2 answers

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

data = data.frame(   zzz11def = sample(LETTERS[1:3], 100, replace=TRUE),   zbc123qws1 ...READ MORE

answered Aug 6, 2019 in Data Analytics by anonymous
13,679 views
+4 votes
3 answers

How to sum a variable by group in R?

You can also try this way, x_new = ...READ MORE

answered Aug 1, 2019 in Data Analytics by Cherukuri
• 33,030 points
77,369 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP