function [ n_data, df, xi, x, fx ] = ...
  scaled_inverse_chi_square_pdf_values ( n_data )

%*****************************************************************************80
%
%% scaled_inverse_chi_square_pdf_values(): scaled inverse chi square PDF values.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    04 August 2015
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer N_DATA.  The user sets N_DATA to 0 before the first call.  
%    Thereafter, it should simply be the value returned by the previous call.
%
%  Output:
%
%    integer N_DATA.  On each call, the routine increments N_DATA by 1, and
%    returns the corresponding data; when there is no more data, the
%    output value of N_DATA will be 0 again.
%
%    real DF, the degrees of freedom.
%
%    real XI, the scale parameter.
%
%    real X, the argument of the function.
%
%    Output real FX, the value of the function.
%
  n_max = 18;

  df_vec = [ ...
     1.0, ...
     2.0, ...
     1.0, ...
     2.0, ...
     1.0, ...
     2.0, ...
     1.0, ...
     2.0, ...
     1.0, ...
     2.0, ...
     1.0, ...
     2.0, ...
     1.0, ...
     2.0, ...
     1.0, ...
     2.0, ...
     1.0, ...
     2.0 ];
  fx_vec = [ ...
     0.7322491280963244, ...
     0.3368973499542734, ...
     0.9036119633409063, ...
     1.026062482798735, ...
     0.5968580144169457, ...
     0.8953274901880941, ...
     0.08500366602520342, ...
     0.004539992976248485, ...
     0.3661245640481622, ...
     0.1684486749771367, ...
     0.4518059816704532, ...
     0.5130312413993675, ...
     0.0008099910956089117, ...
     4.122307244877116E-07, ...
     0.04250183301260171, ...
     0.002269996488124243, ...
     0.1830622820240811, ...
     0.08422433748856834 ];
  x_vec = [ ...
    0.10, ...
    0.10, ...
    0.20, ...
    0.20, ...
    0.40, ...
    0.40, ...
    0.10, ...
    0.10, ...
    0.20, ...
    0.20, ...
    0.40, ...
    0.40, ...
    0.10, ...
    0.10, ...
    0.20, ...
    0.20, ...
    0.40, ...
    0.40 ];
  xi_vec = [ ...
    0.50, ...
    0.50, ...
    0.50, ...
    0.50, ...
    0.50, ...
    0.50, ...
    1.00, ...
    1.00, ...
    1.00, ...
    1.00, ...
    1.00, ...
    1.00, ...
    2.00, ...
    2.00, ...
    2.00, ...
    2.00, ...
    2.00, ...
    2.00 ];

  if ( n_data < 0 )
    n_data = 0;
  end

  n_data = n_data + 1;

  if ( n_max < n_data )
    n_data = 0;
    df = 0.0;
    xi = 0.0;
    x = 0.0;
    fx = 0.0;
  else
    df = df_vec(n_data);
    xi = xi_vec(n_data);
    x = x_vec(n_data);
    fx = fx_vec(n_data);
  end

  return
end
