A salesperson in a large bicycle shop is paid a bonus if he

A salesperson in a large bicycle shop is paid a bonus if he sells more than 4 bicycles a day. The probability of selling more than 4 bicycles a day is only 0.40. If the number of bicycles sold is greater than 4, the distribution of sales is as shown in the table below. The shop has four different models of bicycles. The amount of the bonus paid out varies by type. The bonus for model A is $10; 40% of the bicycles sold are of this type. Model B accounts for 35% of the sales and pays a bonus of $15. Model C has a bonus rating of $20 and makes up 20% of the sales. Finally, model D pays a bonus of $25 for each sale but accounts for only 5% of the sales. Develop a simulation model to calculate the bonus a salesperson can expect in a day. Also report a 95% confidence interval for the mean bonus amount.

Solution

import numpy as np
from random import random

#initialising variables

probability_of_more_than_4 = 0.4
num_of_days = 10000
total_bonus = 0
bonuses = []

#simulation loop
for i in range(num_of_days):
    if random()>0.4: #checking if sold more than 4
        bonus_for_the_day = 0
        number_of_cycles_prob = random()

        #based on probability setting number of cycles sold
        if number_of_cycles_prob<0.35:
            num_of_cycles = 5
        elif number_of_cycles_prob<0.8:
            num_of_cycles = 6
        elif number_of_cycles_prob<0.95:
            num_of_cycles = 7
        else:
            num_of_cycles = 8

        #iterating through the cycles to calculate bonus
        for i in range(num_of_cycles):
            model = random() #selecting a random model based on given probabilities
            if model<0.4:
                bonus = 10
            elif model<0.75:
                bonus = 15
            if model<0.95:
                bonus = 20
            else:
                bonus = 25
            bonus_for_the_day += bonus
        bonuses.append(bonus_for_the_day)
        total_bonus += bonus_for_the_day
standard_dev = np.std(bonuses)
print \"std: \", standard_dev
standard_error = standard_dev/sqrt(num_of_days)
alpha = 0.05
critical_probability = 1-alpha/2.0
df = num_of_days - 1
average_bonus_per_day = total_bonus*1.0/num_of_days
print average_bonus_per_day

#Then calculate the confidence value using the table here:

#http://stattrek.com/online-calculator/t-distribution.aspx

#based on the values you get using this code. Since it will be a little different each time.

 A salesperson in a large bicycle shop is paid a bonus if he sells more than 4 bicycles a day. The probability of selling more than 4 bicycles a day is only 0.4
 A salesperson in a large bicycle shop is paid a bonus if he sells more than 4 bicycles a day. The probability of selling more than 4 bicycles a day is only 0.4

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site