|
@@ -30,6 +30,8 @@ public class LinearRangeADLPctBnd extends PVModel {
|
|
|
private final PolynomialRegression pr2 = new PolynomialRegression(2);
|
|
private final PolynomialRegression pr2 = new PolynomialRegression(2);
|
|
|
private final PolynomialRegression pr3 = new PolynomialRegression(3);
|
|
private final PolynomialRegression pr3 = new PolynomialRegression(3);
|
|
|
private PolynomialRegression prBest;
|
|
private PolynomialRegression prBest;
|
|
|
|
|
+ private int n;
|
|
|
|
|
+ private String[][] checkTable;
|
|
|
|
|
|
|
|
public LinearRangeADLPctBnd(double[][] data, InspectionConfigVO configVO) {
|
|
public LinearRangeADLPctBnd(double[][] data, InspectionConfigVO configVO) {
|
|
|
super(data, configVO);
|
|
super(data, configVO);
|
|
@@ -42,7 +44,7 @@ public class LinearRangeADLPctBnd extends PVModel {
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public void calculate() {
|
|
public void calculate() {
|
|
|
- final int n = specimensNum * repeatNum;
|
|
|
|
|
|
|
+ n = specimensNum * repeatNum;
|
|
|
for (int i = 0; i < specimensNum; i++) {
|
|
for (int i = 0; i < specimensNum; i++) {
|
|
|
DescriptiveStatistics stat = new DescriptiveStatistics(data[i]);
|
|
DescriptiveStatistics stat = new DescriptiveStatistics(data[i]);
|
|
|
means[i] = stat.getMean();
|
|
means[i] = stat.getMean();
|
|
@@ -124,53 +126,39 @@ public class LinearRangeADLPctBnd extends PVModel {
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public String generateResult() {
|
|
public String generateResult() {
|
|
|
- return renderReportTemplate(this, "/report/linearRangeEP6A.ftl");
|
|
|
|
|
|
|
+ return renderReportTemplate(this, "/report/linearRangeADL.ftl");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public String[] tableNames() {
|
|
public String[] tableNames() {
|
|
|
- return new String[]{"表1: 重复性差异检测结果", "表2: 多项式回归分析结果", "表3: 线性偏离计算结果"};
|
|
|
|
|
|
|
+ return new String[]{ "表1: 多项式回归分析结果",
|
|
|
|
|
+ String.format("表2: 不精密度和ADL的临界值(PcrBnd=5%%,%s方程)",prBest.getPower()>2?"3阶":"1或2阶")};
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public String[] chartNames() {
|
|
public String[] chartNames() {
|
|
|
- return new String[]{"图1: 线性实验", "图2: 线性评价差值点图"};
|
|
|
|
|
|
|
+ return new String[]{"图1: 线性范围验证实验"};
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-// @Override
|
|
|
|
|
-// ChartDTO buildChart2DTO(int sheetIndex) {
|
|
|
|
|
-// ChartDTO chartDTO = new ChartDTO("linesForRange");
|
|
|
|
|
-// double[][] data = new double[targetValues.length][2];
|
|
|
|
|
-// for (int i = 0; i < data.length; i++) {
|
|
|
|
|
-// data[i] = new double[]{i + 1, diffs[1][i]};
|
|
|
|
|
-// }
|
|
|
|
|
-//// chartDTO.setData(data);
|
|
|
|
|
-// final HashMap<String, Object> config = new HashMap<>();
|
|
|
|
|
-// config.put("yAxisUp", 0.1);
|
|
|
|
|
-// config.put("yAxisLow", -0.1);
|
|
|
|
|
-// config.put("data", JSONObject.toJSONString(data, SerializerFeature.DisableCircularReferenceDetect));
|
|
|
|
|
-//
|
|
|
|
|
-// chartDTO.setOption(renderChartTemplate(config, 1, "/scatter/linesForRange.ftl"));
|
|
|
|
|
-// return chartDTO;
|
|
|
|
|
-// }
|
|
|
|
|
-
|
|
|
|
|
@Override
|
|
@Override
|
|
|
ChartDTO buildChart1DTO(int sheetIndex) {
|
|
ChartDTO buildChart1DTO(int sheetIndex) {
|
|
|
ChartDTO chartDTO = new ChartDTO("polynomialRegression");
|
|
ChartDTO chartDTO = new ChartDTO("polynomialRegression");
|
|
|
double[][] data = new double[targetValues.length][2];
|
|
double[][] data = new double[targetValues.length][2];
|
|
|
for (int i = 0; i < data.length; i++) {
|
|
for (int i = 0; i < data.length; i++) {
|
|
|
- data[i] = new double[]{targetValues[i], means[i]};
|
|
|
|
|
|
|
+ data[i] = new double[]{targetValues[i], format(means[i],getScale())};
|
|
|
}
|
|
}
|
|
|
// chartDTO.setData(data);
|
|
// chartDTO.setData(data);
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
map.put("data", JSONObject.toJSONString(data, SerializerFeature.DisableCircularReferenceDetect));
|
|
map.put("data", JSONObject.toJSONString(data, SerializerFeature.DisableCircularReferenceDetect));
|
|
|
-
|
|
|
|
|
|
|
+ map.put("power",prBest.getPower());
|
|
|
chartDTO.setOption(renderChartTemplate(map, 0, "/scatter/polynomialRegression.ftl"));
|
|
chartDTO.setOption(renderChartTemplate(map, 0, "/scatter/polynomialRegression.ftl"));
|
|
|
return chartDTO;
|
|
return chartDTO;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
- TableDTO buildTable2DTO(int sheetIndex) {
|
|
|
|
|
|
|
+
|
|
|
|
|
+ TableDTO buildTable1DTO(int sheetIndex) {
|
|
|
|
|
|
|
|
TableDTO table = new TableDTO();
|
|
TableDTO table = new TableDTO();
|
|
|
String[] header = {"阶别", "系数", "系数值", "系数标准误", "t 检验", "自由度", "回归标准误"};
|
|
String[] header = {"阶别", "系数", "系数值", "系数标准误", "t 检验", "自由度", "回归标准误"};
|
|
@@ -214,7 +202,7 @@ public class LinearRangeADLPctBnd extends PVModel {
|
|
|
return table;
|
|
return table;
|
|
|
}
|
|
}
|
|
|
@Override
|
|
@Override
|
|
|
- TableDTO buildTable3DTO(int sheetIndex) {
|
|
|
|
|
|
|
+ TableDTO buildTable2DTO(int sheetIndex) {
|
|
|
|
|
|
|
|
TableDTO table = new TableDTO();
|
|
TableDTO table = new TableDTO();
|
|
|
String[] header = {"不精密度百分比", "L×R=10", "L×R=12", "L×R=14", "L×R=16", "L×R=18","L×R=20"};
|
|
String[] header = {"不精密度百分比", "L×R=10", "L×R=12", "L×R=14", "L×R=16", "L×R=18","L×R=20"};
|
|
@@ -247,8 +235,8 @@ public class LinearRangeADLPctBnd extends PVModel {
|
|
|
{">9","P","P","P","P","P","P"}
|
|
{">9","P","P","P","P","P","P"}
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
-
|
|
|
|
|
- table.buildData(prBest == pr3?r3:r1);
|
|
|
|
|
|
|
+ checkTable = prBest == pr3?r3:r1;
|
|
|
|
|
+ table.buildData(checkTable);
|
|
|
final String note = new StringJoiner("<br />")
|
|
final String note = new StringJoiner("<br />")
|
|
|
.add("L: 样本数")
|
|
.add("L: 样本数")
|
|
|
.add("R: 重复测量的次数")
|
|
.add("R: 重复测量的次数")
|
|
@@ -280,4 +268,76 @@ public class LinearRangeADLPctBnd extends PVModel {
|
|
|
public void setCv(double cv) {
|
|
public void setCv(double cv) {
|
|
|
this.cv = cv;
|
|
this.cv = cv;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ public double getPctBnd() {
|
|
|
|
|
+ return pctBnd;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public void setPctBnd(double pctBnd) {
|
|
|
|
|
+ this.pctBnd = pctBnd;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public PolynomialRegression getPr1() {
|
|
|
|
|
+ return pr1;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public PolynomialRegression getPr2() {
|
|
|
|
|
+ return pr2;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public PolynomialRegression getPr3() {
|
|
|
|
|
+ return pr3;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public PolynomialRegression getPrBest() {
|
|
|
|
|
+ return prBest;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public void setPrBest(PolynomialRegression prBest) {
|
|
|
|
|
+ this.prBest = prBest;
|
|
|
|
|
+ }
|
|
|
|
|
+ public String getBestName(){
|
|
|
|
|
+ if(prBest.getPower() ==1){
|
|
|
|
|
+ return "一";
|
|
|
|
|
+ }else{
|
|
|
|
|
+ return prBest.getPower() == 2?"二":"三";
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public int getN() {
|
|
|
|
|
+ return n;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public int getCheckTableIndex(){
|
|
|
|
|
+ return n/2 - 4;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public String getRangeFormat(){
|
|
|
|
|
+ StringBuilder sb = new StringBuilder();
|
|
|
|
|
+ sb.append(String.format("最优拟合方程是%s阶方程,在L×R=%s和不精密度百分比=%s%%时,",getBestName(),n,format(cv)));
|
|
|
|
|
+
|
|
|
|
|
+ int up = (int)Math.floor(cv);
|
|
|
|
|
+ if(up>9){
|
|
|
|
|
+ return sb.toString() + "查表2临界值为P,表明测量数据的精密度不符合作线性评价的要求.";
|
|
|
|
|
+ }
|
|
|
|
|
+ String s1 = checkTable[up][getCheckTableIndex()];
|
|
|
|
|
+ String s2 = "0";
|
|
|
|
|
+
|
|
|
|
|
+ if (up > 0) {
|
|
|
|
|
+ s2 = checkTable[up - 1][getCheckTableIndex()];
|
|
|
|
|
+ }
|
|
|
|
|
+ String format = String.format("查表2临界值为%s%%~%s%%,", s2, s1);
|
|
|
|
|
+ if (format.contains("P")){
|
|
|
|
|
+ return sb.toString() + format + "包含标注字母P,表明测量数据的精密度不符合作线性评价的要求.";
|
|
|
|
|
+ } else{
|
|
|
|
|
+ sb.append(format).append("没有标注字母P,表明测量数据的精密度符合作线性评价的要求。");
|
|
|
|
|
+ if(adl <= Double.valueOf(s1)){
|
|
|
|
|
+ sb.append(String.format("ADL=%s%%,小于临界值%s%%~%s%%,表明数据组具有临床可接受的非线性或%s阶线性。",format(adl,getScale()),s2,s1,getBestName()));
|
|
|
|
|
+ }else{
|
|
|
|
|
+ sb.append(String.format("ADL=%s%%,大于临界值%s%%~%s%%,表明数据组具有临床不可接受的非线性。",format(adl,getScale()),s2,s1));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return sb.toString();
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|