Modelling Uncertainty: When will I get delivery of my Car?

Covid 19 has affected everyone. Direct effects of these were felt by everyone and indirect effects will be felt for some time.

One of the second-order effects was the chip shortage and the consequent delay in car manufacturing and deliveries.

Let’s start from the beginning, In December 2021, after sitting on the fence and no longer batting my better half nugs, we booked our car.

The selection, shortlisting and elimination took a few weeks and then after a round of test drives, finally booked KIA Sonet G1.0T HTX iMT.

Being the most value for money (VFM) variant and the best transmission combination variant, this had a waiting of 19-20 weeks.

The first 10 weeks of waiting were easy to pass, looking at youtube videos of accessories, modifications, road trips etc but as we entered the double-digit phase of the waiting weeks, everyone was anxious to know when are we getting our car?

A couple of calls to the CSR only solicited, please wait you are on the 6th person in line. That’s what has happened so far till we entered the month of Feb.

Frustrated with the wait and the uncertainty, there is one thing left that the engineer in me was dying to try. Put some numbers to this uncertainty.

The uncertainty increased as we had a planned vacation in April, so my better half was anxious if there will be a clash in delivery and our travel plans

So turned to Montecarlo to predict what are the chances of getting the car in mid-Feb, end Feb, mid-Mar or beyond.

Here’s how I did it.

import numpy as np
import scipy.stats as st

import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns

%matplotlib inline

Data Collection

Turned to google and the internet and got the data for last year’s KIA Sonet monthly deliveries in India. This is 2021 data on which we will base our predictions.

sales_data = np.asarray([8859,7997,8498,7724,6627,5963,7675,7752,4454,5443,4719,3578])
plt.bar(range(len(sales_data)),sales_data);
Not an encouraging sign, limited and declining production numbers

We will use a 90% confidence interval for the normal distribution and a rough guesstimate of the number of KIA dealers in India

ci_90 = 3.29

#Rough no of KIA delaers
nodelears = 250

# No of monte carlo simulations
nos = 1000000

Time to Make Some Assumptions

After this data collection, there were other things that I have to estimate

  • Percentage of people opting for the petrol variant. Low and High
  • Percentage of people opting for IMT transmission. Low and High
  • Percentage of people buying the HTX variant. HTX is the most value-for-money variant. Mostly derived this number based on our discussions with the sales person and youtube videos and a cursory look at social media posts
# This is our rough consesus estimate with 90% confidence
# % of people oping for petrol
petrol_low = 0.6
petrol_high = 0.7

# IMT transmission
# % of people buying imt transmission
imt_low = .30
imt_high = .40

# HTX Variant probability 
# % of people buying the Sonet HTX variant
variant_low = 0.40
variant_high = 0.50

Converting all this data collected into normal distributions

petrol = st.norm(loc=(petrol_low+petrol_high)/2, scale=(petrol_high-petrol_low)/ci_90)
imt = st.norm(loc=(imt_high+imt_low)/2, scale=(imt_high-imt_low)/ci_90)
variant = st.norm(loc=(variant_high+variant_low)/2, scale=(variant_high-variant_low)/ci_90)

# Generating the data for 1000000 simulations

petrol_results = petrol.rvs(nos)
imt_result = imt.rvs(nos)
variant_result = variant.rvs(nos)

Now using the historical data and the simulation numbers of Kia Sonet deliveries to predict the next 3 month mean deliveries

sales=np.random.choice(sales_data, (nos,3)).mean(1)
sns.displot(sales, kind="kde");
Encouraging sign or were we too optimistic about our assumptions?
# Storing everything into a dataframe for easy statistics
data = pd.DataFrame({
"sales":sales,
"petrol":petrol_results,
"imt":imt_result,
"variant":variant_result})

print(data.describe())

                sales          petrol             imt         variant
count  1000000.000000  1000000.000000  1000000.000000  1000000.000000
mean      6607.339004        0.650043        0.349980        0.449967
std        962.995620        0.030412        0.030419        0.030376
min       3578.000000        0.507467        0.202519        0.312613
25%       5960.000000        0.629536        0.329489        0.429458
50%       6646.666667        0.650035        0.349975        0.449975
75%       7325.666667        0.670540        0.370531        0.470449
max       8859.000000        0.796902        0.496014        0.588184

Computing final number

Once we have this data, now using this we calculate Nocars that our dealership can get

Nocars is a number of deliveries that a dealership will get for the variant, transmission and engine we are interested in.

data["nocars"] = (data.sales*data.petrol*data.imt*data.variant)/nodelears
print(data.nocars.describe())

count    1000000.000000
mean           2.705510
std            0.512645
min            1.070139
25%            2.344456
50%            2.686584
75%            3.044903
max            5.662677

Inference

As seen in the above column, the dealership will receive less than 3 cars delivered per month 75% of the time. Not looking good for us we were the 6th person in line.

plt.axvline(x= data.nocars.mean(), c='g');
plt.hist(data.nocars, bins=100);
Less than 3 deliveries per month for the dealership for our chosen variant. 😦
pesimistic = data.nocars.quantile(q=0.25)
mean = data.nocars.mean()
optimistic = data.nocars.quantile(q=0.75)

timea = ["feb-beg", "feb-end", "mid-mar", "end-mar", "mid-apr", "end-apr"]
multiplier =[0.5, 0.75, 1, 2,2.8,3]

print("Time", "\t", "Pessimistic", "\t", "Mean", "\t", "Optimistic")
for t,m in zip(timea,multiplier):
    print(t, "\t",round(m*pesimistic, 0),"\t",round(m*mean, 0),"\t",round(m*optimistic, 0))

Time 	 Pessimistic 	 Mean 	 Optimistic
feb-beg 	 1.0 	 1.0 	 2.0
feb-end 	 2.0 	 2.0 	 2.0
mid-mar 	 2.0 	 3.0 	 3.0
end-mar 	 5.0 	 5.0 	 6.0
mid-apr 	 7.0 	 8.0 	 9.0
end-apr 	 7.0 	 8.0 	 9.0

Probability

Probability of number of Petrol Sonets IMT transmission HTX variants the dealership can get in a given month, based on past data

for i in range(1,6):
    print(i, round(data[data.nocars>i]["nocars"].count()/nos*100,2), "%" )

1 100.0 %
2 92.0 %
3 27.69 %
4 0.85 %
5 0.0 %

Bottom line, very slim chance of getting the car by end of March, most probable date was the end of April, which came to the promised delivery date.

What has this exercise taught me?

A lot.

Putting a number to that uncertainty was a huge deal for me and with this exercise, I dispelled all hope that I will get the car in March as verbally promised by the dealership. Also, these calculations gave me a little insight into how Covid continues to affect us way beyond the initial days.


I have used Montecarlo in my work for modelling material, geometry, and BC uncertainties in gas turbine engines but this was the first time I tried using it on something so close to my own life and circumstances.

It was a fun exercise.

Update:

Someone doing this analysis today can use the data provided by the company

According to the company, 25% of Sonet buyers chose the iMT variants, while 22% opted for the automatic transmission. 26% of customers prefer the top variants, while diesel variants accounted for 41% of the overall Sonet sales.

According to Kia, the two most popular colours for the Sonet are Glacier White Pearl and Aurora Black Pearl. These account for 44% of the overall dispatches.

source

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s