Model_Name  		= "F81";
Model_Options 		= 6;
Model_Dimension 	= 4;
Model_EFV_Type		= "Observed In Partition";

/*-------------------------------------------------------------------------------*/

function GUIPopulateModelMatrix (ModelMatrixName&, EFV)
{
	if (modelType == 0)
	{
		ModelMatrixName = {{*,a,a,a}
						   {a,*,a,a}
						   {a,a,*,a}
						   {a,a,a,*}};
	}
	else
	{
		global shapeParameter = .5;
		shapeParameter:>0.01;shapeParameter:<100;
		category     categoryVariable = 
					(rateClassCount, EQUAL, MEAN, GammaDist(_x_,shapeParameter,shapeParameter), CGammaDist(_x_,shapeParameter,shapeParameter), 0 , 
			  							1e25,CGammaDist(_x_,shapeParameter+1,shapeParameter));
			  							
		ModelMatrixName = {{*,a*categoryVariable,a*categoryVariable,a*categoryVariable}
						   {a*categoryVariable,*,a*categoryVariable,a*categoryVariable}
						   {a*categoryVariable,a*categoryVariable,*,a*categoryVariable}
						   {a*categoryVariable,a*categoryVariable,a*categoryVariable,*}};
	}
	return 1;
}

/*-------------------------------------------------------------------------------*/

function	EFVEstimated	(EFVector&, EFVApproximations)
{
	global frequencyVariableA;
	global frequencyVariableC;
	global frequencyVariableG;
	global frequencyVariableT;
	global frequencyVariableSum;

	frequencyVariableA:<1;
	frequencyVariableC:<1;
	frequencyVariableG:<1;
	frequencyVariableT	 :=	Abs(1-frequencyVariableA-frequencyVariableC-frequencyVariableG);
	frequencyVariableSum := frequencyVariableA+frequencyVariableC+frequencyVariableG+frequencyVariableT;

	frequencyVariableA = EFVApproximations[0];
	frequencyVariableC = EFVApproximations[1];
	frequencyVariableG = EFVApproximations[2];

	EFVector = {{frequencyVariableA/frequencyVariableSum},
				{frequencyVariableC/frequencyVariableSum},
				{frequencyVariableG/frequencyVariableSum},
				{frequencyVariableT/frequencyVariableSum}};
				
	return	1;
}
