// private static String get_constrained(Tgm tgm) { // Dat dat = tgm.getDat(); // KinparPanelModel kinparPanelModel = dat.getKinparPanel(); // String constrained = "constrained = list("; // double cc; // int count=0; // for (int i = 0; i < kinparPanelModel.getKinpar().size(); i++) { // if(kinparPanelModel.getKinpar().get(i).isConstrained()){ // if(kinparPanelModel.getKinpar().get(i).getMin() != null) { // if(count > 0) // constrained = constrained + ","; // cc = kinparPanelModel.getKinpar().get(i).getMin(); // constrained = constrained + "list(what=\"kinpar\", ind = "+ // Integer.toString(i+1) +", low=" + cc + ")"; // count++; // } // else if(kinparPanelModel.getKinpar().get(i).getMax() != null) { // if(count > 0) // constrained = constrained + ","; // cc = kinparPanelModel.getKinpar().get(i).getMax(); // constrained = constrained + "list(what=\"kinpar\", ind = "+ // Integer.toString(i+1) +", high=" + cc + ")"; // count++; // } // } // } // constrained = constrained + ")"; // // need to fill in other parameters here, once we have panels for them // return constrained; // } private static String get_seqmod(Tgm tgm) { KinparPanelModel kinparPanelModel = tgm.getDat().getKinparPanel(); if (kinparPanelModel.isSeqmod()) { return "seqmod = TRUE"; } else { return "seqmod = FALSE"; } }
public static String get_kinpar(Tgm tgm) { KinparPanelModel kinparPanelModel = tgm.getDat().getKinparPanel(); String kinpar = null; int size = kinparPanelModel.getKinpar().size(); if (size > 0) { kinpar = "kinpar = c("; double k; for (int i = 0; i < size; i++) { if (i > 0) { kinpar = kinpar + ","; } k = kinparPanelModel.getKinpar().get(i).getStart(); kinpar = kinpar + Double.toString(k); } kinpar = kinpar + ")"; } return kinpar; }
private static String get_positivepar(Tgm tgm) { KinparPanelModel kinparPanelModel = tgm.getDat().getKinparPanel(); int count = 0; String positivepar = null; if (kinparPanelModel.isPositivepar()) { count++; positivepar = "positivepar = c(\"kinpar\""; } // need to fill in other parameters here, once we have panels for them // if(count>0) // positivepar = positivepar + ","; if (count < 1) { positivepar = "positivepar=vector()"; } else { positivepar = positivepar + ")"; } return positivepar; }
private static String get_fixed(Tgm tgm) { String fixedStr = null; KinparPanelModel kinparPanelModel = tgm.getDat().getKinparPanel(); int count = 0; for (int i = 0; i < kinparPanelModel.getKinpar().size(); i++) { if (kinparPanelModel.getKinpar().get(i).isFixed()) { if (count > 0) { fixedStr = fixedStr + ","; } else { fixedStr = "fixed = list(kinpar=c("; } fixedStr = fixedStr + String.valueOf(i + 1); count++; } } if (count > 0) { fixedStr = fixedStr + ")"; } count = 0; KMatrixPanelModel kmatPanel = tgm.getDat().getKMatrixPanel(); for (int i = 0; i < kmatPanel.getKinScal().size(); i++) { if (kmatPanel.getKinScal().get(i).isFixed()) { if (count > 0) { fixedStr = fixedStr + ","; } else { if (fixedStr != null) { fixedStr = fixedStr + ", kinscal=c("; } else { fixedStr = "fixed = list(kinscal=c("; } } fixedStr = fixedStr + String.valueOf(i + 1); count++; } } if (count > 0) { fixedStr = fixedStr + ")"; } count = 0; IrfparPanelModel irfPanel = tgm.getDat().getIrfparPanel(); for (int i = 0; i < irfPanel.getFixed().size(); i++) { if (irfPanel.getFixed().get(i)) { if (count > 0) { fixedStr = fixedStr + ","; } else { if (fixedStr != null) { fixedStr = fixedStr + ", irfpar=c("; } else { fixedStr = "fixed = list(irfpar=c("; } } fixedStr = fixedStr + String.valueOf(i + 1); count++; } } if (count > 0) { fixedStr = fixedStr + ")"; } if (irfPanel.getParmu() != null) { if (irfPanel.isParmufixed() != null && irfPanel.isParmufixed()) { if (fixedStr != null) { fixedStr = fixedStr + ", parmu=c("; } else { fixedStr = "fixed = list(parmu=c("; } String[] doubles = irfPanel.getParmu().split(","); fixedStr = fixedStr + "1:" + String.valueOf(doubles.length); fixedStr = fixedStr + ")"; } } if (irfPanel.getPartau() != null) { if (irfPanel.isPartaufixed()) { if (fixedStr != null) { fixedStr = fixedStr + ", partau=c("; } else { fixedStr = "fixed = list(partau=c("; } String[] doubles = irfPanel.getPartau().split(","); fixedStr = fixedStr + "1:" + String.valueOf(doubles.length); fixedStr = fixedStr + ")"; } } count = 0; for (int i = 0; i < tgm.getDat().getCohspecPanel().getCohspec().getFixed().size(); i++) { if (tgm.getDat().getCohspecPanel().getCohspec().getFixed().get(i)) { if (count > 0) { fixedStr = fixedStr + ","; } else { if (fixedStr != null) { fixedStr = fixedStr + ", coh=c("; } else { fixedStr = "fixed = list(coh=c("; } } fixedStr = fixedStr + String.valueOf(i + 1); count++; } } if (count > 0) { fixedStr = fixedStr + ")"; } if (tgm.getDat().getOscspecPanel() != null) { if (tgm.getDat().getOscspecPanel().getOscspec() != null) { count = 0; for (int i = 0; i < tgm.getDat().getOscspecPanel().getOscspec().getFixed().size(); i++) { if (tgm.getDat().getOscspecPanel().getOscspec().getFixed().get(i)) { if (count > 0) { fixedStr = fixedStr + ","; } else { if (fixedStr != null) { fixedStr = fixedStr + ", oscpar=c("; } else { fixedStr = "fixed = list(oscpar=c("; } } fixedStr = fixedStr + String.valueOf(i + 1); count++; } } if (count > 0) { fixedStr = fixedStr + ")"; } } } count = 0; KMatrixPanelModel kMatrix = tgm.getDat().getKMatrixPanel(); for (int i = 0; i < kMatrix.getJVector().getFixed().size(); i++) { if (kMatrix.getJVector().getFixed().get(i)) { if (count > 0) { fixedStr = fixedStr + ","; } else { if (fixedStr != null) { fixedStr = fixedStr + ", jvec=c("; } else { fixedStr = "fixed = list(jvec=c("; } } fixedStr = fixedStr + String.valueOf(i + 1); count++; } } if (count > 0) { fixedStr = fixedStr + ")"; } // TODO: add additional paramters for fixed here: // This closes the "fixed" argument if (fixedStr != null) { if (addToFixed != null) { fixedStr = fixedStr + "," + addToFixed + ")"; } else { fixedStr = fixedStr + ")"; } } else { if (addToFixed != null) { fixedStr = "fixed = list(" + addToFixed + ")"; } } return fixedStr; }