% \section{results = ffmanova(modelFormula,stand,nSim)}

% \subsection{Example}
a = [0 1 0 1 0 1 0 1 0 1 0 1 0 1 0]';
b = [1 1 1 1 1 2 2 2 2 2 3 3 3 3 3]';
c = [1:15]';
Y = randn(15,20); 
results =ffmanova('Y = a|b$|c#2 + c^3 - a^2',0,999);

% \subsection{modelFormula}
results=ffmanova('Y = a + b + c');
results=ffmanova('Y = a + b$ + c');
b_ = {b};
results=ffmanova('Y = a + b_ + c');



% \item[Four ways of specifying the same model]
results=ffmanova('Y = a + b$ + c + a*b + a*c + b*c + c^2 + c^3'); 
results=ffmanova('Y = a|b$|c + c^2 + c^3 - a*b*c'); 
results=ffmanova('Y = a|b$|c@2 + c^2 + c^3'); 
results=ffmanova('Y = a|b$|c#2 + c^3 - a^2'); 

% \item[Eval used to interpret] 
results=ffmanova('log(100+Y) = a + b==2 + 1./c'); 

% \subsection{stand}
% \subsection{nSim}
results=ffmanova('Y = a + b$ + c',1,999); 
results=ffmanova('Y = a + b$ + c',1,0);
results=ffmanova('Y = a + b$ + c',1,[0 999 9999]); 

% \section{results = ffmanova(X,Y,cova,model,xNames,stand,nSim)}
results = ffmanova({a b c},Y,[1 0 1],{1 2 3},{'a' 'b' 'c'},0,999);
results = ffmanova({a b c},Y,[1 0 1],'quadratic',{'a' 'b' 'c'},0,999);


% \section{model = ffmanova([],[],cova,model,xNames)}
model = ffmanova([],[],[1 0 1],{1 2 3},{'a' 'b' 'c'});


% \section{ [X,Y,cova,model,xNames] = ffmanova(modelFormula)}
[X,Y,cova,model,xNames] = ffmanova('Y = a|b$|c#2 + c^3 - a^2'); 
results = ffmanova(X,Y,cova,model,xNames,0,999); 
results = ffmanova(X,Y,cova,'quadratic',xNames,0,999);
results = ffmanova(X,Y,cova,{1 2 3},xNames,0,999); 

% \section{results = ffmanova( .... ,stand,nSim,xNew)}
        Xnew1 = X; 
        Xnew2 = {[0 1 0 1 0 1]',[1:3 1:3]',[5 5 5 5 5 5]'};
        Xnew3 = {[0 1/2 1]',[],[]};     
        Xnew4 = {[],[1:3]',[]};
        Xnew5 = {[0 1 0 1 0 1]',[1:3 1:3]',[]};
        Xnew5 = {1.5,[],3};
        XNEW = {Xnew1;Xnew2;Xnew3;Xnew4;Xnew5};
        results = ffmanova('Y = a|b$|c#2 + c^3 - a^2',0,0,XNEW);

% \section{Coding of categorical variables}
B = {'b1' 'b1' 'b1' 'b1' 'b1' 'b2' 'b2' 'b2' 'b2' 'b2' 'b3' 'b3' 'b3' 'b3' 'b3'}';
results = ffmanova('Y=a|B|c#2+c^3-a^2',0,0,{{[],{'b1' 'b2' 'b3'}',[]}});
