use of edu.cmu.tetrad.sem.ScoreType in project tetrad by cmu-phil.
the class SemEstimatorWrapper method setParams.
private boolean setParams(SemPmWrapper semPmWrapper, DataModelList dataModel) {
for (DataModel model : dataModel) {
if (model instanceof DataSet) {
DataSet dataSet = (DataSet) model;
SemPm semPm = semPmWrapper.getSemPm();
this.semPm = semPm;
SemEstimator estimator = new SemEstimator(dataSet, semPm, getOptimizer());
estimator.setNumRestarts(getParams().getInt("numRestarts", 1));
estimator.setScoreType((ScoreType) getParams().get("scoreType", ScoreType.Fgls));
if (!degreesOfFreedomCheck(semPm)) {
return true;
}
estimator.estimate();
getMultipleResultList().add(estimator);
} else if (model instanceof ICovarianceMatrix) {
ICovarianceMatrix covMatrix = new CovarianceMatrix((ICovarianceMatrix) model);
SemPm semPm = semPmWrapper.getSemPm();
this.semPm = semPm;
SemEstimator estimator = new SemEstimator(covMatrix, semPm, getOptimizer());
estimator.setNumRestarts(getParams().getInt("numRestarts", 1));
estimator.setScoreType((ScoreType) getParams().get("scoreType", ScoreType.Fgls));
if (!degreesOfFreedomCheck(semPm)) {
return true;
}
estimator.estimate();
getMultipleResultList().add(estimator);
} else {
throw new IllegalArgumentException("Data must consist of continuous data sets or covariance matrices.");
}
}
return false;
}
Aggregations