All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.TKnudsen.ComplexDataObject.model.statistics.test.SimpsonsDiversityIndexTest Maven / Gradle / Ivy

Go to download

A library that models real-world objects in Java, referred to as ComplexDataObjects. Other features: IO and preprocessing of ComplexDataObjects.

The newest version!
package com.github.TKnudsen.ComplexDataObject.model.statistics.test;

import com.github.TKnudsen.ComplexDataObject.model.statistics.SimpsonsIndex;

/**
 * 

* Title: SimpsonsDiversityIndexTest *

* *

* Description: *

* *

* Copyright: Copyright (c) 2016-2017 *

* * @author Juergen Bernard * @version 1.01 */ public class SimpsonsDiversityIndexTest { public static void main(String args[]) { // you should use integers. iff the index is use for double values this // is how the index can be addressed. double[] probability = new double[5]; probability[0] = 0.3; probability[1] = 0.2; probability[2] = 0.2; probability[3] = 0.2; probability[4] = 0.1; int[] distribution = SimpsonsIndex.transformToIntDistribution(probability); distribution[0] = 1; distribution[1] = 2; distribution[2] = 1; distribution[3] = 1; distribution[4] = 1; System.out.println("Simpsons Diversity Index: " + SimpsonsIndex.calculateSimpsonsIndexOfDiversity(distribution)); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy