diff --git a/_TauChanges.txt b/_TauChanges.txt index 8913e81..ea94a78 100644 --- a/_TauChanges.txt +++ b/_TauChanges.txt @@ -279,9 +279,20 @@ summary : Now possible to change ptable in GUI suppress-view above released up to version 4.1.14_BETA -------------------------------------------------------------- date : June 14, 2019 -summary : Information loss measures added for CKM protecetd tables +summary : Information loss measures added for CKM protected tables above released up to version 4.1.15_BETA -------------------------------------------------------------- date : June 19, 2019 -summary : Fixed bug that using request rule in batch mode did not detect use of holdings \ No newline at end of file +summary : Fixed bug that using request rule in batch mode did not detect use of holdings + +date : July 4, 2019 +summary : Some refactoring + +date : July 15, 2019 +summary : Fixed bug that shadow variabel and record key could not be first variable in microdata + Added Information Loss over non-empty cells to report file + Added Graphics of ECDF to report file + +above released up to version 4.1.16_BETA +-------------------------------------------------------------- diff --git a/src/tauargus/gui/ShowECDFGraph.form b/src/tauargus/gui/ShowECDFGraph.form index 729511e..6d7c5bb 100644 --- a/src/tauargus/gui/ShowECDFGraph.form +++ b/src/tauargus/gui/ShowECDFGraph.form @@ -3,9 +3,6 @@
- - - diff --git a/src/tauargus/model/Application.java b/src/tauargus/model/Application.java index e54934d..09c35c3 100644 --- a/src/tauargus/model/Application.java +++ b/src/tauargus/model/Application.java @@ -45,7 +45,7 @@ public class Application { // Version info public static final int MAJOR = 4; public static final int MINOR = 1; - public static final String REVISION = "15_BETA"; + public static final String REVISION = "16_BETA"; public static final int BUILD = 1; // Error codes returned by functions in TauArgusJava dll diff --git a/src/tauargus/model/CKMInfoLoss.java b/src/tauargus/model/CKMInfoLoss.java index d38cf95..033adbd 100644 --- a/src/tauargus/model/CKMInfoLoss.java +++ b/src/tauargus/model/CKMInfoLoss.java @@ -33,11 +33,15 @@ public class CKMInfoLoss{ private int false_zeros; private int false_nonzeros; private int numberofcells; + private int numberofempty; private void Initiate(TreeMap SDMap){ SDMap.put("AD", 0.0); SDMap.put("RAD", 0.0); SDMap.put("DR", 0.0); + SDMap.put("ADnonempty",0.0); + SDMap.put("RADnonempty",0.0); + SDMap.put("DRnonempty",0.0); } public CKMInfoLoss(){ @@ -72,6 +76,14 @@ public void SetNumberOfCells(int n){ public int GetNumberOfCells(){ return this.numberofcells; } + + public void SetNumberOfEmpty(int n){ + this.numberofempty = n; + } + + public int GetNumberOfEmpty(){ + return this.numberofempty; + } public void SetECDFcounts(String Name, ECDF ecdf){ this.ECDFcounts.put(Name, ecdf); diff --git a/src/tauargus/model/ECDFGraphBuilder.java b/src/tauargus/model/ECDFGraphBuilder.java index b0363a4..307824c 100644 --- a/src/tauargus/model/ECDFGraphBuilder.java +++ b/src/tauargus/model/ECDFGraphBuilder.java @@ -37,7 +37,7 @@ public class ECDFGraphBuilder { int numberXsteps = 10; public ChartPanel CreateChart(String Name, double[] X, double increment){ - + JFreeChart chart = ChartFactory.createXYLineChart( "ECDF of " + Name, //chartTitle "", //xAxisLabel diff --git a/src/tauargus/model/SaveTable.java b/src/tauargus/model/SaveTable.java index 95c1414..9d055f6 100644 --- a/src/tauargus/model/SaveTable.java +++ b/src/tauargus/model/SaveTable.java @@ -22,16 +22,22 @@ import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; +import java.io.FileOutputStream; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; +import java.io.OutputStream; import java.text.DecimalFormat; import java.text.DecimalFormatSymbols; +import java.util.Arrays; import java.util.Date; import java.util.Locale; import java.util.concurrent.ExecutionException; import javax.swing.JOptionPane; import javax.swing.SwingWorker; +import org.jfree.chart.ChartPanel; +import org.jfree.chart.ChartUtilities; +import org.jfree.chart.JFreeChart; import tauargus.extern.dataengine.TauArgus; import static tauargus.model.TableSet.MAX_GH_MITER_RATIO; import tauargus.service.TableService; @@ -830,13 +836,13 @@ static public void writeReport(TableSet tableSet) { CellStatusStatistics stat = tableSet.getCellStatusStatistics(); out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - if (tableSet.holding){ out.write("\n");} - out.write("\n"); - out.write("\n"); + out.write("\n"); + out.write("\n"); + out.write("\n"); + out.write("\n"); + if (tableSet.holding){ out.write("\n");} + out.write("\n"); + out.write("\n"); out.write("\n"); // StatLabel (i) for (i=CellStatus.SAFE.getValue();i<=CellStatus.EMPTY.getValue()+1;i++){ @@ -863,106 +869,47 @@ static public void writeReport(TableSet tableSet) { } else{ out.write("
 StatusNumber of cellsNumber of respondentsNumber of holdings freq.Response valueCost value
 StatusNumber of cellsNumber of respondentsNumber of holdings freq.Response valueCost value
\n"); - //out.write("\n"); - //out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); + out.write(""); + out.write(""); + out.write(""); + out.write("\n"); Integer[] TreeMapKeys = tableSet.getCKMStats().keySet().toArray(new Integer[tableSet.getCKMStats().size()]); for (i=0;i"); - out.write("\n"); + out.write(""); + out.write(""); out.write("\n"); } out.write(""); - out.write("\n"); + out.write(""); + out.write(""); out.write("\n"); + + out.write(""); + out.write(""); + out.write(""); + out.write("\n"); + out.write(""); - out.write("\n"); + out.write(""); + out.write(""); out.write("\n"); + out.write("
Added noiseNumber of cells
Added noiseNumber of cellsPercentage of cells
Added noiseNumber of cellsRelative to non-empty cellsRelative to all cells
"+ Integer.toString(TreeMapKeys[i]) + ""+Long.toString(tableSet.getCKMStats().get(TreeMapKeys[i]))+""+Long.toString(tableSet.getCKMStats().get(TreeMapKeys[i]))+""+String.format("%7.3f",100.0*tableSet.getCKMStats().get(TreeMapKeys[i])/(tableSet.numberOfCells()-tableSet.numberOfEmpty()))+"%"+String.format("%7.3f",100.0*tableSet.getCKMStats().get(TreeMapKeys[i])/tableSet.numberOfCells())+"%
Empty "+Long.toString(tableSet.numberOfEmpty())+""+Long.toString(tableSet.numberOfEmpty())+" --"+String.format("%7.3f",100.0*tableSet.numberOfEmpty()/tableSet.numberOfCells())+"%
Non-Empty "+Long.toString(tableSet.numberOfCells()-tableSet.numberOfEmpty())+""+Long.toString(100)+"%"+String.format("%7.3f",100.0*(1.0 - 1.0*tableSet.numberOfEmpty()/tableSet.numberOfCells()))+"%
Total "+Long.toString(tableSet.numberOfCells())+""+Long.toString(tableSet.numberOfCells())+" --"+Long.toString(100)+"%

\n"); + + out.write("\n"); + out.write(""); + out.write("\n"); + out.write(""); + out.write("\n"); out.write("
False non-zero-cells (zero changed to non-zero)"+tableSet.GetCKMInfoLoss().GetFalseNonzeros()+"
False zero-cells (non-zero changed to zero)"+tableSet.GetCKMInfoLoss().GetFalseZeros()+"
\n"); out.write("

\n"); } if (tableSet.ckmProtect){ - out.write("

Additional information loss measures, calculated over all cells

\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("
ADAbsolute Difference|pert - orig|
RADRelative Absolute Difference|pert - orig|/orig
DRAbsolute Difference of square Roots|sqrt(pert) - sqrt(orig)|
\n"); - out.write("

\n"); - - CKMInfoLoss InfoLoss = tableSet.GetCKMInfoLoss(); - out.write("Descriptives
\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("
ADRADDR
Mean"+String.format("%7.5f",InfoLoss.GetMean("AD"))+""+String.format("%7.5f",InfoLoss.GetMean("RAD"))+""+String.format("%7.5f",InfoLoss.GetMean("DR"))+"
Median"+String.format("%7.5f",InfoLoss.GetMedian("AD"))+""+String.format("%7.5f",InfoLoss.GetMedian("RAD"))+""+String.format("%7.5f",InfoLoss.GetMedian("DR"))+"
Max"+String.format("%7.5f",InfoLoss.GetMaxs("AD"))+""+String.format("%7.5f",InfoLoss.GetMaxs("RAD"))+""+String.format("%7.5f",InfoLoss.GetMaxs("DR"))+"

\n"); - - out.write("Percentiles
\n"); - String[] Percents = {"P10","P20","P30","P40","P50","P60","P70","P80","P90","P95","P99"}; - out.write("\n"); - out.write("\n"); - for (i=0;i\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - } - out.write("
ADRADDR
"+Percents[i]+""+String.format("%7.5f",InfoLoss.GetPercentiles("AD")[i])+""+String.format("%7.5f",InfoLoss.GetPercentiles("RAD")[i])+""+String.format("%7.5f",InfoLoss.GetPercentiles("DR")[i])+"
\n"); - out.write("

\n"); - - out.write("Empirical Cumulative Distribution Functions (ECDF)
\n"); - out.write("Number and fraction of cells with Difference less than or equal to Value
\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - for (i=0;i\n"); - out.write("\n"); - out.write("\n"); - } - out.write(""); - out.write("\n"); - out.write("\n"); - out.write("
AD
ValueCountFraction (%)
"+String.format("%.2f",InfoLoss.GetECDFcounts("AD").getBreaks()[i])+""+String.format("%d",InfoLoss.GetECDFcounts("AD").getCounts()[i])+""+String.format("%.2f",100.0*((double)InfoLoss.GetECDFcounts("AD").getCounts()[i]/(double)InfoLoss.GetNumberOfCells()))+"
Inf"+String.format("%d",InfoLoss.GetNumberOfCells())+""+String.format("%.2f",100.0)+"

\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - for (i=0;i\n"); - out.write("\n"); - out.write("\n"); - } - out.write(""); - out.write("\n"); - out.write("\n"); - out.write("
RAD
ValueCountFraction (%)
"+String.format("%.2f",InfoLoss.GetECDFcounts("RAD").getBreaks()[i])+""+String.format("%d",InfoLoss.GetECDFcounts("RAD").getCounts()[i])+""+String.format("%.2f",100.0*((double)InfoLoss.GetECDFcounts("RAD").getCounts()[i]/(double)InfoLoss.GetNumberOfCells()))+"
Inf"+String.format("%d",InfoLoss.GetNumberOfCells())+""+String.format("%.2f",100.0)+"

\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - for (i=0;i\n"); - out.write("\n"); - out.write("\n"); - } - out.write(""); - out.write("\n"); - out.write("\n"); - out.write("
DR
ValueCountFraction (%)
"+String.format("%.2f",InfoLoss.GetECDFcounts("DR").getBreaks()[i])+""+String.format("%d",InfoLoss.GetECDFcounts("DR").getCounts()[i])+""+String.format("%.2f",100.0*((double)InfoLoss.GetECDFcounts("DR").getCounts()[i]/(double)InfoLoss.GetNumberOfCells()))+"
Inf"+String.format("%d",InfoLoss.GetNumberOfCells())+""+String.format("%.2f",100.0)+"
\n"); - out.write("

\n"); + // Print InformationLoss calculated over NON_EMPTY cells: UseEmpty = false + WriteAdditionalInfoLoss(out,tableSet.GetCKMInfoLoss(),reportfile,false); + // Print InformationLoss calculated over ALL cells: UseEmpty = true + WriteAdditionalInfoLoss(out,tableSet.GetCKMInfoLoss(),reportfile,true); } //If SuperCross Then GoTo EINDE @@ -1100,7 +1047,7 @@ static public void writeReport(TableSet tableSet) { out.write("\n"); out.write("Additional information loss measures, calculated over all cells\n"); + else out.write("

Additional information loss measures, calculated over non-empty cells

\n"); + + out.write("\n"); + out.write("\n"); + out.write("\n"); + out.write("\n"); + out.write("
ADAbsolute Difference|pert - orig|
RADRelative Absolute Difference|pert - orig|/orig
DRAbsolute Difference of square Roots|sqrt(pert) - sqrt(orig)|
\n"); + out.write("

\n"); + + out.write("Descriptives
\n"); + out.write("\n"); + out.write("\n"); + out.write("\n"); + out.write(""); + out.write(""); + out.write("\n"); + out.write("\n"); + out.write(""); + out.write(""); + out.write("\n"); + out.write("\n"); + out.write(""); + out.write(""); + out.write("\n"); + out.write("
ADRADDR
Mean"+String.format("%7.5f",InfoLoss.GetMean(AD))+""+String.format("%7.5f",InfoLoss.GetMean(RAD))+""+String.format("%7.5f",InfoLoss.GetMean(DR))+"
Median"+String.format("%7.5f",InfoLoss.GetMedian(AD))+""+String.format("%7.5f",InfoLoss.GetMedian(RAD))+""+String.format("%7.5f",InfoLoss.GetMedian(DR))+"
Max"+String.format("%7.5f",InfoLoss.GetMaxs(AD))+""+String.format("%7.5f",InfoLoss.GetMaxs(RAD))+""+String.format("%7.5f",InfoLoss.GetMaxs(DR))+"

\n"); + + out.write("Percentiles
\n"); + String[] Percents = {"P10","P20","P30","P40","P50","P60","P70","P80","P90","P95","P99"}; + out.write("\n"); + out.write("\n"); + for (i=0;i"); + out.write(""); + out.write(""); + out.write("\n"); + } + out.write("
ADRADDR
"+Percents[i]+""+String.format("%7.5f",InfoLoss.GetPercentiles(AD)[i])+""+String.format("%7.5f",InfoLoss.GetPercentiles(RAD)[i])+""+String.format("%7.5f",InfoLoss.GetPercentiles(DR)[i])+"
\n"); + out.write("

\n"); + + hs = report.substring(0, report.length()-5); + double step = UseEmpty ? 1.0/InfoLoss.GetNumberOfCells() : 1.0/(InfoLoss.GetNumberOfCells() - InfoLoss.GetNumberOfEmpty()); + + ECDFGraphBuilder builder = new ECDFGraphBuilder(); + ChartPanel cp = UseEmpty ? builder.CreateChart("AD", InfoLoss.GetDiffs("AD"), step) : + builder.CreateChart("AD", Arrays.copyOfRange(InfoLoss.GetDiffs("AD"),InfoLoss.GetNumberOfEmpty(),InfoLoss.GetDiffs("AD").length), step); + ChartUtilities.saveChartAsPNG(new File(hs+"_ECDF_"+AD+".png"), cp.getChart(), 600, 300); + + cp = UseEmpty ? builder.CreateChart("RAD", InfoLoss.GetDiffs("RAD"), step) : + builder.CreateChart("RAD", Arrays.copyOfRange(InfoLoss.GetDiffs("RAD"),InfoLoss.GetNumberOfEmpty(),InfoLoss.GetDiffs("AD").length), step); + ChartUtilities.saveChartAsPNG(new File(hs+"_ECDF_"+RAD+".png"),cp.getChart(), 600, 300); + + cp = UseEmpty ? builder.CreateChart("DR", InfoLoss.GetDiffs("DR"), step) : + builder.CreateChart("DR", Arrays.copyOfRange(InfoLoss.GetDiffs("DR"),InfoLoss.GetNumberOfEmpty(),InfoLoss.GetDiffs("AD").length), step); + ChartUtilities.saveChartAsPNG(new File(hs+"_ECDF_"+DR+".png"),cp.getChart(), 600, 300); + + hs = hs.substring(hs.lastIndexOf("\\")+1,hs.length()); + + out.write("Empirical Cumulative Distribution Functions (ECDF)
\n"); + out.write("Number and fraction of cells with Difference less than or equal to Value
\n"); + out.write("

\n
\n"); + out.write("\n"); + out.write("\n"); + out.write("\n"); + + totalcount = UseEmpty ? InfoLoss.GetNumberOfCells() : InfoLoss.GetNumberOfCells() - InfoLoss.GetNumberOfEmpty(); + + for (i=0;i"); + counts = UseEmpty ? InfoLoss.GetECDFcounts("AD").getCounts()[i] : InfoLoss.GetECDFcounts("AD").getCounts()[i] - InfoLoss.GetNumberOfEmpty(); + out.write(""); + out.write("\n"); + } + out.write(""); + out.write(""); + out.write("\n"); + out.write("
AD
ValueCountFraction (%)
"+String.format("%.2f",InfoLoss.GetECDFcounts("AD").getBreaks()[i])+""+String.format("%d", counts) + ""+String.format("%.2f",100.0*((double)counts/(double)totalcount))+"
Inf"+String.format("%d",totalcount)+""+String.format("%.2f",100.0)+"
\n"); + out.write("
\n"); + out.write("
\n"); + out.write("\n"); + out.write("


\n"); + + out.write("
\n
\n"); + out.write("\n"); + out.write("\n"); + out.write("\n"); + for (i=0;i"); + counts = UseEmpty ? InfoLoss.GetECDFcounts("RAD").getCounts()[i] : InfoLoss.GetECDFcounts("RAD").getCounts()[i] - InfoLoss.GetNumberOfEmpty(); + out.write(""); + out.write("\n"); + } + out.write(""); + out.write(""); + out.write("\n"); + out.write("
RAD
ValueCountFraction (%)
"+String.format("%.2f",InfoLoss.GetECDFcounts("RAD").getBreaks()[i])+""+String.format("%d",counts)+""+String.format("%.2f",100.0*((double)counts/(double)totalcount))+"
Inf"+String.format("%d",totalcount)+""+String.format("%.2f",100.0)+"
\n"); + out.write("
\n"); + out.write("
\n"); + out.write("\n"); + out.write("


\n"); + + out.write("
\n
\n"); + out.write("\n"); + out.write("\n"); + out.write("\n"); + for (i=0;i"); + counts = UseEmpty ? InfoLoss.GetECDFcounts("DR").getCounts()[i] : InfoLoss.GetECDFcounts("DR").getCounts()[i] - InfoLoss.GetNumberOfEmpty(); + out.write(""); + out.write("\n"); + } + out.write(""); + out.write(""); + out.write("\n"); + out.write("
DR
ValueCountFraction (%)
"+String.format("%.2f",InfoLoss.GetECDFcounts("DR").getBreaks()[i])+""+String.format("%d",counts)+""+String.format("%.2f",100.0*((double)counts/(double)totalcount))+"
Inf"+String.format("%d",totalcount)+""+String.format("%.2f",100.0)+"
\n"); + out.write("
\n"); + out.write("
\n"); + out.write("\n"); + out.write("


\n"); + out.write("

\n"); + } + catch(Exception ex){} + } + } \ No newline at end of file diff --git a/src/tauargus/model/TableSet.java b/src/tauargus/model/TableSet.java index 625525f..0f2dbc6 100644 --- a/src/tauargus/model/TableSet.java +++ b/src/tauargus/model/TableSet.java @@ -2431,7 +2431,7 @@ public void CalculateCKMInfo(){ // Calculates mean public void CalculateCKMInfoLoss(){ final double[] percs = new double[]{0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,0.95,0.99}; - final double[] RADbreaks = new double[]{0.0,0.02,0.05,0.1,0.2,0.3,0.4,0.5,1.0}; + final double[] RADDRbreaks = new double[]{0.0,0.02,0.05,0.1,0.2,0.3,0.4,0.5,1.0}; final double[] ADbreaks; int nFalseZeros = 0; int nFalseNonzeros = 0; @@ -2442,7 +2442,7 @@ public void CalculateCKMInfoLoss(){ double[] AD = new double[this.numberOfCells()]; double[] RAD = new double[this.numberOfCells()]; double[] DR = new double[this.numberOfCells()]; - + // including empty cells for (int i = 0; i < nExpVar; i++) { dimArray[i] = 0; @@ -2456,7 +2456,7 @@ public void CalculateCKMInfoLoss(){ if ((Math.abs(cell.response) <= EPSILON) && (Math.abs(cell.CKMValue) > EPSILON)) nFalseNonzeros++; AD[j] = Math.abs(cell.CKMValue - cell.response); - // If cell is empty, it is not perturbed by default + // If cell is empty, it is not perturbed by default in frequency count tables, using standard CKM if (cell.status==CellStatus.EMPTY) RAD[j] = 0; else { if (Math.abs(cell.response) <= EPSILON){ // original cell value is (close to) zero @@ -2477,12 +2477,18 @@ public void CalculateCKMInfoLoss(){ } this.InfoLoss.SetNumberOfCells(this.numberOfCells()); + this.InfoLoss.SetNumberOfEmpty((int) this.numberOfEmpty()); this.InfoLoss.SetFalseZeros(nFalseZeros); this.InfoLoss.SetFalseNonzeros(nFalseNonzeros); this.InfoLoss.SetMean("AD",DoubleStream.of(AD).average().getAsDouble()); this.InfoLoss.SetMean("RAD",DoubleStream.of(RAD).average().getAsDouble()); this.InfoLoss.SetMean("DR",DoubleStream.of(DR).average().getAsDouble()); + + double multiplier = ((double) this.numberOfCells())/(this.numberOfCells() - this.numberOfEmpty()); + this.InfoLoss.SetMean("ADnonempty",this.InfoLoss.GetMean("AD")*multiplier); + this.InfoLoss.SetMean("RADnonempty",this.InfoLoss.GetMean("RAD")*multiplier); + this.InfoLoss.SetMean("DRnonempty",this.InfoLoss.GetMean("DR")*multiplier); // Sort the values Arrays.sort(AD); @@ -2505,24 +2511,37 @@ public void CalculateCKMInfoLoss(){ } this.InfoLoss.SetECDFcounts("AD", ECDFcounts(AD,ADbreaks)); - this.InfoLoss.SetECDFcounts("RAD", ECDFcounts(RAD,RADbreaks)); - this.InfoLoss.SetECDFcounts("DR", ECDFcounts(DR,RADbreaks)); + this.InfoLoss.SetECDFcounts("RAD", ECDFcounts(RAD,RADDRbreaks)); + this.InfoLoss.SetECDFcounts("DR", ECDFcounts(DR,RADDRbreaks)); this.InfoLoss.SetMaxs("AD",AD[AD.length-1]); this.InfoLoss.SetMaxs("RAD",RAD[RAD.length-1]); this.InfoLoss.SetMaxs("DR",DR[DR.length-1]); + this.InfoLoss.SetMaxs("ADnonempty",AD[AD.length-1]); + this.InfoLoss.SetMaxs("RADnonempty",RAD[RAD.length-1]); + this.InfoLoss.SetMaxs("DRnonempty",DR[DR.length-1]); this.InfoLoss.SetMins("AD",AD[0]); this.InfoLoss.SetMins("RAD",RAD[0]); this.InfoLoss.SetMins("DR",DR[0]); + // First this.numberOfEmpty() values are zero because of empty cells + this.InfoLoss.SetMins("ADnonempty",AD[(int) this.numberOfEmpty()]); + this.InfoLoss.SetMins("RADnonempty",RAD[(int) this.numberOfEmpty()]); + this.InfoLoss.SetMins("DRnonempty",DR[(int) this.numberOfEmpty()]); this.InfoLoss.SetMedian("AD",percentiles(AD,0.5)[0]); this.InfoLoss.SetMedian("RAD",percentiles(RAD,0.5)[0]); this.InfoLoss.SetMedian("DR",percentiles(DR,0.5)[0]); - + this.InfoLoss.SetMedian("ADnonempty",percentiles(Arrays.copyOfRange(AD, (int) this.numberOfEmpty(), AD.length),0.5)[0]); + this.InfoLoss.SetMedian("RADnonempty",percentiles(Arrays.copyOfRange(RAD, (int) this.numberOfEmpty(), AD.length),0.5)[0]); + this.InfoLoss.SetMedian("DRnonempty",percentiles(Arrays.copyOfRange(DR, (int) this.numberOfEmpty(), AD.length),0.5)[0]); + this.InfoLoss.SetPercentiles("AD",percentiles(AD,percs)); this.InfoLoss.SetPercentiles("RAD",percentiles(RAD,percs)); this.InfoLoss.SetPercentiles("DR",percentiles(DR,percs)); + this.InfoLoss.SetPercentiles("ADnonempty",percentiles(Arrays.copyOfRange(AD, (int) this.numberOfEmpty(), AD.length),percs)); + this.InfoLoss.SetPercentiles("RADnonempty",percentiles(Arrays.copyOfRange(RAD, (int) this.numberOfEmpty(), AD.length),percs)); + this.InfoLoss.SetPercentiles("DRnonempty",percentiles(Arrays.copyOfRange(DR, (int) this.numberOfEmpty(), AD.length),percs)); } @@ -2552,6 +2571,7 @@ private double[] percentiles(double[] data, double... perc){ } // Returns number of cells <= threshold + // arr[] is sorted array of data // breaks is a vector of thresholds // Essentially this returns the Empirical Cumulative Distribution Function counts private ECDF ECDFcounts(double arr[], double... breaks){