function aptitude_test ( )

%*****************************************************************************80
%
%% APTITUDE_TEST plots the aptitude test data.
%
%  Discussion:
%
%    Because this data is essentially two-dimensional, it is not suitable
%    for treatment by MATLAB's isoutlier() function.
%
%    Since the data seems to suggest a basically linear relationship
%    between test scores T and sales S, it would be possible to determine
%    a least squares fit of the form
%      S = a * T + b
%    and then compute, for each employee, the discrepancy
%      D(i) = S(i) - ( a * T(i) + b )
%    and this quantity would be suitable for the isoutlier() function.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    23 April 2018
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'APTITUDE_TEST:\n' );
  fprintf ( 1, '  MATLAB version\n' );
  fprintf ( 1, '  Read and plot data for 20 employees, recording their\n' );
  fprintf ( 1, '  scores on a business aptitude test, versus their\n' );
  fprintf ( 1, '  average monthly sales results.\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  In most cases, the quantities seem correlated, but\n' );
  fprintf ( 1, '  there seem to be several outliers.\n' );
%
%  Read CSV file, skipping first line, which contains labels.
%
  data = csvread ( 'aptitude_test.csv', 1 );

  [ m, n ] = size ( data );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  ID Score   Sales\n' );
  fprintf ( 1, '\n' );
  for i = 1 : m
    fprintf ( 1, '  %2d  %4d  %6d\n', data(i,1:3) );
  end
%
%  Column 1 = Employee ID
%  Column 2 = Aptitude test score
%  Column 3 = Average Monthly sales 
%
  plot ( data(:,2), data(:,3), 'b.', 'markersize', 35  )
  grid ( 'on' )
  xlabel ( '<-- Aptitude test score -->', 'FontSize', 16 )
  ylabel ( '<-- Average monthly sales -->', 'FontSize', 16 )
  title ( 'Test Score / Month Sales', 'FontSize', 24 )
%
%  Add the least squares line through the data.
%
  lsline ( )

  filename = 'aptitude_test.png';
  print ( '-dpng', filename )
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'APTITUDE_TEST:\n' );
  fprintf ( 1, '  Normal end of execution.\n' );

  return
end
