What are the steps involved in building and evaluating a linear regression model in R?

devquora
devquora

Posted On: Feb 22, 2018

 

The following steps are followed to build and evaluate a linear regression model in R

  • The first step is to divide the data into train and test sets. This step is crucial because you have to build a model on the train and evaluate its performance on the test set. This can be done with sample.split() function from the package.
  • The second step is to build the model on the train set. The function used to build the model is Im() function.
  • Once you’ve built the model, you can predict the values on the data set with the help of the predict() function.
  • The last step in the linear regression model is to find out the RMSE. The lower the value of RMSE, better is the prediction.

    Related Questions

    Please Login or Register to leave a response.

    Related Questions

    R Programming Interview Questions

    What is R Programming?

    R is a programming language and a software environment meant for statistical analysis and creating graphs. It is used b..

    R Programming Interview Questions

    Enlist some of the functions that R provides?

    The functions that R provides areMean- it is calculated by taking the sum of the values and dividing it by a number o..

    R Programming Interview Questions

    What are the different data structures in R?

    Data structure is a form of organizing and storing data. It is imperative to have a strong understanding of various dat..