@Test public void testLogP() { System.out.println("logP"); WeibullDistribution instance = new WeibullDistribution(1.5, 1.0); instance.rand(); assertEquals(Math.log(0.4595763), instance.logp(0.1), 1E-5); assertEquals(Math.log(0.6134254), instance.logp(0.2), 1E-5); assertEquals(Math.log(0.7447834), instance.logp(0.5), 1E-5); assertEquals(Math.log(0.2926085), instance.logp(1.5), 1E-5); assertEquals(Math.log(0.0455367), instance.logp(2.5), 1E-5); assertEquals(Math.log(4.677527e-05), instance.logp(5.0), 1E-5); }
@Override public double logp(double x) { if (x <= 0) { return Double.NEGATIVE_INFINITY; } else { return Math.log(k / lambda) + (k - 1) * Math.log(x / lambda) - Math.pow(x / lambda, k); } }
WeibullDistribution extends AbstractDistribution { @Override public double logp(double x) { if (x <= 0) { return Double.NEGATIVE_INFINITY; } else { return Math.log(k / lambda) + (k - 1) * Math.log(x / lambda) - Math.pow(x / lambda, k); } } }
WeibullDistribution extends AbstractDistribution { @Override public double logp(double x) { if (x <= 0) { return Double.NEGATIVE_INFINITY; } else { return Math.log(k / lambda) + (k - 1) * Math.log(x / lambda) - Math.pow(x / lambda, k); } } WeibullDistribution(double k);  WeibullDistribution(double k, double lambda); }
WeibullDistribution extends AbstractDistribution { @Override public double logp(double x) { if (x <= 0) { return Double.NEGATIVE_INFINITY; } else { return Math.log(k / lambda) + (k - 1) * Math.log(x / lambda) - Math.pow(x / lambda, k); } } WeibullDistribution(double k);  WeibullDistribution(double k, double lambda); @Override int length(); @Override double mean(); @Override double variance(); @Override double entropy(); @Override String toString(); @Override double rand(); @Override double p(double x); @Override double logp(double x); @Override double cdf(double x); @Override double quantile(double p); }
WeibullDistribution extends AbstractDistribution { @Override public double logp(double x) { if (x <= 0) { return Double.NEGATIVE_INFINITY; } else { return Math.log(k / lambda) + (k - 1) * Math.log(x / lambda) - Math.pow(x / lambda, k); } } WeibullDistribution(double k);  WeibullDistribution(double k, double lambda); @Override int length(); @Override double mean(); @Override double variance(); @Override double entropy(); @Override String toString(); @Override double rand(); @Override double p(double x); @Override double logp(double x); @Override double cdf(double x); @Override double quantile(double p); final double k; final double lambda; }