R0-simulation

186 days ago by ncr006

Towers, et al. Colombia Zika

rho = .01 
       
kappa = 1/(10*random()+2) 
       
kappa 
       
0.19934806949788345
0.19934806949788345
gamma = 1/(4*random()+3) 
       
eta = 1/(11*random()+4) 
       
mu = 1/(14*random()+6) 
       
R0 = (rho+kappa)*(rho+gamma)*(rho+mu)*(rho+mu+eta)/(kappa*gamma*mu*(mu+eta)) 
       
R0 
       
1.26369524974530
1.26369524974530
 
       
 
       
 
       
 
       
 
       
import scipy.stats 
       
a = 1.99 L=list(scipy.stats.gamma.rvs(a,size=1000,loc=10.5,scale=0.5)) 
       
sum(L)/1000 
       
11.525487208317291
11.525487208317291
import numpy as np 
       
shape, scale = 2., 2. 
       
s = np.random.gamma(shape, scale, 10) 
       
list(s) 
       
[4.8077871958252176,
 2.9999313369409575,
 1.5990785747992489,
 1.9497757105273417,
 3.159810536280184,
 1.7405019861420117,
 5.4226900941137668,
 7.3416970961216306,
 0.10904909141473021,
 1.1317765167680085]
[4.8077871958252176,
 2.9999313369409575,
 1.5990785747992489,
 1.9497757105273417,
 3.159810536280184,
 1.7405019861420117,
 5.4226900941137668,
 7.3416970961216306,
 0.10904909141473021,
 1.1317765167680085]
sum(s)/10 
       
3.0262098138933098
3.0262098138933098