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);
}
}
}
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");
}
}
}
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);
}
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");
}
}
}
Aggregations