Examples of PoissonDistribution

@version $Revision: 920852 $ $Date: 2010-03-09 13:53:44 +0100 (mar. 09 mars 2010) $
  • org.apache.commons.math3.distribution.PoissonDistribution
    pedia.org/wiki/Poisson_distribution">Poisson distribution (Wikipedia) @see Poisson distribution (MathWorld)
  • org.dmg.pmml.pmml_4_2.descr.PoissonDistribution
    3.org/2001/XMLSchema}anyType"> <sequence> <element ref="{http://www.dmg.org/PMML-4_2}Extension" maxOccurs="unbounded" minOccurs="0"/> </sequence> <attribute name="mean" use="required" type="{http://www.dmg.org/PMML-4_2}REAL-NUMBER" /> </restriction> </complexContent> </complexType>
  • org.jquantlib.math.distributions.PoissonDistribution
    Normal distribution function

    Given an integer {@latex$ k}, it returns its probability in a Poisson distribution. @author Dominik Holenstein


  • Examples of org.jquantlib.math.distributions.PoissonDistribution

            };

            final double mu = 0.5;        // mu = mean
            final int n = testvalues.length; // n = number of trials

            final PoissonDistribution poissondist = new PoissonDistribution(mu);

            for(int i=0;i<n;i++){
                final int z = i;
                final double expected = testvalues[i];
                final double computed = poissondist.op(z);
                // double tolerance = (z<6 ) ? 1.0e-15: 1.0e-10;
                final double tolerance = 1.0e-15; // try to to get 1.0e-15 accuracy whenever possible

                //assertEquals(expected, computed, tolerance);
                if(computed - expected > tolerance){
    View Full Code Here

    Examples of org.jquantlib.math.distributions.PoissonDistribution

            final Date volRefDate = process.blackVolatility().currentLink().referenceDate();
            final double /* @Time */t = voldc.yearFraction(volRefDate, A.exercise.lastDate());
            final double /* @Rate */riskFreeRate = -Math.log(process.riskFreeRate().currentLink().discount(A.exercise.lastDate())) / t;
            final Date rateRefDate = process.riskFreeRate().currentLink().referenceDate();

            final PoissonDistribution p = new PoissonDistribution(lambda * t);

            final Handle<? extends Quote> stateVariable = process.stateVariable();
            final Handle<YieldTermStructure> dividendTS = process.dividendYield();
            final RelinkableHandle<YieldTermStructure> riskFreeTS =
                new RelinkableHandle<YieldTermStructure>(process.riskFreeRate().currentLink());
            final RelinkableHandle<BlackVolTermStructure> volTS =
                new RelinkableHandle<BlackVolTermStructure>(process.blackVolatility().currentLink());

            final GeneralizedBlackScholesProcess bsProcess =
                new GeneralizedBlackScholesProcess(stateVariable, dividendTS, riskFreeTS, volTS);

            final AnalyticEuropeanEngine baseEngine = new AnalyticEuropeanEngine(bsProcess);

            final VanillaOption.ArgumentsImpl baseArguments = (VanillaOption.ArgumentsImpl) baseEngine.getArguments();

            baseArguments.payoff = A.payoff;
            baseArguments.exercise = A.exercise;

            baseArguments.validate();

            final VanillaOption.ResultsImpl baseResults = (VanillaOption.ResultsImpl) baseEngine.getResults();

            R.value = 0.0;
            greeks.delta = 0.0;
            greeks.gamma = 0.0;
            greeks.theta = 0.0;
            greeks.vega = 0.0;
            greeks.rho = 0.0;
            greeks.dividendRho = 0.0;


            double /* @Real */ r, v, weight, lastContribution = 1.0;
            double /* @Real */ theta_correction;

            int i;
            for (i = 0; lastContribution > relativeAccuracy && i < maxIterations || i < (int)(lambda*t); i++) {

                // constant vol/rate assumption. It should be relaxed
                v = Math.sqrt((variance + i * jumpSquareVol) / t);
                r = riskFreeRate - process.jumpIntensity().currentLink().value() * k + i * muPlusHalfSquareVol / t;
                riskFreeTS.linkTo(new FlatForward(rateRefDate, r, voldc));
                volTS.linkTo(new BlackConstantVol(rateRefDate, volcal, v, voldc));

                baseArguments.validate();
                baseEngine.calculate();

                weight = p.op(i);
                R.value += weight * baseResults.value;
                greeks.delta += weight * baseResults.greeks().delta;
                greeks.gamma += weight * baseResults.greeks().gamma;
                greeks.vega += weight * (Math.sqrt(variance / t) / v) * baseResults.greeks().vega;
                // theta modified
                theta_correction = baseResults.greeks().vega * ((i * jumpSquareVol) / (2.0 * v * t * t)) + baseResults.greeks().rho * i
                * muPlusHalfSquareVol / (t * t);
                greeks.theta += weight * (baseResults.greeks().theta + theta_correction + lambda * baseResults.value);
                if (i != 0) {
                    greeks.theta -= (p.op(i-1) * lambda * baseResults.value);
                }
                // end theta calculation
                greeks.rho += weight * baseResults.greeks().rho;
                greeks.dividendRho += weight * baseResults.greeks().dividendRho;

     
    View Full Code Here

    Examples of org.jquantlib.math.distributions.PoissonDistribution

            return icp.op(x);

        }
        // fix this return type and argument type got mixed up
          public static double evaluatePoissonDistribution(double mu, double sigma){
              PoissonDistribution pd = new PoissonDistribution(mu);
              int k = (int) sigma;
              return pd.op(k);
          }
    View Full Code Here
    TOP
    Copyright © 2018 www.massapi.com. All rights reserved.
    All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.