| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
package dr.oldevomodel.substmodel; |
| 27 |
|
| 28 |
import dr.inferencexml.distribution.MultivariateOUModel; |
| 29 |
import dr.xml.*; |
| 30 |
import dr.inference.model.Statistic; |
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
public class MarginalVarianceStatistic extends Statistic.Abstract { |
| 36 |
|
| 37 |
public static final String VARIANCE_STATISTIC = "marginalVariance"; |
| 38 |
|
| 39 |
public MarginalVarianceStatistic(MultivariateOUModel mvou) { |
| 40 |
this.mvou = mvou; |
| 41 |
} |
| 42 |
|
| 43 |
public int getDimension() { |
| 44 |
return mvou.getDimension(); |
| 45 |
} |
| 46 |
|
| 47 |
public double getStatisticValue(int dim) { |
| 48 |
return mvou.getStatisticValue(dim); |
| 49 |
} |
| 50 |
|
| 51 |
public static XMLObjectParser PARSER = new AbstractXMLObjectParser() { |
| 52 |
|
| 53 |
public String getParserName() { |
| 54 |
return VARIANCE_STATISTIC; |
| 55 |
} |
| 56 |
|
| 57 |
public Object parseXMLObject(XMLObject xo) throws XMLParseException { |
| 58 |
|
| 59 |
MultivariateOUModel mvou = (MultivariateOUModel) xo.getChild(MultivariateOUModel.class); |
| 60 |
return new MarginalVarianceStatistic(mvou); |
| 61 |
|
| 62 |
} |
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
public String getParserDescription() { |
| 69 |
return "This element returns a statistic that is the matrix inverse of the child statistic."; |
| 70 |
} |
| 71 |
|
| 72 |
public Class getReturnType() { |
| 73 |
return MarginalVarianceStatistic.class; |
| 74 |
} |
| 75 |
|
| 76 |
public XMLSyntaxRule[] getSyntaxRules() { |
| 77 |
return rules; |
| 78 |
} |
| 79 |
|
| 80 |
private XMLSyntaxRule[] rules = new XMLSyntaxRule[]{ |
| 81 |
new ElementRule(MultivariateOUModel.class) |
| 82 |
}; |
| 83 |
}; |
| 84 |
|
| 85 |
private MultivariateOUModel mvou; |
| 86 |
} |