Skip to content

Commit

Permalink
exponential and gamma distribution
Browse files Browse the repository at this point in the history
Hi Stephan,
I had to use exponential and gamma distribution. Maybe you find useful to add them...
Cheers
G
  • Loading branch information
cardosan committed Apr 14, 2016
1 parent 732d8bc commit 2422415
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion dynamic_stock_model/dynamic_stock_model.py
Expand Up @@ -215,7 +215,23 @@ def compute_outflow_pdf(self):
for n in range(m + 1, len(self.t)):
self.pdf[n, m] = scipy.stats.weibull_min(self.lt['Shape'][m], 0, self.lt['Scale'][m]).cdf(n -m) - scipy.stats.weibull_min(self.lt['Shape'][m], 0, self.lt['Scale'][m]).cdf(n -m -1) # Call scipy's Weibull_min function with Shape, offset (0), Scale, and Age
ExitFlag = 1


if self.lt['Type'] == 'Exponential':
for m in range(0, len(self.t)): # cohort index
# year index, year larger or equal than cohort
for n in range(m + 1, len(self.t)):
self.pdf[n, m] = scipy.stats.expon(scale=self.lt['Mean'][m]).pdf(n - m) # Call scipy's expon function with Mean-lifetime
ExitFlag = 1

if self.lt['Type'] == 'Gamma': #
for m in range(0, len(self.t)): # cohort index
# year index, year larger or equal than cohort
for n in range(m + 1, len(self.t)):
self.pdf[n, m] = scipy.stats.gamma(a=self.lt['Shape'][m], loc=0, scale=self.lt['Scale'][m]).pdf(n - m) # Call scipy's gamma function with shape, scale, and loc=0
ExitFlag = 1



return self.pdf, ExitFlag
else:
ExitFlag = 2 # pdf already exists
Expand Down

0 comments on commit 2422415

Please sign in to comment.