Linear Regression

Import Data

The Total Number of Columns & Rows of Data imported.

Now check for null in the data

Remove the unneccessary data

Check Null again

Check the datatypes in the csv

Segregating Data

Plot them and visualise

Lets plot the independent variable and dependent variables..

Importing Linear Regression Model

Initializing the Model

Fitting the Model to x & y

From the above interception, an unit increase in km run, the price goes down by 0.3420 times.

let us predict the new X values

Lets Predict that again,

Printing P value & Rsquare

This Model is not rigid.

Now lets take all and Multiple linear Regression

Print

Prediction & RootMeanSquar error

Lets Do Summary of them

All p values are significant. km run is negatively associated with sales. Better R square value. Let me add more variables to the equation which will enhance the rsqured value.

When i keep adding the variables the rsquared increases.

Now, Categorical variable, Brand name of the car is introduced.

Lets include the Brand into the model

The above are the cofficients for all variables. These coefficients are with respect to Car Audi as a benchmark.

The Above factors are inline with the respective calculations performed in other tools.