function [nestAOV] = nestAOV(X,s)
%Two level nested analysis of variance with equal or unequal sample sizes. 
%(referred to the levels of nested factor). 
%
%   Syntax: function [nestAOV] = nestAOV(X,s) 
%      
%     Inputs:
%          X - data matrix 
%      (column 1:data; column 2:main factor; column 3:nested factor).
%          s - equal (=1) or unequal (=2) sample sizes.
%     Output:
%          No. of levels of factors.
%          Complete analysis of variance table.

%  Created by A. Trujillo-Ortiz and R. Hernandez-Walls
%             Facultad de Ciencias Marinas
%             Universidad Autonoma de Baja California
%             Apdo. Postal 453
%             Ensenada, Baja California
%             Mexico.
%             atrujo@uabc.mx
%
%  February 30, 2003.
%
%  To cite this file, this would be an appropriate format:
%  Trujillo-Ortiz, A. and R. Hernandez-Walls. (2003). nestAOV: Two-level nested analysis of variance design
%    with equal or unequal sample sizes. A MATLAB file. [WWW document]. URL http://www.mathworks.com/
%    matlabcentral/fileexchange/loadFile.do?objectId=3065&objectType=file
%

if nargin < 2, 
   error('Requires at least two input arguments.'); 
end


if s==1;
   disp('It is an equal sample sizes procedure.');
   disp('     ')
   nest1(X)
else
   disp('It is an unequal sample sizes procedure.');
   disp('     ')
   nest2(X)
end