Class DagScorer

java.lang.Object
edu.cmu.tetrad.sem.DagScorer
All Implemented Interfaces:
Scorer, TetradSerializable, Serializable

public final class DagScorer extends Object implements TetradSerializable, Scorer
Estimates a SemIm given a CovarianceMatrix and a SemPm. (A DataSet may be substituted for the CovarianceMatrix.) Uses regression to do the estimation, so this is only for DAG models. But the DAG model may be reset on the fly and the estimation redone. Variables whose parents have not changed will not be reestimated. Intended to speed up estimation for algorithm that require repeated estimation of DAG models over the same variables. Assumes all variables are measured.
Author:
josephramsey
See Also:
  • Constructor Details

    • DagScorer

      public DagScorer(DataSet dataSet)
      Constructs a new SemEstimator that uses the specified optimizer.
      Parameters:
      dataSet - a DataSet, all of whose variables are contained in the given SemPm. (They are identified by name.)
    • DagScorer

      public DagScorer(ICovarianceMatrix covMatrix)
      Constructs a new SemEstimator that uses the specified optimizer.
      Parameters:
      covMatrix - a covariance matrix, all of whose variables are contained in the given SemPm. (They are identified by name.)
  • Method Details

    • serializableInstance

      public static Scorer serializableInstance()
      Generates a simple exemplar of this class to test serialization.
    • score

      public double score(Graph dag)
      Runs the estimator on the data and SemPm passed in through the constructor. Returns the fml score of the resulting model.
      Specified by:
      score in interface Scorer
    • getCovMatrix

      public ICovarianceMatrix getCovMatrix()
      Specified by:
      getCovMatrix in interface Scorer
    • toString

      public String toString()
      Specified by:
      toString in interface Scorer
      Overrides:
      toString in class Object
      Returns:
      a string representation of the Sem.
    • getFml

      public double getFml()
      The value of the maximum likelihood function for the getModel the model (Bollen 107). To optimize, this should be minimized.
      Specified by:
      getFml in interface Scorer
    • getBicScore

      public double getBicScore()
      Specified by:
      getBicScore in interface Scorer
      Returns:
      BIC score, calculated as chisq - dof. This is equal to getFullBicScore() up to a constant.
    • getChiSquare

      public double getChiSquare()
      Specified by:
      getChiSquare in interface Scorer
      Returns:
      the chi square value for the model.
    • getPValue

      public double getPValue()
      Specified by:
      getPValue in interface Scorer
      Returns:
      the p-value for the model.
    • getDataSet

      public DataSet getDataSet()
      Specified by:
      getDataSet in interface Scorer
    • getNumFreeParams

      public int getNumFreeParams()
      Specified by:
      getNumFreeParams in interface Scorer
    • getDof

      public int getDof()
      Specified by:
      getDof in interface Scorer
    • getSampleSize

      public int getSampleSize()
      Specified by:
      getSampleSize in interface Scorer
    • getMeasuredNodes

      public List<Node> getMeasuredNodes()
      Specified by:
      getMeasuredNodes in interface Scorer
    • getSampleCovar

      public Matrix getSampleCovar()
      Specified by:
      getSampleCovar in interface Scorer
    • getEdgeCoef

      public Matrix getEdgeCoef()
      Specified by:
      getEdgeCoef in interface Scorer
    • getErrorCovar

      public Matrix getErrorCovar()
      Specified by:
      getErrorCovar in interface Scorer
    • getVariables

      public List<Node> getVariables()
      Specified by:
      getVariables in interface Scorer
    • getEstSem

      public SemIm getEstSem()
      Specified by:
      getEstSem in interface Scorer