mydata <- read_excel("C:/Users/Eneja/Desktop/Electircal_Cars.xlsx")
head(mydata)
## # A tibble: 6 × 9
##   Brand   Model                       `Capacity (kWh)` `Acceleration (sec)` TopSpeed (km…¹ Range…² Effic…³ Drive Price…⁴
##   <chr>   <chr>                                  <dbl>                <dbl>          <dbl>   <dbl>   <dbl> <chr>   <dbl>
## 1 Opel    Ampera-e                                58                    7.3            150     335     173 Fron…   42990
## 2 Renault Kangoo Maxi ZE 33                       31                   22.4            130     160     194 Fron…       0
## 3 Nissan  Leaf                                    36                    7.9            144     220     164 Fron…   29990
## 4 Audi    e-tron Sportback 55 quattro             86.5                  5.7            200     375     231 All …       0
## 5 Porsche Taycan Turbo S                          83.7                  2.8            260     390     215 All …  186336
## 6 Nissan  e-NV200 Evalia                          36                   14              123     165     218 Fron…   43433
## # … with abbreviated variable names ¹​`TopSpeed (km/h)`, ²​`Range (km)`, ³​`Efficiency (Wh/km)`, ⁴​`PriceinGer (€)`
colnames(mydata) <- c("Brand","Model","Capacity","Acceleration","Top_Speed","Range","Efficiency","Drive", "Price_Germany")
mydata$DriveF <- factor(mydata$Drive,
                              levels = c( "Front Wheel Drive", "Rear Wheel Drive", "All Wheel Drive"),
                              labels = c(1,2,3))
mydata1 <- mydata %>%
  replace_with_na(replace = list(Price_Germany = c(0)))
mydata1 <- tidyr::drop_na(mydata1)
mydata1 <- mydata1[c(-4,-5)]
head(mydata1)
## # A tibble: 6 × 8
##   Brand      Model                 Capacity Range Efficiency Drive             Price_Germany DriveF
##   <chr>      <chr>                    <dbl> <dbl>      <dbl> <chr>                     <dbl> <fct> 
## 1 Opel       Ampera-e                  58     335        173 Front Wheel Drive         42990 1     
## 2 Nissan     Leaf                      36     220        164 Front Wheel Drive         29990 1     
## 3 Porsche    Taycan Turbo S            83.7   390        215 All Wheel Drive          186336 3     
## 4 Nissan     e-NV200 Evalia            36     165        218 Front Wheel Drive         43433 1     
## 5 Volkswagen ID.3 Pure Performance     45     275        164 Rear Wheel Drive          31960 2     
## 6 BMW        iX3                       74     385        192 Rear Wheel Drive          66300 2
str(mydata1)
## tibble [168 × 8] (S3: tbl_df/tbl/data.frame)
##  $ Brand        : chr [1:168] "Opel" "Nissan" "Porsche" "Nissan" ...
##  $ Model        : chr [1:168] "Ampera-e" "Leaf" "Taycan Turbo S" "e-NV200 Evalia" ...
##  $ Capacity     : num [1:168] 58 36 83.7 36 45 74 56 37.9 66.5 45 ...
##  $ Range        : num [1:168] 335 220 390 165 275 385 325 235 355 250 ...
##  $ Efficiency   : num [1:168] 173 164 215 218 164 192 172 161 187 180 ...
##  $ Drive        : chr [1:168] "Front Wheel Drive" "Front Wheel Drive" "All Wheel Drive" "Front Wheel Drive" ...
##  $ Price_Germany: num [1:168] 42990 29990 186336 43433 31960 ...
##  $ DriveF       : Factor w/ 3 levels "1","2","3": 1 1 3 1 2 2 1 2 1 1 ...

Description:

Unit of observation: BEV car model in Germany in 2022

dim(mydata1)
## [1] 168   8

Sample size: 168 (without missing values)

Source of the data: Kaggle- Cheapest Electric Cars https://www.kaggle.com/datasets/kkhandekar/cheapest-electric-cars

The main goal of the data analysis is to see how variables like efficiency, drive type and maximum range of BEV vehicle affect the price of the BEV car in Germany.

summary(mydata1[c(-1,-2,-6)])
##     Capacity          Range         Efficiency    Price_Germany    DriveF
##  Min.   : 16.70   Min.   : 95.0   Min.   :104.0   Min.   : 18460   1:64  
##  1st Qu.: 45.00   1st Qu.:258.8   1st Qu.:168.0   1st Qu.: 38000   2:44  
##  Median : 66.50   Median :340.0   Median :189.0   Median : 50648   3:60  
##  Mean   : 65.57   Mean   :338.4   Mean   :194.8   Mean   : 58725         
##  3rd Qu.: 77.40   3rd Qu.:400.0   3rd Qu.:216.2   3rd Qu.: 64648         
##  Max.   :200.00   Max.   :970.0   Max.   :281.0   Max.   :215000

Average Capacity of BEV vehicle was 65.57 kWh. Average Efficiency of BEV vehicle was 194.8 Wh/km. Average Range of BEV vehicles was 338.4 km. Average Price of BEV vehicle in Germany was 58725€.

Median for Capacity is 66.50 kWh- half of the BEV vehicles had battery storage of 65.57 kWh or less, the other 50% has more storage than 65.57 kWh. Median for Range is 340 km- half of the BEV vehicles could travel 340 km of distance or less, the other 50% could travel longer than 340 km. Median for Efficiency is 189.0- half of the BEV vehicles had efficiency of 189 Wh/km or less, the other 50% had efficiency more than 189 Wh/km. Median for Price of BEV vehicle in Germany is 50648€- half of the BEV vehicle in Germany cost 50648€ or less, the other 50% cost more than 50648€.

round(stat.desc(mydata1[c(3,4,5,7)]),2)
##              Capacity    Range Efficiency Price_Germany
## nbr.val        168.00   168.00     168.00  1.680000e+02
## nbr.null         0.00     0.00       0.00  0.000000e+00
## nbr.na           0.00     0.00       0.00  0.000000e+00
## min             16.70    95.00     104.00  1.846000e+04
## max            200.00   970.00     281.00  2.150000e+05
## range          183.30   875.00     177.00  1.965400e+05
## sum          11015.40 56850.00   32720.00  9.865865e+06
## median          66.50   340.00     189.00  5.064750e+04
## mean            65.57   338.39     194.76  5.872539e+04
## SE.mean          1.95     9.30       2.55  2.524500e+03
## CI.mean.0.95     3.84    18.36       5.03  4.984050e+03
## var            637.03 14533.33    1090.66  1.070681e+09
## std.dev         25.24   120.55      33.03  3.272126e+04
## coef.var         0.38     0.36       0.17  5.600000e-01

How is variable Price of BEV vehicles in Germany distributed.

hist(mydata1$Price_Germany,
     xlab = "Price in Germany (€)", 
     ylab = "Frequency", 
     main = "Price of BEV vehicles in Germany")

This is positive asymmetric distribution, with a high concentration of observations around 50,000€ mark.

Who is the top Manufacturer of BEV vehicles

mydata1 %>%
  ggplot(aes(x = Brand))+
  geom_bar()+
  labs(x="Brand")+
  coord_flip()

We can see that Audi and Tesla are main producers of BEV vehicles.

Difference in price for different types of drive.

ggplot(data=mydata1, aes(x=Drive, y=Price_Germany)) + 
  geom_boxplot()+
  xlab("Drive") + 
  ylab("Price")

We can see that mean price of a BEV vehicle in Germany for Front and Rear wheel drive isn’t much different, while mean price in the group of All Wheel Drive is much higher (therefore it is likely to be a difference between groups). What we can also see from the boxplot is how different variables are distributed. In case of All Wheel Drive and Front Wheel Drive we can see that the distribution will be positively skewed, while Rear Wheel Drive will be normally distributed.

mydata1 %>%
  ggplot(aes(x = Range, y= Efficiency, color=Drive))+
  geom_point()

Based on this figure we can see that Front Wheel Drive is focused more on Efficiency rather than Range. Based on the figure above (boxplot), BEV cars as such are on average the cheapest and their range is hardly exceeding 375 km. Rear Wheel Drive, on the other hand, is dispersed the most in terms of Range and not so much in terms of Efficiency. Lastly All Wheel Drive is considered as more premium type of BEV vehicle, based on figure above, and they offer bigger Range and Efficiency.

library(car)
scatterplot(y = mydata1$Price_Germany, x = mydata1$Efficiency,
            main="Relation between Efficiency and Price",
            ylab = "Price",
            xlab = "Efficiency",
            smooth = FALSE)

Based on Scatterplot we can see a positive correlation between Efficiency and Price, therefore we suspect that higher Efficiency means higher Price.

scatterplot(y = mydata1$Price_Germany, x = mydata1$Range,
            main="Relation between Range and Price",
            ylab = "Price",
            xlab = "Range",
            smooth = FALSE)

The effect of range is stronger than efficiency because the slope is steeper. Therefore, the price will increase much more in case of additional km of range.

scatterplot(Price_Germany ~ Efficiency | Drive,
            main="Relation between Efficiency and Price",
            ylab = "Price",
            xlab = "Efficiency",
            smooth = FALSE,
            data = mydata1)

scatterplot(Price_Germany ~ Range| Drive,
            main="Relation between Range and Price",
            ylab = "Price",
            xlab = "Range",
            smooth = FALSE,
            data = mydata1)

The last 2 scatterplots connect all four observed variables. Based on first scatterplot (observes relationship between Price and Efficiency for different Drive types) we can see that for Front and Rear Wheel drive type the correlation is positive, meaning that higher the price, higher the efficiency. However, in case of All Wheel Drive we see a negative relationship. This is likely due to All Wheel Drive types being more oriented to other attributes such as Acceleration since they are considered as more “luxury” type of cars. The second scatterplot observes relationship between Price and Range for different Drive types. We can see positive correlation for all Drive types. For All Wheel Drive type the Price is highly affected by higher Range, while for Front Wheel Drive we can see minimal correlation. Again we can say that Front Wheel Drive type is more focused on Efficiency than Range.

Lastly I researched which BEV car model is more efficient/ has more range compared to its price.

mydata3 <- mydata1[c(-3,-8)]
mydata3$Price_Efficiency <- round(mydata1$Price_Germany/mydata1$Efficiency, digits=2)
mydata3$Price_Range <- round(mydata1$Price_Germany/mydata1$Range, digits=2)
head(mydata3[order(mydata3$Price_Efficiency),], 5)
## # A tibble: 5 × 8
##   Brand Model            Range Efficiency Drive             Price_Germany Price_Efficiency Price_Range
##   <chr> <chr>            <dbl>      <dbl> <chr>                     <dbl>            <dbl>       <dbl>
## 1 Smart EQ forfour          95        176 Rear Wheel Drive          19120             109.       201. 
## 2 Smart EQ fortwo coupe    100        167 Rear Wheel Drive          18460             111.       185. 
## 3 Smart EQ fortwo cabrio    95        176 Rear Wheel Drive          21720             123.       229. 
## 4 Dacia Spring Electric    170        158 Front Wheel Drive         20490             130.       121. 
## 5 Sono  Sion               260        181 Front Wheel Drive         25500             141.        98.1

When it comes to Efficiency Brand Smart is dominating.

head(mydata3[order(mydata3$Price_Range),], 5)
## # A tibble: 5 × 8
##   Brand      Model                Range Efficiency Drive             Price_Germany Price_Efficiency Price_Range
##   <chr>      <chr>                <dbl>      <dbl> <chr>                     <dbl>            <dbl>       <dbl>
## 1 Volkswagen ID.3 Pro S             450        171 Rear Wheel Drive          41995             246.        93.3
## 2 CUPRA      Born 170 kW - 82 kWh   450        171 Rear Wheel Drive          43000             251.        95.6
## 3 Sono       Sion                   260        181 Front Wheel Drive         25500             141.        98.1
## 4 Volkswagen ID.3 Pro               350        166 Rear Wheel Drive          34995             211.       100. 
## 5 Tesla      Cybertruck Tri Motor   750        267 All Wheel Drive           75000             281.       100

Volkswagen group is dominating in Price per Range dimension. With three of their models, considering that CUPRA is also a part of Volkswagen group. All of them request less than 100 € per one km.