Search in sources :

Example 1 with DesignMatrix

use of dr.inference.model.DesignMatrix in project beast-mcmc by beast-dev.

the class MultivariateOUModelParser method addIndependentParameters.

public void addIndependentParameters(XMLObject xo, GeneralizedLinearModel glm, Parameter dependentParam) throws XMLParseException {
    int totalCount = xo.getChildCount();
    for (int i = 0; i < totalCount; i++) {
        if (xo.getChildName(i).compareTo(GeneralizedLinearModelParser.INDEPENDENT_VARIABLES) == 0) {
            XMLObject cxo = (XMLObject) xo.getChild(i);
            Parameter independentParam = (Parameter) cxo.getChild(Parameter.class);
            DesignMatrix designMatrix = (DesignMatrix) cxo.getChild(DesignMatrix.class);
            checkDimensions(independentParam, dependentParam, designMatrix);
            glm.addIndependentParameter(independentParam, designMatrix, null);
        }
    }
}
Also used : Parameter(dr.inference.model.Parameter) MatrixParameter(dr.inference.model.MatrixParameter) DesignMatrix(dr.inference.model.DesignMatrix)

Example 2 with DesignMatrix

use of dr.inference.model.DesignMatrix in project beast-mcmc by beast-dev.

the class GeneralizedLinearModelParser method addIndependentParameters.

public void addIndependentParameters(XMLObject xo, GeneralizedLinearModel glm, Parameter dependentParam) throws XMLParseException {
    int totalCount = xo.getChildCount();
    for (int i = 0; i < totalCount; i++) {
        if (xo.getChildName(i).compareTo(INDEPENDENT_VARIABLES) == 0) {
            XMLObject cxo = (XMLObject) xo.getChild(i);
            Parameter independentParam = (Parameter) cxo.getChild(Parameter.class);
            DesignMatrix designMatrix = (DesignMatrix) cxo.getChild(DesignMatrix.class);
            checkDimensions(independentParam, dependentParam, designMatrix);
            cxo = cxo.getChild(INDICATOR);
            Parameter indicator = null;
            if (cxo != null) {
                indicator = (Parameter) cxo.getChild(Parameter.class);
                if (indicator.getDimension() != independentParam.getDimension())
                    throw new XMLParseException("dim(" + independentParam.getId() + ") != dim(" + indicator.getId() + ")");
            }
            //                System.err.println("A");
            if (checkFullRankOfMatrix) {
                checkFullRank(designMatrix);
            }
            //                System.err.println("B");
            //                System.err.println(new Matrix(designMatrix.getParameterAsMatrix()));
            //                System.exit(-1);
            glm.addIndependentParameter(independentParam, designMatrix, indicator);
        //                System.err.println("C");
        }
    }
}
Also used : Parameter(dr.inference.model.Parameter) DesignMatrix(dr.inference.model.DesignMatrix)

Example 3 with DesignMatrix

use of dr.inference.model.DesignMatrix in project beast-mcmc by beast-dev.

the class GMRFTestLikelihoodParser method parseXMLObject.

public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    XMLObject cxo = xo.getChild(GMRFSkyrideLikelihoodParser.POPULATION_PARAMETER);
    Parameter popParameter = (Parameter) cxo.getChild(Parameter.class);
    cxo = xo.getChild(GMRFSkyrideLikelihoodParser.PRECISION_PARAMETER);
    Parameter precParameter = (Parameter) cxo.getChild(Parameter.class);
    cxo = xo.getChild(INTERVAL_PARAMETER);
    Parameter intervalParameter = (Parameter) cxo.getChild(Parameter.class);
    cxo = xo.getChild(SUFFSTAT_PARAMETER);
    Parameter statParameter = (Parameter) cxo.getChild(Parameter.class);
    cxo = xo.getChild(GMRFSkyrideLikelihoodParser.LAMBDA_PARAMETER);
    Parameter lambda = (Parameter) cxo.getChild(Parameter.class);
    cxo = xo.getChild(GMRFSkyrideLikelihoodParser.BETA_PARAMETER);
    Parameter betaParameter = (Parameter) cxo.getChild(Parameter.class);
    DesignMatrix designMatrix = (DesignMatrix) xo.getChild(DesignMatrix.class);
    return new GMRFTestLikelihood(popParameter, precParameter, lambda, betaParameter, designMatrix, intervalParameter, statParameter);
}
Also used : Parameter(dr.inference.model.Parameter) DesignMatrix(dr.inference.model.DesignMatrix) GMRFTestLikelihood(dr.evomodel.coalescent.GMRFTestLikelihood)

Example 4 with DesignMatrix

use of dr.inference.model.DesignMatrix in project beast-mcmc by beast-dev.

the class GeneralizedLinearModelParser method addIndependentParameters.

public void addIndependentParameters(XMLObject xo, GeneralizedLinearModel glm, Parameter dependentParam) throws XMLParseException {
    int totalCount = xo.getChildCount();
    for (int i = 0; i < totalCount; i++) {
        if (xo.getChildName(i).compareTo(INDEPENDENT_VARIABLES) == 0) {
            XMLObject cxo = (XMLObject) xo.getChild(i);
            Parameter independentParam = (Parameter) cxo.getChild(Parameter.class);
            DesignMatrix designMatrix = (DesignMatrix) cxo.getChild(DesignMatrix.class);
            checkDimensions(independentParam, dependentParam, designMatrix);
            cxo = cxo.getChild(INDICATOR);
            Parameter indicator = null;
            if (cxo != null) {
                indicator = (Parameter) cxo.getChild(Parameter.class);
                if (indicator.getDimension() != independentParam.getDimension())
                    throw new XMLParseException("dim(" + independentParam.getId() + ") != dim(" + indicator.getId() + ")");
            }
            //                System.err.println("A");
            if (checkFullRankOfMatrix) {
                checkFullRank(designMatrix);
            }
            //                System.err.println("B");
            //                System.err.println(new Matrix(designMatrix.getParameterAsMatrix()));
            //                System.exit(-1);
            glm.addIndependentParameter(independentParam, designMatrix, indicator);
        //                System.err.println("C");
        }
    }
}
Also used : Parameter(dr.inference.model.Parameter) DesignMatrix(dr.inference.model.DesignMatrix)

Aggregations

DesignMatrix (dr.inference.model.DesignMatrix)4 Parameter (dr.inference.model.Parameter)4 GMRFTestLikelihood (dr.evomodel.coalescent.GMRFTestLikelihood)1 MatrixParameter (dr.inference.model.MatrixParameter)1