Getting Started

Simple Linear Regression Model (SLR) using R Language. Which is also known as Linear Model (LM) or Linear Regression.

In statistical modeling, regression analysis is a statistical process for estimating the relationships among variables. It includes many techniques for modeling and analyzing several variables, when the focus is on the relationship between a dependent variable and one or more independent variables (or ‘predictors’).

Tools : Rstudio.

Language : R

Basic Formula : Y = α + β(x)

Where ,

Y -> Dependent Variable

α -> Constant

β -> Coefficient

x -> Independent Variable

For Simple Linear Regression Model (SLR),

  • Data Type must be Numeric or Continuous.

There should be One dependent variable and One independent variable


  • In SLR the model can have only one dependent variable and one independent variable.
  • The Linear relation between two variables which is a relation between dependent and independent variable.

Simple Linear Regression Model using R,

We create a relationship model using the lm() functions in R,

fit <- lm(formula=speed~dist,data=cars)


fit <- Variable

speed -> Dependent Variable

Dist -> Independent Variable.

Basically we are looking for R-squared measure just to see how close the data are to the fitted regression line. It is also known as the coefficient of determination.

That defines the accuracy of developed Model.

It is defined as, R-squared = Explained variation / Total variation

Total variation = Explained variation + Unexplained variation


Complete Code & Data Source link :