DfmEM implements IDfmInitializer, IDfmEstimator { void initCalc(DynamicFactorModel dfm0, TsInformationSet data) { this.dfm = dfm0; this.data = data; nobs = data.getCurrentDomain().getLength(); L = new Likelihood(); oldL = null; conv = false; maxiter = 30; eps = 1e-6; nf_ = dfm.getFactorsCount(); nb_ = nf_; r = new int[nb_]; for (int i = 0; i < nb_; i++) { r[i] = 1; } c_ = dfm.getBlockLength(); nlags = dfm.getTransition().nlags; LoadingsMarianoMurasawa(); LoadingsCumSum(); UniqueTypes(); dfmproc = new DfmProcessor(); dfmproc.setCalcVariance(true); N = data.getSeriesCount(); y = data.generateMatrix(data.getCurrentDomain()); data_m = y.clone(); double[] data_ = y.internalStorage(); for (int ii = 0; ii < data_.length; ii++) { if (Double.isNaN(data_[ii])) { data_[ii] = 0.0; } } }  @Override boolean initialize(DynamicFactorModel dfm0, TsInformationSet data); @Override boolean estimate(DynamicFactorModel dfm0, TsInformationSet data); @Override Matrix getHessian(); @Override DataBlock getGradient(); int getMaxiter(); void setMaxIter(int maxiter); double getEps(); void setEps(double eps); boolean isConv(); int getIter();  }
@Test public void testinitCalc() { DynamicFactorModel dmodelc = dmodel.clone(); dmodelc.normalize();dmodelc.setInitialization(VarSpec.Initialization.Zero); PcInitializer initializer = new PcInitializer(); em = new DfmEM(); em.estimate(dmodelc,dfmdata); }