Skip to content

Instantly share code, notes, and snippets.

@mtmoses
Created August 6, 2021 04:13
Show Gist options
  • Save mtmoses/3949a7fe455df981777a928f7e400424 to your computer and use it in GitHub Desktop.
Save mtmoses/3949a7fe455df981777a928f7e400424 to your computer and use it in GitHub Desktop.
def lognormal_cascade(k, v,ln_lambda, ln_theta):
k = k - 1
m0 = np.random.lognormal(ln_lambda,ln_theta)
m1 = np.random.lognormal(ln_lambda,ln_theta)
M = [m0, m1]
if (k >= 0):
d=[0 for x in range(0,2)]
for i in range(0,2):
d[i] = lognormal_cascade(k, (M[i]*v), ln_lambda, ln_theta)
v = d
return v
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment