Esempio n. 1
0
 def random(self, size=None):
     mu = self.mu
     lam = self.lam
     alpha = self.alpha
     v = rnormal(loc=0., scale=1., size=size)**2
     x = mu + (mu**2) * v / (2. * lam) - mu / (
         2. * lam) * sqrt(4. * mu * lam * v + (mu * v)**2)
     z = runiform(low=0., high=1., size=size)
     # i = z > mu / (mu + x)
     # x[i] = (mu**2) / x[i]
     i = floor(z - mu / (mu + x)) * 2 + 1
     x = (x**-i) * (mu**(i + 1))
     return x + alpha
Esempio n. 2
0
 def random(size=None):
     return runiform(upper, lower, size)
Esempio n. 3
0
 def random(self, size=None):
     return runiform(self.upper, self.lower, size)
Esempio n. 4
0
 def random(self, size=None):
     return runiform(self.upper, self.lower, size)
Esempio n. 5
0
 def random(size=None):
     return runiform(upper, lower, size)
from numpy import zeros

xdim = 100

cmatrix = zeros((xdim,xdim))
cblank = zeros((xdim,xdim))
chybrid = zeros((xdim,xdim))
i = 0

while i < xdim:
    j = i + 1
    cmatrix[i,i] = 1
    cblank[i,i] = 1
    chybrid[i,i] = 1
    while j < xdim:
        rho = runiform(0.9,1,1)
        cmatrix[i,j] = rho
        cmatrix[j,i] = rho
        
        if i < xdim/2:
            if j < xdim/2:
                chybrid[i,j]=rho
                chybrid[j,i]=rho
            
        j = j + 1
    i = i + 1

nummodels = 5

beta0 = zeros(nummodels)    
beta = zeros((xdim,nummodels))
Esempio n. 7
0
 def random(self, size=None):
     u = runiform(low=0., high=1., size=size)
     n = rnormal(self.mu, self.sigma, size=size)
     return n - self.nu * log(u)