Exemplo n.º 1
0
  private void resetSemImEditor() {
    java.util.List<SemEstimator> semEstimators = wrapper.getMultipleResultList();

    if (semEstimators.size() == 1) {
      SemEstimator estimatedSem = semEstimators.get(0);
      SemImEditor editor = new SemImEditor(new SemImWrapper(estimatedSem.getEstimatedSem()));
      panel.removeAll();
      panel.add(editor, BorderLayout.CENTER);
      panel.revalidate();
      panel.repaint();

    } else {
      JTabbedPane tabs = new JTabbedPane();

      for (int i = 0; i < semEstimators.size(); i++) {
        SemEstimator estimatedSem = semEstimators.get(i);
        SemImEditor editor = new SemImEditor(new SemImWrapper(estimatedSem.getEstimatedSem()));
        JPanel _panel = new JPanel();
        _panel.setLayout(new BorderLayout());
        _panel.add(editor, BorderLayout.CENTER);
        tabs.addTab(estimatedSem.getDataSet().getName(), _panel);
      }

      panel.removeAll();
      panel.add(tabs);
      panel.validate();
    }
  }
Exemplo n.º 2
0
  private String compileReport() {
    StringBuilder builder = new StringBuilder();

    builder.append("Datset\tFrom\tTo\tType\tValue\tSE\tT\tP");

    java.util.List<SemEstimator> estimators = wrapper.getMultipleResultList();

    for (int i = 0; i < estimators.size(); i++) {
      SemEstimator estimator = estimators.get(i);

      SemIm estSem = estimator.getEstimatedSem();
      String dataName = estimator.getDataSet().getName();

      for (Parameter parameter : estSem.getFreeParameters()) {
        builder.append("\n");
        builder.append(dataName + "\t");
        builder.append(parameter.getNodeA() + "\t");
        builder.append(parameter.getNodeB() + "\t");
        builder.append(typeString(parameter) + "\t");
        builder.append(asString(paramValue(estSem, parameter)) + "\t");
        /*
         Maximum number of free parameters for which statistics will be
         calculated. (Calculating standard errors is high complexity.) Set this to
         zero to turn  off statistics calculations (which can be problematic
         sometimes).
        */
        int maxFreeParamsForStatistics = 200;
        builder.append(
            asString(estSem.getStandardError(parameter, maxFreeParamsForStatistics)) + "\t");
        builder.append(asString(estSem.getTValue(parameter, maxFreeParamsForStatistics)) + "\t");
        builder.append(asString(estSem.getPValue(parameter, maxFreeParamsForStatistics)) + "\t");
      }

      List<Node> nodes = estSem.getVariableNodes();

      for (int j = 0; j < nodes.size(); j++) {
        Node node = nodes.get(j);

        int n = estSem.getSampleSize();
        int df = n - 1;
        double mean = estSem.getMean(node);
        double stdDev = estSem.getMeanStdDev(node);
        double stdErr = stdDev / Math.sqrt(n);

        double tValue = mean / stdErr;
        double p = 2.0 * (1.0 - ProbUtils.tCdf(Math.abs(tValue), df));

        builder.append("\n");
        builder.append(dataName + "\t");
        builder.append(nodes.get(j) + "\t");
        builder.append(nodes.get(j) + "\t");
        builder.append("Mean" + "\t");
        builder.append(asString(mean) + "\t");
        builder.append(asString(stdErr) + "\t");
        builder.append(asString(tValue) + "\t");
        builder.append(asString(p) + "\t");
      }
    }

    return builder.toString();
  }