-
Notifications
You must be signed in to change notification settings - Fork 23
/
Toyota_Multi_Linear_Regression.r
142 lines (113 loc) · 3.07 KB
/
Toyota_Multi_Linear_Regression.r
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#Multiple Linear Regression
#Here i have a dataset of toyota
#In the below Example, we do Iterations to get better R-Square Value. Each Iteration will give better R-Square Results
#import the dataset
toyota <- Toyoto_Corrola[,c("Price","Age_08_04","KM","HP","cc","Doors","Gears","Weight")]
#Create a model Using the dataset
model1 <- lm(Price~., data = toyota)
summary(model1)
library(car)
car::vif(model1)
plot(model1)
residualPlots(model1)
qqPlot(model1)
influenceIndexPlot(model1)
###Iteration 1
toyota1 <- toyota[c(-222,-602),]
model2 <- lm(Price~., data = toyota1)
summary(model2)
car::vif(model2)
plot(model2)
residualPlots(model2)
qqPlot(model2)
influenceIndexPlot(model2)
###Iteration 2
toyota1 <- toyota[-c(81,961,959,222,602),]
model2 <- lm(Price~., data = toyota1)
summary(model2)
car::vif(model2)
plot(model2)
residualPlots(model2)
qqPlot(model2)
influenceIndexPlot(model2)
###Iteration 3
toyota1 <- toyota[-c(81,961,959,222,602,655,652),]
model2 <- lm(Price~., data = toyota1)
summary(model2)
car::vif(model2)
plot(model2)
residualPlots(model2)
qqPlot(model2)
influenceIndexPlot(model2)
###Iteration 4
toyota1 <- toyota[-c(81,961,959,222,602,655,652,524,522),]
model2 <- lm(Price~., data = toyota1)
summary(model2)
car::vif(model2)
plot(model2)
residualPlots(model2)
qqPlot(model2)
influenceIndexPlot(model2)
### Iteration 5
toyota1 <- toyota[-c(193,192,81,961,959,222,602,655,652,524,522),]
model2 <- lm(Price~., data = toyota1)
summary(model2)
car::vif(model2)
plot(model2)
residualPlots(model2)
qqPlot(model2)
influenceIndexPlot(model2)
### Iteration 6
toyota1 <- toyota[-c(172,171,193,192,81,961,959,222,602,655,652,524,522),]
model2 <- lm(Price~., data = toyota1)
summary(model2)
car::vif(model2)
plot(model2)
residualPlots(model2)
qqPlot(model2)
influenceIndexPlot(model2)
###Iteration 7
toyota1 <- toyota[-c(394,388,172,171,193,192,81,961,959,222,602,655,652,524,522),]
model2 <- lm(Price~., data = toyota1)
summary(model2)
car::vif(model2)
plot(model2)
residualPlots(model2)
qqPlot(model2)
influenceIndexPlot(model2)
###Iteration 8
toyota1 <- toyota[-c(403,395,394,388,172,171,193,192,81,961,959,222,602,655,652,524,522),]
model2 <- lm(Price~., data = toyota1)
summary(model2)
car::vif(model2)
plot(model2)
residualPlots(model2)
qqPlot(model2)
influenceIndexPlot(model2)
###Iteration 9
toyota1 <- toyota[-c(1436,1419,403,395,394,388,172,171,193,192,81,961,959,222,602,655,652,524,522),]
model2 <- lm(Price~., data = toyota1)
summary(model2)
car::vif(model2)
plot(model2)
residualPlots(model2)
qqPlot(model2)
influenceIndexPlot(model2)
###Iteration 10
toyota1 <- toyota[-c(1059,1042,1436,1419,403,395,394,388,172,171,193,192,81,961,959,222,602,655,652,524,522),]
model2 <- lm(Price~., data = toyota1)
summary(model2)
car::vif(model2)
plot(model2)
residualPlots(model2)
qqPlot(model2)
influenceIndexPlot(model2)
###Iteration 11
toyota1 <- toyota[-c(148,147,1059,1042,1436,1419,403,395,394,388,172,171,193,192,81,961,959,222,602,655,652,524,522),]
model2 <- lm(Price~., data = toyota1)
summary(model2)
car::vif(model2)
plot(model2)
residualPlots(model2)
qqPlot(model2)
influenceIndexPlot(model2)