Input Analysis / Variance Reduction

6.1

Use Statsfit software to determine a Simio input distribution for the sample data inside 6_01.xlsx.

dist_1<-c(27.88,4.52,6.82,3.64,4.41,17.14,2.48,9.61,3.97,6.45,17.66,9.29,24.09,5.71,5.27,6.37,19.31,35.11,2.72,3.35,11.07,10.55,8.74,7.91,48.65,28.46,9.95,2.82,3.17,12.29,22.13,13.3,5.69,8.26,4.98,14.93,19.97,13.9,7.31,2.06,12.5,16.22)
hist(dist_1,breaks=length(dist_1))

From an initial eyeball test, it looks as if the data is potentially exponential in nature.

An initial run (manual) on exponential and lognormal gives a preference for an exponential distribution, however a modification and running of the autofit, with a defined bounds defined revealed more certainty with a lognormal. A healthy import for Simio then could be:

1 + Random.Lognormal(2.01,0.904)

6_1

6_1

6_1

6_1

The results of a goodness of fit testing:

6_1

6_1

6.2

Use Statsfit software to determine a Simio input distribution for the sample data inside 6_02.xlsx.

Upon initial inspection, the goodness of fit tests reveal that the lognormal is most suitable. Furthermore, an auto fit test reveals the same conclusion, as well as the appropriate Simio distribution parameter:

6_1

6_1

6_1

6_1

2.76 + Random.Lognormal(1.84,0.717)

6.3

Use Statsfit software to determine a Simio input distribution for the sample data inside 6_03.xlsx.

The following is an example of a discrete - binomial fit.

The simio input would be: 16 + Random.Binomial(0.185)

6_1 6_1

6.4

Derive the inverse-CDF formula for generating random variates from a continuous uniform distribution between real numbers a and b (a < b).

set.seed(10000)
a <- 4
b <- 77
x <- rnorm(1000, a, b)
pdf <- density(x)

# Interpolate the density
f <- approxfun(pdf$x, pdf$y, yleft=0, yright=0)

# Get the cdf by numeric integration
cdf <- function(x){
  integrate(f, -Inf, x)$value
}

# Use a root finding function to invert the cdf
invcdf <- function(q){
  uniroot(function(x){cdf(x) - q}, range(x))$root
}

med <- invcdf(.5)
cdf(med)
## [1] 0.5

6.5

Derive the inverse-CDF formula for generating random variates from a Weibull distribution.

Distribution : f(x) = (a/b) (x/b)^(a-1) exp(- (x/b)^a)

CDF : F(x) = 1 - exp(- (x/b)^a) on x > 0

x<-rweibull(1000, shape=0.75, scale=1)
pdf <- density(x)

# Interpolate the density
f <- approxfun(pdf$x, pdf$y, yleft=0, yright=0)

# Get the cdf by numeric integration
cdf <- function(x){
  integrate(f, -Inf, x)$value
}

# Use a root finding function to invert the cdf
invcdf <- function(q){
  uniroot(function(x){cdf(x) - q}, range(x))$root
}

med <- invcdf(.5)
cdf(med)
## [1] 0.5000078

6.8

Redo problem 3.17.

set.seed(11)
demand <- c(8,14,11)

peaSet <- c(0,0.5,1,1.5,2,3)
peaPrb<-c(0.1,0.2,0.2,0.3,0.1,0.1)

beansSet <- c(0,1,3,4.5)
beansPrb<-c(0.2,0.4,0.3,0.1)

barleySet <- c(0,0.5,1,3.5)
barleyPrb<-c(0.2,0.4,0.3,0.1)


sampleDist = function(set,prb,n,profit) { 
    totals<-sample(x = set, 90, replace = T, prob = prb) 
    #profit margin
    profit<-totals*profit
    return(totals)
}

a<-sampleDist(peaSet,peaPrb,90,0.59)
b<-sampleDist(beansSet,beansPrb,90,0.24)
c<-sampleDist(barleySet,barleyPrb,90,0.70)

summary(a)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   0.000   0.500   1.500   1.183   1.500   3.000
summary(b)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   0.000   1.000   1.000   1.683   3.000   4.500
summary(c)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##  0.0000  0.5000  0.5000  0.9167  1.0000  3.5000