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,170 points
130 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,690 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,130 points
229 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
• 42,430 points
173 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
69 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,170 points
170 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
74 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,870 points
184 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 5 in Data Analytics by anonymous
3,587 views
0 votes
2 answers

How to sum a variable by group in R?

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

answered Jul 31 in Data Analytics by Cherukuri
• 31,840 points
10,452 views