Java Array Max Value maxLikelihood(int[] i, long[] Xi)

Here you can find the source of maxLikelihood(int[] i, long[] Xi)

Description

max Likelihood

License

Open Source License

Declaration

public static double maxLikelihood(int[] i, long[] Xi) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static double maxLikelihood(int[] i, long[] Xi) {
        double sum = 0;
        for (int x = 0; x < i.length; x++) {
            sum += i[x] * Xi[x];/*from w  ww  .java  2s .co m*/
        }
        double n = getN(Xi);
        return ((1d / n) * sum);
    }

    private static long getN(long[] Xi) {
        long n = 0;
        for (long aXi : Xi) {
            n += aXi;
        }
        return n;
    }
}

Related

  1. maxIndices(int values[])
  2. maxInt(int... values)
  3. maxInVector(double[] _vector)
  4. maxJoinArray(float[] array1, float[] array2)
  5. maxLength(String... array)
  6. maxLimit(int receiver, int... maxBound)
  7. maxLocation(double[] list)
  8. maxNorm(double[] arr)
  9. maxNorm(double[] x1, double[] x2)