function model = check_2d2g1se_model( model )
  
%  function model = check_2d2g1se_model( model )
%
% ( 1 ) check that all parameters are present.
% ( 2 ) Fill in the implicit ones (a1, b1, w00g, w01g).
%
% SEE ALSO compute_post_2d2g1se, generate_2d2g1se, fit_2d2g1se.
  
  
  if nargin < 1
    error( [ mfilename ' needs 1 input argument.' ] );
  end
    
  % 2d2f1se model: Make sure all parameters are defined
  
  check_param( { 'a0', 'b0', 'w00d', 'gamma00', 'beta00',  'w01d', 'gamma01', 'beta01', 'beta11' }, fieldnames( model ) );
  
  if model.gamma00 <= 1
    error( [ mfilename ': model.gamma00 must be > 1.' ] );
  end

  if model.beta00 <= 0 
    error( [ mfilename ': model.beta00 must be > 0.' ] );
  end

  if model.gamma01 <= 1
    error( [ mfilename ': model.gamma01 must be > 1.' ] );
  end

  if model.beta01 <= 0 
    error( [ mfilename ': model.beta01 must be > 0.' ] );
  end
  
  if model.beta11 <= 0
    error( [ mfilename ': model.beta11 must be > 0.' ] );
  end
  
  model.a1   = 1 - model.a0;
  model.b1   = 1 - model.b0;
  model.w00g = 1 - model.w00d;
  model.w01g = 1 - model.w01d;
  