/** * Constructor of one sample Q-Q plot to standard normal distribution. */ public QQPlot(double[] x) { data = quantile(x, GaussianDistribution.getInstance()); }
@Override public double rand() { double x = 0.0; for (int i = 0; i < nu; i++) { double norm = GaussianDistribution.getInstance().rand(); x += norm * norm; } return x; }
/** * Constructor. */ @SuppressWarnings("unchecked") Hash() { a = new double[k][d]; b = new double[k]; for (int i = 0; i < k; i++) { for (int j = 0; j < d; j++) { a[i][j] = GaussianDistribution.getInstance().rand(); } b[i] = Math.random(0, w); } LinkedList<Item> list = new LinkedList<>(); table = (LinkedList<Item>[]) java.lang.reflect.Array.newInstance(list.getClass(), H); }
/** * Calculates the Anderson-Darling statistic for one-dimensional normality test. * * @param x the samples to test if drawn from a Gaussian distribution. */ private static double AndersonDarling(double[] x) { int n = x.length; Arrays.sort(x); for (int i = 0; i < n; i++) { x[i] = GaussianDistribution.getInstance().cdf(x[i]); // in case overflow when taking log later. if (x[i] == 0) x[i] = 0.0000001; if (x[i] == 1) x[i] = 0.9999999; } double A = 0.0; for (int i = 0; i < n; i++) { A -= (2*i+1) * (Math.log(x[i]) + Math.log(1-x[n-i-1])); } A = A / n - n; A *= (1 + 4.0/n - 25.0/(n*n)); return A; }
/** * Create a plot canvas with the one sample Q-Q plot to standard normal * distribution. The x-axis is the quantiles of x and the y-axis is the * quantiles of normal distribution. * @param x a sample set. */ public static PlotCanvas plot(double[] x) { double[] lowerBound = {Math.min(x), GaussianDistribution.getInstance().quantile(1 / (x.length + 1.0))}; double[] upperBound = {Math.max(x), GaussianDistribution.getInstance().quantile(x.length / (x.length + 1.0))}; PlotCanvas canvas = new PlotCanvas(lowerBound, upperBound); canvas.add(new QQPlot(x)); return canvas; }
double alph = GaussianDistribution.getInstance().quantile(0.999); double errMax = 0.001; e[0] = GaussianDistribution.getInstance().cdf(v[0] / sigmaL.get(0, 0)); f[0] = e[0]; double[] w = Math.random(dim - 1); for (int i = 1; i < dim; i++) { y[i - 1] = GaussianDistribution.getInstance().quantile(w[i - 1] * e[i - 1]); double q = 0.0; for (int j = 0; j < i; j++) { e[i] = GaussianDistribution.getInstance().cdf((v[i] - q) / sigmaL.get(i, i)); f[i] = e[i] * f[i - 1];
GaussianDistribution gauss = GaussianDistribution.getInstance(); for (int i = 0; i < p; i++) { for (int j = 0; j < n; j++) {