<?xml version="1.0" standalone="yes"?>
<beast>
	
	<taxa id="taxa">
		<taxon id="A">
			<attr name="X">10 1 10 1</attr>
		</taxon>
		<taxon id="B">
			<attr name="X">2 2 2 2</attr>
		</taxon>
		<taxon id="C">
			<attr name="X">3 3 3 30</attr>
		</taxon>
	</taxa>
			
	<newick id="tree">
		((A:1,B:1):1,C:2);
<!--		(A:1,B:1); -->
	</newick>
	
	<treeModel id="treeModel">
		<newick idref="tree"/>
		<rootHeight>
			<parameter id="treeModel.rootHeight"/>
		</rootHeight>
		<nodeHeights internalNodes="true">
			<parameter id="treeModel.internalNodeHeights"/>
		</nodeHeights>
		<nodeHeights internalNodes="true" rootNode="true">
			<parameter id="treeModel.allInternalNodeHeights"/>
		</nodeHeights>
		<nodeTraits name="X" rootNode="false" internalNodes="false" leafNodes="true" traitDimension="4">
			<parameter id="leafTraits"/>
		</nodeTraits>
	</treeModel>
<!--
    <multivariateNormalPrior id="rootPrior">
        <meanParameter>
            <parameter value="0.0"/>
        </meanParameter>
        <precisionParameter>
            <matrixParameter>
                <parameter value="0.001"/>
            </matrixParameter>
        </precisionParameter>
    </multivariateNormalPrior>
-->
	<multivariateNormalPrior id="rootPrior">
	   <meanParameter>
		 <parameter value="0.0 0.0"/>
		   </meanParameter>
	   	<precisionParameter>
	 		<matrixParameter>
	   			<parameter value="0.001 0.0"/>
	   			<parameter value="0.0 0.001"/>
	 		</matrixParameter>
	   	</precisionParameter>
	</multivariateNormalPrior>
            
    <multivariateDiffusionModel id="diffusionModel">
		<precisionMatrix>
<!--		
			<matrixParameter id="precisionMatrix">
				<parameter id="prec.col1" value="2.0"/>
			</matrixParameter>
-->
			<matrixParameter id="precisionMatrix">
				<parameter id="col1" value="2.00 0.50"/>
				<parameter id="col2" value="0.50 1.00"/>
			</matrixParameter>

		</precisionMatrix>
	</multivariateDiffusionModel>
	
	<multivariateTraitLikelihood id="traitLikelihood" traitName="X" integrateInternalTraits="true">
		<multivariateDiffusionModel idref="diffusionModel"/>
		<treeModel idref="treeModel"/>
		<traitParameter>
			<parameter idref="leafTraits"/>
		</traitParameter>
		<multivariateNormalPrior idref="rootPrior"/>
	</multivariateTraitLikelihood>
		
	<operators id="operators">
        <dirtyLikelihood weight="1">
            <treeLikelihood idref="traitLikelihood"/>
        </dirtyLikelihood>
	</operators>
	
	<report>
		logL = <multivariateTraitLikelihood idref="traitLikelihood"/>
	</report>

	<mcmc id="mcmc" chainLength="10">
		<posterior id="posterior">
			<treeLikelihood idref="traitLikelihood"/>
		</posterior>
		<operators idref="operators"/>
		<log logEvery="1000">
			<posterior idref="posterior"/>
		</log>
		<logTree logEvery="1" nexusFormat="true" fileName="testIntegratedTraitLikelihood.trees">
			<multivariateTraitLikelihood idref="traitLikelihood"/>
			<treeModel idref="treeModel"/>
		</logTree>				
	</mcmc>

</beast>

<!--
# R script
library(mvtnorm)
 
-->

