Capítulo 6 Trabalho Final

Predição de preço para revenda de veículos

6.1 Introdução

Baseado - em um dataset de veículos em algumas cidades da Índia, iremos analisar de preços de veículos conforme suas características.

6.2 Contexto e Problema de negócios

A aquisição de carros usados para revenda depende do conhecimento dos preços praticados para revenda. A formação de preços para revenda depende do preço de mercado e de outros dados importantes como: modelo, fabricante, km, idade, condições, fipe e outros indicadores de mercado Problema de negócios Um loja de veículos necessita analisar todos os preços de veículos para estimar o novo preço para revenda. A predição de preço é baseada em diversas variaveis, como kilometragem, ano de fabricação, motor, câmbio, etc…

6.3 Objetivo

Realizar a melhor predição de preços para a revendas de veículos.

6.4 Fonte de Dados

Veículos: dataset.csv

df <- read.csv( file = "../Cadernos_Josias/dados/dataset.csv", header = TRUE, sep = ",", dec = ".", quote = "\"" )
df
##     X                                             Name   Location Year Kilometers_Driven Fuel_Type Transmission     Owner_Type
## 1   0                           Maruti Wagon R LXI CNG     Mumbai 2010             72000       CNG       Manual          First
## 2   1                 Hyundai Creta 1.6 CRDi SX Option       Pune 2015             41000    Diesel       Manual          First
## 3   2                                     Honda Jazz V    Chennai 2011             46000    Petrol       Manual          First
## 4   3                                Maruti Ertiga VDI    Chennai 2012             87000    Diesel       Manual          First
## 5   4                  Audi A4 New 2.0 TDI Multitronic Coimbatore 2013             40670    Diesel    Automatic         Second
## 6   5                  Hyundai EON LPG Era Plus Option  Hyderabad 2012             75000       LPG       Manual          First
## 7   6                           Nissan Micra Diesel XV     Jaipur 2013             86999    Diesel       Manual          First
## 8   7                Toyota Innova Crysta 2.8 GX AT 8S     Mumbai 2016             36000    Diesel    Automatic          First
## 9   8              Volkswagen Vento Diesel Comfortline       Pune 2013             64430    Diesel       Manual          First
## 10  9                   Tata Indica Vista Quadrajet LS    Chennai 2012             65932    Diesel       Manual         Second
## 11 10                                 Maruti Ciaz Zeta      Kochi 2018             25692    Petrol       Manual          First
## 12 11                      Honda City 1.5 V AT Sunroof    Kolkata 2012             60000    Petrol    Automatic          First
## 13 12                            Maruti Swift VDI BSIV     Jaipur 2015             64424    Diesel       Manual          First
## 14 13                 Land Rover Range Rover 2.2L Pure      Delhi 2014             72000    Diesel    Automatic          First
## 15 14                   Land Rover Freelander 2 TD4 SE       Pune 2012             85000    Diesel    Automatic         Second
## 16 15                      Mitsubishi Pajero Sport 4X4      Delhi 2014            110000    Diesel       Manual          First
## 17 16                            Honda Amaze S i-Dtech      Kochi 2016             58950    Diesel       Manual          First
## 18 17                            Maruti Swift DDiS VDI     Jaipur 2017             25000    Diesel       Manual          First
## 19 18              Renault Duster 85PS Diesel RxL Plus      Kochi 2014             77469    Diesel       Manual          First
## 20 19 Mercedes-Benz New C-Class C 220 CDI BE Avantgare  Bangalore 2014             78500    Diesel    Automatic          First
## 21 20                                BMW 3 Series 320d      Kochi 2014             32982    Diesel    Automatic          First
## 22 21                    Maruti S Cross DDiS 200 Alpha  Bangalore 2015             55392    Diesel       Manual         Second
## 23 22             Audi A6 2011-2015 35 TFSI Technology     Mumbai 2015             55985    Petrol    Automatic          First
## 24 23                            Hyundai i20 1.2 Magna    Kolkata 2010             45807    Petrol       Manual          First
## 25 24              Volkswagen Vento Petrol Highline AT    Kolkata 2010             33000    Petrol    Automatic          First
## 26 25                     Honda City Corporate Edition     Mumbai 2012             51920    Petrol       Manual          First
## 27 26                           Nissan Micra Diesel XV  Hyderabad 2012             54000    Diesel       Manual          First
## 28 27                    Maruti Alto K10 2010-2014 VXI  Hyderabad 2013             54000    Petrol       Manual         Second
## 29 28                              Honda WRV i-VTEC VX      Kochi 2018             37430    Petrol       Manual          First
## 30 29              Toyota Innova 2.5 V Diesel 7-seater     Mumbai 2007            262000    Diesel       Manual Fourth & Above
## 31 30             Renault Duster 110PS Diesel RxZ Pack  Bangalore 2013             62000    Diesel       Manual          First
## 32 31                           Toyota Corolla Altis G      Delhi 2012             87615    Petrol       Manual          First
## 33 32                    Mahindra Ssangyong Rexton RX7  Bangalore 2013             72000    Diesel    Automatic         Second
## 34 33                                  Audi A6 2.7 TDI    Kolkata 2010             35000    Diesel    Automatic          First
## 35 34                    Volkswagen Vento 1.6 Highline Coimbatore 2014             55431    Petrol       Manual         Second
## 36 35                         Maruti Wagon R LXI BSIII     Jaipur 2009             83816    Petrol       Manual         Second
## 37 36                    Maruti Vitara Brezza ZDi Plus      Kochi 2018             50075    Diesel       Manual          First
## 38 37          Mahindra KUV 100 mFALCON G80 K6 5str AW      Delhi 2017             52000    Petrol       Manual          First
## 39 38                 Mercedes-Benz M-Class ML 350 CDI       Pune 2013             85000    Diesel    Automatic          First
## 40 39            Volkswagen Polo Diesel Trendline 1.2L    Chennai 2013             62000    Diesel       Manual          First
## 41 40                                  Maruti Alto LXi      Delhi 2008             90000    Petrol       Manual         Second
## 42 41                                  Tata Nano LX SE      Kochi 2014             19698    Petrol       Manual          First
## 43 42        Mahindra KUV 100 mFALCON D75 K8 Dual Tone Coimbatore 2017             22033    Diesel       Manual          First
## 44 43                   Hyundai i20 Magna Optional 1.2      Kochi 2014             35487    Petrol       Manual          First
## 45 44                 Hyundai Elantra 2.0 SX Option AT  Bangalore 2014             46374    Petrol    Automatic          First
## 46 45                        Toyota Corolla Altis G AT     Mumbai 2016             52001    Petrol    Automatic          First
## 47 46                             Hyundai Elantra CRDi  Ahmedabad 2008             58005    Diesel       Manual         Second
## 48 47                   Toyota Innova Crysta 2.7 GX MT  Bangalore 2012             70704    Petrol       Manual          First
## 49 48                         Hyundai Xcent 1.1 CRDi S     Jaipur 2014             75000    Diesel       Manual          First
## 50 49                            Mahindra Thar CRDe AC     Jaipur 2012             75800    Diesel       Manual         Second
## 51 50             Audi A4 2.0 TDI 177 Bhp Premium Plus      Kochi 2015             13648    Diesel    Automatic          First
## 52 51                                 Maruti Swift LDI      Delhi 2014             52000    Diesel       Manual          First
## 53 52                            Maruti Swift Ldi BSIV    Kolkata 2014             53000    Diesel       Manual          First
## 54 53                                 Maruti Swift VDI      Delhi 2013             65650    Diesel       Manual          First
## 55 54                         Hyundai Grand i10 Sportz    Chennai 2015             54000    Petrol       Manual          Third
## 56 55       Volkswagen Vento 2013-2015 1.6 Comfortline    Kolkata 2015             39000    Petrol       Manual          First
## 57 56                                 Renault KWID RXT      Kochi 2017             16542    Petrol       Manual          First
## 58 57                                 Hyundai i10 Asta    Kolkata 2010             32000    Petrol       Manual          First
## 59 58                            Nissan X-Trail SLX AT  Hyderabad 2010            121812    Diesel    Automatic          First
## 60 59                      Maruti Zen Estilo VXI BSIII  Hyderabad 2010             39300    Petrol       Manual          First
## 61 60                Toyota Innova Crysta 2.4 GX MT 8S     Mumbai 2017             22000    Diesel       Manual          First
## 62 61                        Ford Figo Diesel Titanium  Bangalore 2010             72000    Diesel       Manual          First
## 63 62   Mercedes-Benz New C-Class C 200 CGI Avantgarde      Delhi 2015             58000    Petrol    Automatic          First
## 64 63        Mercedes-Benz New C-Class 200 CDI Classic       Pune 2011             65000    Diesel       Manual         Second
## 65 64                               Tata Indica V2 eLS    Chennai 2016            178000    Diesel       Manual          First
## 66 65                      Audi A4 2.0 TDI Multitronic     Jaipur 2012             65664    Diesel    Automatic          First
## 67 66                                Honda City ZX CVT     Mumbai 2007             63000    Petrol    Automatic         Second
## 68 67         Mercedes-Benz C-Class Progressive C 220d Coimbatore 2019             15369    Diesel    Automatic          First
## 69 68                           Maruti Ertiga SHVS VDI       Pune 2016             63000    Diesel       Manual          First
## 70 69                  Hyundai Creta 1.4 E Plus Diesel     Mumbai 2018             13000    Diesel       Manual          First
## 71 70                  Porsche Cayenne 2009-2014 Turbo     Mumbai 2008             73000    Petrol    Automatic          First
##       Mileage  Engine      Power Seats  New_Price Price
## 1  26.6 km/kg  998 CC  58.16 bhp     5             1.75
## 2  19.67 kmpl 1582 CC  126.2 bhp     5            12.50
## 3   18.2 kmpl 1199 CC   88.7 bhp     5  8.61 Lakh  4.50
## 4  20.77 kmpl 1248 CC  88.76 bhp     7             6.00
## 5   15.2 kmpl 1968 CC  140.8 bhp     5            17.74
## 6  21.1 km/kg  814 CC   55.2 bhp     5             2.35
## 7  23.08 kmpl 1461 CC   63.1 bhp     5             3.50
## 8  11.36 kmpl 2755 CC  171.5 bhp     8    21 Lakh 17.50
## 9  20.54 kmpl 1598 CC  103.6 bhp     5             5.20
## 10  22.3 kmpl 1248 CC     74 bhp     5             1.95
## 11 21.56 kmpl 1462 CC 103.25 bhp     5 10.65 Lakh  9.95
## 12  16.8 kmpl 1497 CC  116.3 bhp     5             4.49
## 13  25.2 kmpl 1248 CC     74 bhp     5             5.60
## 14  12.7 kmpl 2179 CC  187.7 bhp     5            27.00
## 15   0.0 kmpl 2179 CC    115 bhp     5            17.50
## 16  13.5 kmpl 2477 CC 175.56 bhp     7 32.01 Lakh 15.00
## 17  25.8 kmpl 1498 CC   98.6 bhp     5             5.40
## 18  28.4 kmpl 1248 CC     74 bhp     5             5.99
## 19 20.45 kmpl 1461 CC   83.8 bhp     5             6.34
## 20 14.84 kmpl 2143 CC 167.62 bhp     5            28.00
## 21 22.69 kmpl 1995 CC    190 bhp     5 47.87 Lakh 18.55
## 22 23.65 kmpl 1248 CC   88.5 bhp     5             8.25
## 23 13.53 kmpl 1984 CC 177.01 bhp     5            23.50
## 24  18.5 kmpl 1197 CC     80 bhp     5             1.87
## 25  14.4 kmpl 1598 CC  103.6 bhp     5             2.85
## 26  16.8 kmpl 1497 CC  116.3 bhp     5             4.25
## 27 23.08 kmpl 1461 CC   63.1 bhp     5             4.25
## 28 20.92 kmpl  998 CC   67.1 bhp     5             2.75
## 29  17.5 kmpl 1199 CC   88.7 bhp     5 10.57 Lakh  9.90
## 30  12.8 kmpl 2494 CC    102 bhp     7             4.00
## 31 19.01 kmpl 1461 CC 108.45 bhp     5             7.75
## 32 14.53 kmpl 1798 CC  138.1 bhp     5             6.75
## 33 11.18 kmpl 2696 CC    184 bhp     7            12.50
## 34  12.4 kmpl 2698 CC  179.5 bhp     5            11.50
## 35 16.09 kmpl 1598 CC  103.5 bhp     5 12.33 Lakh  6.98
## 36  14.0 kmpl 1061 CC     64 bhp     5             1.85
## 37  24.3 kmpl 1248 CC   88.5 bhp     5 11.12 Lakh  8.63
## 38 18.15 kmpl 1198 CC     82 bhp     5             4.85
## 39 11.74 kmpl 2987 CC  254.8 bhp     5            28.00
## 40 22.07 kmpl 1199 CC   73.9 bhp     5             5.00
## 41  19.7 kmpl  796 CC   46.3 bhp     5             1.25
## 42  25.4 kmpl  624 CC   37.5 bhp     4             1.53
## 43 25.32 kmpl 1198 CC     77 bhp     6             5.58
## 44  18.5 kmpl 1197 CC   82.9 bhp     5             4.74
## 45 14.62 kmpl 1999 CC 149.92 bhp     5 23.64 Lakh  8.85
## 46 14.28 kmpl 1798 CC 138.03 bhp     5            10.11
## 47  14.9 kmpl 1991 CC  112.2 bhp     5             4.25
## 48 11.25 kmpl 2694 CC  163.7 bhp     7 18.64 Lakh 10.95
## 49  24.4 kmpl 1120 CC     71 bhp     5             3.85
## 50 16.55 kmpl 2498 CC    105 bhp     6             5.50
## 51 17.11 kmpl 1968 CC 174.33 bhp     5            21.43
## 52  22.9 kmpl 1248 CC     74 bhp     5             4.25
## 53  17.8 kmpl 1248 CC     75 bhp     5             3.30
## 54  28.4 kmpl 1248 CC     74 bhp     5             3.85
## 55  18.9 kmpl 1197 CC     82 bhp     5             3.60
## 56 15.04 kmpl 1598 CC  103.2 bhp     5             3.99
## 57 25.17 kmpl  799 CC   53.3 bhp     5             3.30
## 58 20.36 kmpl 1197 CC   78.9 bhp     5             2.07
## 59 13.29 kmpl 1995 CC  147.6 bhp     5             7.75
## 60  18.2 kmpl  998 CC   67.1 bhp     5             2.25
## 61 13.68 kmpl 2393 CC  147.8 bhp     8 19.34 Lakh 16.50
## 62  20.0 kmpl 1399 CC     68 bhp     5             2.75
## 63 11.74 kmpl 1796 CC    186 bhp     5            26.70
## 64  15.8 kmpl 2148 CC    170 bhp     5            10.00
## 65  25.0 kmpl 1396 CC     69 bhp     5             2.50
## 66 16.55 kmpl 1968 CC    140 bhp     5            13.50
## 67  16.4 kmpl 1497 CC     78 bhp     5             1.85
## 68   0.0 kmpl 1950 CC    194 bhp     5 49.14 Lakh 35.67
## 69 24.52 kmpl 1248 CC   88.5 bhp     7             8.15
## 70  22.1 kmpl 1396 CC   88.7 bhp     5 11.81 Lakh 10.50
## 71   8.5 kmpl 4806 CC    500 bhp     5            14.50
##  [ reached 'max' / getOption("max.print") -- omitted 5948 rows ]