Model_Name  		= "EqualInputAA";
Model_Options 		= 2;
Model_Dimension 	= 20;

function GUIPopulateModelMatrix (ModelMatrixName&, EFV)
{

	ModelMatrixName = {20,20};
	
	if (modelType==0)
	{
		for (counter1=0; counter1<19;counter1=counter1+1)
		{
			for (counter2=counter1+1; counter2<20; counter2=counter2+1)
			{
				ModelMatrixName[counter1][counter2]:=a;
				ModelMatrixName[counter2][counter1]:=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));

		for (counter1=0; counter1<19;counter1=counter1+1)
		{
			for (counter2=counter1+1; counter2<20; counter2=counter2+1)
			{
				ModelMatrixName[counter1][counter2]:=categoryVariable*a;
				ModelMatrixName[counter2][counter1]:=categoryVariable*a;			
			}
		}
	}
	
	return 1;
}

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

function	EFVEstimated	(EFVector&, EFVApproximations)
{
	global frequencyVariable_1 = EFVApproximations[0];
	global frequencyVariable_2 = EFVApproximations[1]/(1-frequencyVariable_1);
	global frequencyVariable_3 = EFVApproximations[2]/(1-frequencyVariable_1)/(1-frequencyVariable_1);
	global frequencyVariable_4 = EFVApproximations[3]/(1-frequencyVariable_1)/(1-frequencyVariable_1)/(1-frequencyVariable_2);
	global frequencyVariable_5 = EFVApproximations[4]/(1-frequencyVariable_1)/(1-frequencyVariable_1)/(1-frequencyVariable_2)/(1-frequencyVariable_3);
	global frequencyVariable_6 = EFVApproximations[5]/(1-frequencyVariable_1)/(1-frequencyVariable_1)/(1-frequencyVariable_2)/(1-frequencyVariable_3)/(1-frequencyVariable_4);
	global frequencyVariable_7 = EFVApproximations[6]/(1-frequencyVariable_1)/(1-frequencyVariable_1)/(1-frequencyVariable_2)/(1-frequencyVariable_3)/(1-frequencyVariable_4)/(1-frequencyVariable_5);
	global frequencyVariable_8 = EFVApproximations[7]/(1-frequencyVariable_1)/(1-frequencyVariable_1)/(1-frequencyVariable_2)/(1-frequencyVariable_3)/(1-frequencyVariable_4)/(1-frequencyVariable_5)/(1-frequencyVariable_6);
	global frequencyVariable_9 = EFVApproximations[8]/(1-frequencyVariable_1)/(1-frequencyVariable_1)/(1-frequencyVariable_2)/(1-frequencyVariable_3)/(1-frequencyVariable_4)/(1-frequencyVariable_5)/(1-frequencyVariable_6)/(1-frequencyVariable_7);
	global frequencyVariable_10 = EFVApproximations[9]/(1-frequencyVariable_1)/(1-frequencyVariable_1)/(1-frequencyVariable_2)/(1-frequencyVariable_3)/(1-frequencyVariable_4)/(1-frequencyVariable_5)/(1-frequencyVariable_6)/(1-frequencyVariable_7)/(1-frequencyVariable_8);
	global frequencyVariable_11 = EFVApproximations[10]/(1-frequencyVariable_1)/(1-frequencyVariable_1)/(1-frequencyVariable_2)/(1-frequencyVariable_3)/(1-frequencyVariable_4)/(1-frequencyVariable_5)/(1-frequencyVariable_6)/(1-frequencyVariable_7)/(1-frequencyVariable_8)/(1-frequencyVariable_9);
	global frequencyVariable_12 = EFVApproximations[11]/(1-frequencyVariable_1)/(1-frequencyVariable_1)/(1-frequencyVariable_2)/(1-frequencyVariable_3)/(1-frequencyVariable_4)/(1-frequencyVariable_5)/(1-frequencyVariable_6)/(1-frequencyVariable_7)/(1-frequencyVariable_8)/(1-frequencyVariable_9)/(1-frequencyVariable_10);
	global frequencyVariable_13 = EFVApproximations[12]/(1-frequencyVariable_1)/(1-frequencyVariable_1)/(1-frequencyVariable_2)/(1-frequencyVariable_3)/(1-frequencyVariable_4)/(1-frequencyVariable_5)/(1-frequencyVariable_6)/(1-frequencyVariable_7)/(1-frequencyVariable_8)/(1-frequencyVariable_9)/(1-frequencyVariable_10)/(1-frequencyVariable_11);
	global frequencyVariable_14 = EFVApproximations[13]/(1-frequencyVariable_1)/(1-frequencyVariable_1)/(1-frequencyVariable_2)/(1-frequencyVariable_3)/(1-frequencyVariable_4)/(1-frequencyVariable_5)/(1-frequencyVariable_6)/(1-frequencyVariable_7)/(1-frequencyVariable_8)/(1-frequencyVariable_9)/(1-frequencyVariable_10)/(1-frequencyVariable_11)/(1-frequencyVariable_12);
	global frequencyVariable_15 = EFVApproximations[14]/(1-frequencyVariable_1)/(1-frequencyVariable_1)/(1-frequencyVariable_2)/(1-frequencyVariable_3)/(1-frequencyVariable_4)/(1-frequencyVariable_5)/(1-frequencyVariable_6)/(1-frequencyVariable_7)/(1-frequencyVariable_8)/(1-frequencyVariable_9)/(1-frequencyVariable_10)/(1-frequencyVariable_11)/(1-frequencyVariable_12)/(1-frequencyVariable_13);
	global frequencyVariable_16 = EFVApproximations[15]/(1-frequencyVariable_1)/(1-frequencyVariable_1)/(1-frequencyVariable_2)/(1-frequencyVariable_3)/(1-frequencyVariable_4)/(1-frequencyVariable_5)/(1-frequencyVariable_6)/(1-frequencyVariable_7)/(1-frequencyVariable_8)/(1-frequencyVariable_9)/(1-frequencyVariable_10)/(1-frequencyVariable_11)/(1-frequencyVariable_12)/(1-frequencyVariable_13)/(1-frequencyVariable_14);
	global frequencyVariable_17 = EFVApproximations[16]/(1-frequencyVariable_1)/(1-frequencyVariable_1)/(1-frequencyVariable_2)/(1-frequencyVariable_3)/(1-frequencyVariable_4)/(1-frequencyVariable_5)/(1-frequencyVariable_6)/(1-frequencyVariable_7)/(1-frequencyVariable_8)/(1-frequencyVariable_9)/(1-frequencyVariable_10)/(1-frequencyVariable_11)/(1-frequencyVariable_12)/(1-frequencyVariable_13)/(1-frequencyVariable_14)/(1-frequencyVariable_15);
	global frequencyVariable_18 = EFVApproximations[17]/(1-frequencyVariable_1)/(1-frequencyVariable_1)/(1-frequencyVariable_2)/(1-frequencyVariable_3)/(1-frequencyVariable_4)/(1-frequencyVariable_5)/(1-frequencyVariable_6)/(1-frequencyVariable_7)/(1-frequencyVariable_8)/(1-frequencyVariable_9)/(1-frequencyVariable_10)/(1-frequencyVariable_11)/(1-frequencyVariable_12)/(1-frequencyVariable_13)/(1-frequencyVariable_14)/(1-frequencyVariable_15)/(1-frequencyVariable_16);
	global frequencyVariable_19 = EFVApproximations[18]/(1-frequencyVariable_1)/(1-frequencyVariable_1)/(1-frequencyVariable_2)/(1-frequencyVariable_3)/(1-frequencyVariable_4)/(1-frequencyVariable_5)/(1-frequencyVariable_6)/(1-frequencyVariable_7)/(1-frequencyVariable_8)/(1-frequencyVariable_9)/(1-frequencyVariable_10)/(1-frequencyVariable_11)/(1-frequencyVariable_12)/(1-frequencyVariable_13)/(1-frequencyVariable_14)/(1-frequencyVariable_15)/(1-frequencyVariable_16)/(1-frequencyVariable_17);


	EFVector = {
		{frequencyVariable_1}
		{(1-frequencyVariable_1)*frequencyVariable_2}
		{(1-frequencyVariable_1)*(1-frequencyVariable_2)*frequencyVariable_3}
		{(1-frequencyVariable_1)*(1-frequencyVariable_2)*(1-frequencyVariable_3)*frequencyVariable_4}
		{(1-frequencyVariable_1)*(1-frequencyVariable_2)*(1-frequencyVariable_3)*(1-frequencyVariable_4)*frequencyVariable_5}
		{(1-frequencyVariable_1)*(1-frequencyVariable_2)*(1-frequencyVariable_3)*(1-frequencyVariable_4)*(1-frequencyVariable_5)*frequencyVariable_6}
		{(1-frequencyVariable_1)*(1-frequencyVariable_2)*(1-frequencyVariable_3)*(1-frequencyVariable_4)*(1-frequencyVariable_5)*(1-frequencyVariable_6)*frequencyVariable_7}
		{(1-frequencyVariable_1)*(1-frequencyVariable_2)*(1-frequencyVariable_3)*(1-frequencyVariable_4)*(1-frequencyVariable_5)*(1-frequencyVariable_6)*(1-frequencyVariable_7)*frequencyVariable_8}
		{(1-frequencyVariable_1)*(1-frequencyVariable_2)*(1-frequencyVariable_3)*(1-frequencyVariable_4)*(1-frequencyVariable_5)*(1-frequencyVariable_6)*(1-frequencyVariable_7)*(1-frequencyVariable_8)*frequencyVariable_9}
		{(1-frequencyVariable_1)*(1-frequencyVariable_2)*(1-frequencyVariable_3)*(1-frequencyVariable_4)*(1-frequencyVariable_5)*(1-frequencyVariable_6)*(1-frequencyVariable_7)*(1-frequencyVariable_8)*(1-frequencyVariable_9)*frequencyVariable_10}
		{(1-frequencyVariable_1)*(1-frequencyVariable_2)*(1-frequencyVariable_3)*(1-frequencyVariable_4)*(1-frequencyVariable_5)*(1-frequencyVariable_6)*(1-frequencyVariable_7)*(1-frequencyVariable_8)*(1-frequencyVariable_9)*(1-frequencyVariable_10)*frequencyVariable_11}
		{(1-frequencyVariable_1)*(1-frequencyVariable_2)*(1-frequencyVariable_3)*(1-frequencyVariable_4)*(1-frequencyVariable_5)*(1-frequencyVariable_6)*(1-frequencyVariable_7)*(1-frequencyVariable_8)*(1-frequencyVariable_9)*(1-frequencyVariable_10)*(1-frequencyVariable_11)*frequencyVariable_12}
		{(1-frequencyVariable_1)*(1-frequencyVariable_2)*(1-frequencyVariable_3)*(1-frequencyVariable_4)*(1-frequencyVariable_5)*(1-frequencyVariable_6)*(1-frequencyVariable_7)*(1-frequencyVariable_8)*(1-frequencyVariable_9)*(1-frequencyVariable_10)*(1-frequencyVariable_11)*(1-frequencyVariable_12)*frequencyVariable_13}
		{(1-frequencyVariable_1)*(1-frequencyVariable_2)*(1-frequencyVariable_3)*(1-frequencyVariable_4)*(1-frequencyVariable_5)*(1-frequencyVariable_6)*(1-frequencyVariable_7)*(1-frequencyVariable_8)*(1-frequencyVariable_9)*(1-frequencyVariable_10)*(1-frequencyVariable_11)*(1-frequencyVariable_12)*(1-frequencyVariable_13)*frequencyVariable_14}
		{(1-frequencyVariable_1)*(1-frequencyVariable_2)*(1-frequencyVariable_3)*(1-frequencyVariable_4)*(1-frequencyVariable_5)*(1-frequencyVariable_6)*(1-frequencyVariable_7)*(1-frequencyVariable_8)*(1-frequencyVariable_9)*(1-frequencyVariable_10)*(1-frequencyVariable_11)*(1-frequencyVariable_12)*(1-frequencyVariable_13)*(1-frequencyVariable_14)*frequencyVariable_15}
		{(1-frequencyVariable_1)*(1-frequencyVariable_2)*(1-frequencyVariable_3)*(1-frequencyVariable_4)*(1-frequencyVariable_5)*(1-frequencyVariable_6)*(1-frequencyVariable_7)*(1-frequencyVariable_8)*(1-frequencyVariable_9)*(1-frequencyVariable_10)*(1-frequencyVariable_11)*(1-frequencyVariable_12)*(1-frequencyVariable_13)*(1-frequencyVariable_14)*(1-frequencyVariable_15)*frequencyVariable_16}
		{(1-frequencyVariable_1)*(1-frequencyVariable_2)*(1-frequencyVariable_3)*(1-frequencyVariable_4)*(1-frequencyVariable_5)*(1-frequencyVariable_6)*(1-frequencyVariable_7)*(1-frequencyVariable_8)*(1-frequencyVariable_9)*(1-frequencyVariable_10)*(1-frequencyVariable_11)*(1-frequencyVariable_12)*(1-frequencyVariable_13)*(1-frequencyVariable_14)*(1-frequencyVariable_15)*(1-frequencyVariable_16)*frequencyVariable_17}
		{(1-frequencyVariable_1)*(1-frequencyVariable_2)*(1-frequencyVariable_3)*(1-frequencyVariable_4)*(1-frequencyVariable_5)*(1-frequencyVariable_6)*(1-frequencyVariable_7)*(1-frequencyVariable_8)*(1-frequencyVariable_9)*(1-frequencyVariable_10)*(1-frequencyVariable_11)*(1-frequencyVariable_12)*(1-frequencyVariable_13)*(1-frequencyVariable_14)*(1-frequencyVariable_15)*(1-frequencyVariable_16)*(1-frequencyVariable_17)*frequencyVariable_18}
		{(1-frequencyVariable_1)*(1-frequencyVariable_2)*(1-frequencyVariable_3)*(1-frequencyVariable_4)*(1-frequencyVariable_5)*(1-frequencyVariable_6)*(1-frequencyVariable_7)*(1-frequencyVariable_8)*(1-frequencyVariable_9)*(1-frequencyVariable_10)*(1-frequencyVariable_11)*(1-frequencyVariable_12)*(1-frequencyVariable_13)*(1-frequencyVariable_14)*(1-frequencyVariable_15)*(1-frequencyVariable_16)*(1-frequencyVariable_17)*(1-frequencyVariable_18)*frequencyVariable_19}
		{(1-frequencyVariable_1)*(1-frequencyVariable_2)*(1-frequencyVariable_3)*(1-frequencyVariable_4)*(1-frequencyVariable_5)*(1-frequencyVariable_6)*(1-frequencyVariable_7)*(1-frequencyVariable_8)*(1-frequencyVariable_9)*(1-frequencyVariable_10)*(1-frequencyVariable_11)*(1-frequencyVariable_12)*(1-frequencyVariable_13)*(1-frequencyVariable_14)*(1-frequencyVariable_15)*(1-frequencyVariable_16)*(1-frequencyVariable_17)*(1-frequencyVariable_18)*(1-frequencyVariable_19)}
	};
					
	MULTIPLY_BY_FREQS = 1;
	return 	0;
}
