List of usage examples for org.apache.commons.math.stat Frequency Frequency
public Frequency()
From source file:org.openehealth.ipf.commons.test.performance.throughput.ThroughputDistributionStatistics.java
public ThroughputDistributionStatistics() { numberOfIntervalBins = DEFAULT_NUMBER_OF_BINS; frequencies = new Frequency(); }
From source file:org.rascalmpl.library.analysis.statistics.Frequencies.java
Frequency make(IList dataValues) { Frequency freq = new Frequency(); for (IValue v : dataValues) { if (v instanceof INumber) freq.addValue(new ComparableValue((INumber) v)); else if (v instanceof IString) freq.addValue(new ComparableValue((IString) v)); else/*from w ww.j av a 2 s. c o m*/ throw RuntimeExceptionFactory.illegalArgument(v, null, null); } return freq; }
From source file:playground.anhorni.surprice.analysis.ModeSharesEventHandler.java
@Override public void handleEvent(final PersonArrivalEvent arrivalEvent) { this.doReset(); PersonDepartureEvent departureEvent = this.pendantDepartures.remove(arrivalEvent.getPersonId()); String mode = arrivalEvent.getLegMode(); Frequency frequency;// w ww . j a va 2s. c om ResizableDoubleArray rawDataElement; // Consistency check... if (departureEvent == null) { log.warn("One arrival do not correspond to any departure for agent " + arrivalEvent.getPersonId()); return; } else if (!mode.equals(departureEvent.getLegMode())) { log.warn("Departure and arrival have uncompatible modes!"); return; } // consistency check... DONE if (this.frequencies.containsKey(mode)) { frequency = this.frequencies.get(mode); rawDataElement = this.rawData.get(mode); } else { frequency = new Frequency(); rawDataElement = new ResizableDoubleArray(); this.frequencies.put(mode, frequency); this.rawData.put(mode, rawDataElement); } double xyVal = 0.0; if (this.xy.equals("times")) { xyVal = this.computeTimes(arrivalEvent, departureEvent); } else { xyVal = this.computeDistances(arrivalEvent, departureEvent); } // remember data frequency.addValue(xyVal); rawDataElement.addElement(xyVal); }
From source file:playground.meisterk.org.matsim.analysis.CalcLegTimesKTI.java
@Override public void handleEvent(PersonArrivalEvent event) { Double depTime = this.agentDepartures.remove(event.getPersonId()); Person agent = this.population.getPersons().get(event.getPersonId()); if (depTime != null && agent != null) { double travelTime = event.getTime() - depTime; String mode = event.getLegMode(); Frequency frequency = null;// w ww. j a va 2 s . co m ResizableDoubleArray rawData = null; if (!this.frequencies.containsKey(mode)) { frequency = new Frequency(); this.frequencies.put(mode, frequency); rawData = new ResizableDoubleArray(); this.rawData.put(mode, rawData); } else { frequency = this.frequencies.get(mode); rawData = this.rawData.get(mode); } frequency.addValue(travelTime); rawData.addElement(travelTime); } }
From source file:playground.meisterk.org.matsim.population.algorithms.PopulationLegDistanceDistribution.java
@Override public void run(Plan plan) { for (PlanElement pe : plan.getPlanElements()) { if (pe instanceof Leg) { Leg leg = (Leg) pe;//w ww . ja v a 2 s . c o m String mode = leg.getMode(); Frequency frequency = null; ResizableDoubleArray rawData = null; if (!this.frequencies.containsKey(mode)) { frequency = new Frequency(); this.frequencies.put(mode, frequency); rawData = new ResizableDoubleArray(); this.rawData.put(mode, rawData); } else { frequency = this.frequencies.get(mode); rawData = this.rawData.get(mode); } frequency.addValue(leg.getRoute().getDistance()); rawData.addElement(leg.getRoute().getDistance()); } } }