<?xml version="1.0" standalone="yes"?>
<beast>

	<!-- <matrixParameter id="scaleMatrix">
			<parameter value="10.0 1.5"/>
			<parameter value="1.5 2.0"/>
		</matrixParameter>



		<multivariateInverseWishartPrior id="wishartPrior1" df="4">
			<scaleMatrix>
				<matrixParameter idref="scaleMatrix"/>
			</scaleMatrix>
			<data>
				<matrixParameter id="precisionMatrix1">
					<parameter id="col1a" value="5.0 1.5"/>
					<parameter id="col2a" value="1.5 2.0"/>
				</matrixParameter>
			</data>
		</multivariateInverseWishartPrior>

		 <multivariateWishartPrior id="wishartPrior2" df="5">
			<scaleMatrix>
				<matrixParameter idref="scaleMatrix"/>
			</scaleMatrix>
			<data>
				<matrixParameter id="precisionMatrix2">
					<parameter id="col1b" value="6.0 2.5"/>
					<parameter id="col2b" value="2.5 2.0"/>
				</matrixParameter>
			</data>
		</multivariateWishartPrior>

		 <report>
			<multivariateInverseWishartPrior idref="wishartPrior1"/>
		</report>

		 <report>
			<multivariateInverseWishartPrior idref="wishartPrior2"/>
		</report>
		-->

	<designMatrix id="fixedEffectsMatrix">
		<parameter id="fixedEffectsMatrix.col1" value="
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
1 0 0 1 0 0 1 0 0 1
0 0 1 0 0 1 0 0 1 0
0 1 0 0 1 0 0 1 0 0
1 0 0 1 0 0 1 0 0 1
0 0 1 0 0 1 0 0 1 0
0 1 0 0 1 0 0 1 0 0
		"/>
		<parameter id="fixedEffectsMatrix.col2" value="
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 1 0 0 1 0 0 1 0 0
1 0 0 1 0 0 1 0 0 1
0 0 1 0 0 1 0 0 1 0
0 1 0 0 1 0 0 1 0 0
1 0 0 1 0 0 1 0 0 1
0 0 1 0 0 1 0 0 1 0
		"/>
		<parameter id="fixedEffectsMatrix.col3" value="
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 1 0 0 1 0 0 1 0
0 1 0 0 1 0 0 1 0 0
1 0 0 1 0 0 1 0 0 1
0 0 1 0 0 1 0 0 1 0
0 1 0 0 1 0 0 1 0 0
1 0 0 1 0 0 1 0 0 1
		"/>
	</designMatrix>

	<parameter id="fixedEffects" value="0.0 0.0 0.0"/>

	<multivariateNormalPrior id="prior.FixedEffects">
		<data>
			<parameter idref="fixedEffects"/>
		</data>
		<meanParameter>
			<parameter id="prior.fixedEffects.mean" value="0.0 0.0 0.0"/>
		</meanParameter>
		<precisionParameter>
			<matrixParameter id="prior.fixedEffects.precision">
				<parameter value="0.1 0 0"/>
				<parameter value="0 0.1 0"/>
				<parameter value="0 0 0.1"/>
			</matrixParameter>
		</precisionParameter>
	</multivariateNormalPrior>


	<positiveDefiniteSubstitutionModel id="qModel">
		<!--<matrixParameter id="Qmat">
			<parameter id="Qmat.col1" value="2.0 1.0 1.0"/>
			<parameter id="Qmat.col2" value="1.0 4.0 1.0"/>
			<parameter id="Qmat.col3" value="1.0 1.0 6.0"/>
		</matrixParameter>-->
		<compoundSymmetricMatrix id="Qmat">
			<diagonal>
				<parameter id="Q.diagonals" value="2.0 4.0 6.0" lower="0.0 0.0 0.0" upper="5 5 5"/>
			</diagonal>
			<offDiagonal>
				<parameter id="Q.offDiagonal" value="1.0"/>
			</offDiagonal>
		</compoundSymmetricMatrix>
	</positiveDefiniteSubstitutionModel>

	<multivariateWishartPrior id="prior.Qmat" df="3">
		<scaleMatrix>
			<matrixParameter>
				<parameter id="prior.Qmat.col1" value="1.0 0.0 0.0"/>
				<parameter id="prior.Qmat.col2" value="0.0 1.0 0.0"/>
				<parameter id="prior.Qmat.col3" value="0.0 0.0 1.0"/>
			</matrixParameter>
		</scaleMatrix>
		<data>
			<matrixParameter idref="Qmat"/>
		</data>
	</multivariateWishartPrior>

	<multivariateOUModel id="mvouModel">
		<substitutionModel idref="qModel"/>
		<data>
			<parameter id="data" value="
0.2003283 -0.1175399 -0.495224 -0.2102773 0.1194638 -0.06719125 -0.1759015 0.7098305 -0.4355417 -1.076124 1.178101 -0.1063588 0.5328371 0.258446 -0.4414638 0.4516082 0.4845915 -0.8338309 -1.230826 0.7157578 0.9805654 -1.582288 1.294086 1.401776 0.1940804 1.020139 0.3759328 -0.963149 1.004965 0.5642855 -0.922206 -0.0970064 0.2771372 -0.98529 0.2179910 -0.1416855 0.01212259 -0.924791 -0.4746347 0.3961324 -0.6898264 -0.7140323 0.8799123 -1.971231 -0.949452 -1.178875 -1.096063 -0.8048229 0.03412168 -0.613917 -0.9765478 1.087868 -1.328147 -0.5755731 1.807235 -0.8676068 -0.1912559 0.5367609 -1.414306 -0.3383538
2.970961 2.621953 6.46875 2.703340 3.935462 6.665829 3.240751 5.305008 5.988042 2.42064 6.28651 4.593892 2.575597 6.672941 4.239897 2.056275 5.340821 4.655235 1.702005 5.40884 4.743191 1.014196 5.082191 3.717593 2.16164 4.99367 3.599617 2.387909 5.163668 4.430757 2.696826 3.972642 5.076568 2.313012 3.664622 6.144293 2.265891 3.476659 6.194965 0.4528822 4.064888 6.476549 1.503711 3.37797 6.83493 2.536737 2.505550 7.304961 1.316139 3.785238 7.087207 1.476052 4.478142 6.194507 1.442140 4.351125 6.236665 0.957082 4.185977 6.514518
"/>
		</data>
		<times>
			<parameter id="time" value="
			0  0  0  1  1  1  2  2  2  3  3  3  4  4  4
5  5  5  6  6  6  7  7  7  8  8  8  9  9  9  10  10  10  11
11  11  12  12  12  13  13  13  14  14  14  15  15  15  16  16
16  17  17  17  18  18  18  19  19  19  20  20  20  21  21  21
22  22  22  23  23  23  24  24  24  25  25  25  26  26  26  27
27  27  28  28  28  29  29  29  30  30  30  31  31  31  32  32
32  33  33  33  34  34  34  35  35  35  36  36  36  37  37  37
38  38  38  39  39  39 "/>
			<!-- 40  40  40  41  41  41  42  42  42  43
			43  43  44  44  44  45  45  45  46  46  46  47  47  47  48  48
			48  49  49  49  50  50  50  51  51  51  52  52  52  53  53  53
			54  54  54  55  55  55  56  56  56  57  57  57  58  58  58  59
			59  59  60  60  60  61  61  61  62  62  62  63  63  63  64  64
			64  65  65  65  66  66  66  67  67  67  68  68  68  69  69  69
			70  70  70  71  71  71  72  72  72  73  73  73  74  74  74  75
			75  75  76  76  76  77  77  77  78  78  78  79  79  79  80  80
			80  81  81  81  82  82  82  83  83  83  84  84  84  85  85  85
			86  86  86  87  87  87  88  88  88  89  89  89  90  90  90  91
			91  91  92  92  92  93  93  93  94  94  94  95  95  95  96  96
			96  97  97  97  98  98  98  99  99  99"/>  -->
			<!--			0.0 0.0 0.0 1.0 1.0 1.0 2.0 2.0 2.0"/> -->
		</times>
		<design>
			<parameter id="design" value="
			1  2  3  1  2  3  1  2  3  1  2  3  1  2  3  1  2
	3  1  2  3  1  2  3  1  2  3  1  2  3  1  2  3  1  2  3  1  2
	3  1  2  3  1  2  3  1  2  3  1  2  3  1  2  3  1  2  3  1  2
	3  1  2  3  1  2  3  1  2  3  1  2  3  1  2  3  1  2  3  1  2
	3  1  2  3  1  2  3  1  2  3  1  2  3  1  2  3  1  2  3  1  2
	3  1  2  3  1  2  3  1  2  3  1  2  3  1  2  3  1  2  3  "/>
			<!--1  2
				3  1  2  3  1  2  3  1  2  3  1  2  3  1  2  3  1  2  3  1  2
				3  1  2  3  1  2  3  1  2  3  1  2  3  1  2  3  1  2  3  1  2
				3  1  2  3  1  2  3  1  2  3  1  2  3  1  2  3  1  2  3  1  2
				3  1  2  3  1  2  3  1  2  3  1  2  3  1  2  3  1  2  3  1  2
				3  1  2  3  1  2  3  1  2  3  1  2  3  1  2  3  1  2  3  1  2
				3  1  2  3  1  2  3  1  2  3  1  2  3  1  2  3  1  2  3  1  2
				3  1  2  3  1  2  3  1  2  3  1  2  3  1  2  3  1  2  3  1  2
				3  1  2  3  1  2  3  1  2  3  1  2  3  1  2  3  1  2  3  1  2
				3  1  2  3  1  2  3  1  2  3"/> -->

			<!--		0.0 1.0 2.0 0.0 1.0 2.0 0.0 1.0 2.0"/> -->
		</design>
		<!--<matrixParameter id="gammaMatrix">
			<parameter id="gamma.col1" value="1.0 0.0 0.0"/>
			<parameter id="gamma.col2" value="0.0 1.0 0.0"/>
			<parameter id="gamma.col3" value="0.0 0.0 1.0"/>
		</matrixParameter> -->
		<diagonalMatrix id="gammaMatrix">
			<parameter id="gamma.diag" value="1.0 1.0 1.0" lower="0.0 0.0 0.0"/>
		</diagonalMatrix>
		<independentVariables>
			<parameter idref="fixedEffects"/>
			<designMatrix idref="fixedEffectsMatrix"/>
		</independentVariables>
	</multivariateOUModel>
	<!--
	<multivariateWishartPrior id="prior.Gamma" df="6">
		<scaleMatrix>
			<matrixParameter>
				<parameter id="prior.Gamma.col1" value="1.0 0.0 0.0"/>
				<parameter id="prior.Gamma.col2" value="0.0 1.0 0.0"/>
				<parameter id="prior.Gamma.col3" value="0.0 0.0 1.0"/>
			</matrixParameter>
		</scaleMatrix>
		<data>
		    <matrixParameter idref="gammaMatrix"/>
		</data>
	</multivariateWishartPrior>
	-->

	<gammaPrior id="prior.Gamma" shape="0.1" scale="10" offset="0.0">
		<parameter idref="gamma.diag"/>
	</gammaPrior>

	<dummyModel id="dummy">
		<matrixParameter idref="gammaMatrix"/>
		<parameter idref="fixedEffects"/>
	</dummyModel>


	<report>
		<multivariateOUModel idref="mvouModel"/>
	</report>

	<operators id="operators">

		<!--
        <mvouOperator mixingFactor="0.5" priorDf="4" weight="1" autoOptimize="true">
            <matrixParameter idref="Qmat"/>
        </mvouOperator>
        -->
		<randomWalkOperator windowSize="0.1" weight="1" autoOptimize="true">
			<parameter idref="Qmat"/>
		</randomWalkOperator>

		<!--
		<mvouOperator mixingFactor="0.5" priorDf="4" weight="1" autoOptimize="true">
	        <matrixParameter idref="gammaMatrix"/>
        </mvouOperator>
        -->


		<randomWalkOperator windowSize="0.1" weight="1" autoOptimize="true">
			<parameter idref="gamma.diag"/>
		</randomWalkOperator>

		<randomWalkOperator windowSize="0.5" weight="1" autoOptimize="true">
			<parameter idref="fixedEffects"/>
		</randomWalkOperator>

	</operators>

	<mcmc id="mcmc" chainLength="100000" autoOptimize="true">
		<posterior>
			<!--<compoundLikelihood id="likelihood">
			 <multivariateInverseWishartPrior idref="wishartPrior1"/>
		 </compoundLikelihood>-->
			<compoundLikelihood id="likelihood">
				<dummyModel idref="dummy"/>
				<multivariateOUModel idref="mvouModel"/>
			</compoundLikelihood>
			<prior id="prior">
				<!-- <multivariateWishartPrior idref="prior.Qmat"/>  -->
				<multivariateWishartPrior idref="prior.Gamma"/>
				<multivariateNormalPrior idref="prior.FixedEffects"/>
			</prior>
		</posterior>
		<operators idref="operators"/>
		<log logEvery="1000">
			<column label="Likelihood" dp="4" width="12">
				<compoundLikelihood idref="likelihood"/>
				<compoundLikelihood idref="prior"/>
				<parameter idref="fixedEffects"/>
				<matrixParameter idref="Qmat"/>
				<matrixParameter idref="gammaMatrix"/>
			</column>
		</log>
		<log logEvery="1000" fileName="testMVOU.log">
			<compoundLikelihood idref="likelihood"/>
			<compoundLikelihood idref="prior"/>
			<parameter idref="fixedEffects"/>
			<matrixParameter idref="Qmat"/>
			<matrixParameter idref="gammaMatrix"/>
		</log>
	</mcmc>

	<report>
		<property name="timer">
			<object idref="mcmc"/>
		</property>
	</report>

	<traceAnalysis fileName="testMVOU.log"/>

</beast>