Changeset 178

Show
Ignore:
Timestamp:
05/12/08 21:29:10 (8 months ago)
Author:
edsuom
Message:

Rewrote zProposal to use truncated normal

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • projects/AsynCluster/trunk/svpmc/model.c

    r177 r178  
    9797double ncdf(double x) 
    9898{ 
    99   double ax, t, sum; 
     99  double ax, t, tp, sum; 
    100100  // The cdf is computed from the absolute value of x and corrected at the end 
    101101  // if necessary 
     
    104104  t = 1.0 / (1.0 + 0.2316419*ax); 
    105105  // Efficiently compute the series summation 
    106   sum  =  t       * +0.31938;   // t 
    107   sum += (t *= t) * -0.35656;   // t^2 
    108   sum += (t *= t) * +1.78148;   // t^3 
    109   sum += (t *= t) * -1.82125;   // t^4 
    110   sum += (t *= t) * +1.33027;   // t^5 
     106  tp = t; 
     107  sum  = tp * 0.31938;  // t 
     108  tp *= t; 
     109  sum -= tp * 0.35656;  // t^2 
     110  tp *= t; 
     111  sum += tp * 1.78148;  // t^3 
     112  tp *= t; 
     113  sum -= tp * 1.82125;  // t^4 
     114  tp *= t; 
     115  sum += tp * 1.33027;  // t^5 
    111116  // Compute the cdf, assuming x to be positive 
    112   sum *= (1.0 - npdf(ax)); 
     117  sum *= npdf(ax); 
    113118  // Correct if x < 0 
    114   if(x < 0) 
     119  if(x > 0) 
    115120    sum = 1 - sum; 
    116121  // All done 
  • projects/AsynCluster/trunk/svpmc/model.py

    r177 r178  
    179179    @ivar Mv: Number of volatility draws per likelihood evaluation. 
    180180 
    181     @ivar Mz: Number of random-walk normal draws per volatility draw. 
    182  
    183181    """ 
    184182    _logU_index = -1 
    185183 
    186     keyAttrs = {'y':None, 'Mv':40, 'Mz':30
     184    keyAttrs = {'y':None, 'Mv':1
    187185 
    188186    #--- Properties ----------------------------------------------------------- 
     
    267265        """ 
    268266        z = z.copy() 
    269         L = self.inline('z', 'M', 'wiggle', M=self.Mz
     267        L = self.inline('z', 'wiggle'
    270268        return z, L 
    271269     
  • projects/AsynCluster/trunk/svpmc/pmc.py

    r176 r178  
    141141    """ 
    142142    chunkSize = 500 
    143     initialSigma = 0.5 
     143    initialSigma = 0.3 
    144144     
    145145    def __init__(self, projectManager, socket=None): 
     
    200200            if s.isfinite(paramContainer.Lx): 
    201201                L = paramContainer.Lx + paramContainer.Lp \ 
    202                     - paramContainer.Lj #- paramContainer.Lh 
     202                    - paramContainer.Lj - paramContainer.Lh 
    203203                info = " ".join([ 
    204204                    "%+12.2f" % (getattr(paramContainer, x),) 
  • projects/AsynCluster/trunk/svpmc/test/test_model.py

    r177 r178  
    332332 
    333333    def test_zProposal_dist(self): 
    334         N = 1000 
     334        N = 10000 
    335335        z = s.zeros((2,3)) 
    336336        modelObj = self.modelFactory()