1 package JSci.maths.statistics; 2 3 8 public final class LognormalDistribution extends ProbabilityDistribution { 9 private NormalDistribution normal; 10 11 14 public LognormalDistribution() { 15 this(0.0,1.0); 16 } 17 22 public LognormalDistribution(double mu,double sigma) { 23 normal=new NormalDistribution(mu,sigma*sigma); 24 } 25 28 public double getMuParameter() { 29 return normal.getMean(); 30 } 31 34 public double getSigmaParameter() { 35 return Math.sqrt(normal.getVariance()); 36 } 37 41 public double probability(double X) { 42 checkRange(X,0.0,Double.MAX_VALUE); 43 return normal.probability(Math.log(X))/X; 44 } 45 49 public double cumulative(double X) { 50 checkRange(X,0.0,Double.MAX_VALUE); 51 return normal.cumulative(Math.log(X)); 52 } 53 57 public double inverse(double probability) { 58 return Math.exp(normal.inverse(probability)); 59 } 60 } 61 62 | Popular Tags |