In: Statistics and Probability
In inventory control the engineer is faced with the following dilemma. If she keeps too much inventory, it results in high costs. On the other hand, if she keeps too few items, she runs the possibility of stocking out. The scenario in this problem is as follows:
– Demand for a spare part ~ Poisson(2) –
On-hand inventory ~ Binomial(4, 0.5)
• 4 is our choice for the stock to keep on hand each day
• 0.5 models our (in)ability to keep n units available
Use R to
(1)Show a simulation with 100 rows of data and create two columns one for the excess inventory, if any, and one for lost potential items sold.
(2)Show the pmf of Demand, On-hand Inventory, Excess, and loss.
(3)Also show descriptive stats for each of the following statistics (Mean, standard deviation, and maximum)
Solution:
r code to simulate data
On_hand_inventory<-rbinom(100,4,0.5)
Demand<-rpois(100,2)
table(On_hand_inventory)
table(Demand)
excess_loss<-On_hand_inventory-Demand
table(excess_loss)
loss<-split(excess_loss, cut(excess_loss, c(-5,-1),
include.lowest=TRUE))
excess<-split(excess_loss, cut(excess_loss, c(1,5),
include.lowest=TRUE))
table(loss)
table(excess)
Output:
Descriptive statistics was calculated in excel
If you want the real data just give print(Demand), print(On_handinventory) etc in r you get the raw data.