%
% Jeremy from Matlab+WinBUGS
%


dataStruct = struct( ...
    'N', 5, ...
    'tau',1/80,...
    'xi',1/120,...
    'mu',110,...
    'scores',[97 110 117 102 98]);


 initStruct = struct( ...
    'theta', 100 );

cd('C:\Springer\Bayes\Bayesmat\matbugs\')

[samples, stats] = matbugs(dataStruct, ...
		fullfile(pwd, 'jeremy.txt'), ...
		'init', initStruct, ...
        'nChains', 1, ...
		'view', 0, ...
        'nburnin', 2000, ...
        'nsamples', 50000, ...
		'thin', 1, ...
		'monitorParams', {'theta'}, ...
        'Bugdir', 'C:/Program Files/BUGS');

baymean = mean(samples.theta)
frmean=mean(dataStruct.scores)

  close all
  figure(1)
  [p, x] = ksdensity(samples.theta);
  plot(x, p,'b-','LineWidth',2);
 % hold on
 % plot(x, normpdf(x, 102.8, sqrt(48)),'r--')
 cd('C:\Springer\Bayes\Bayesmat\')