%plot Jarque-Bera Anacapa example
%
clear all
close all
  disp('ANACAPA Approximations')
  set(0, 'DefaultAxesFontSize', 16);
  lw =3;  fs = 16;  msize = 10;



anacapa =[452   184   115   315   139   177  214   356   166   246  ...
    177   289   175   296   205   324   260   188   208   109   204 ...
     89   320   256   138   198   191   193   316   122   305   203 ...
    396   250   230   214    46   256   204   150   218   261   143 ...
    229   173   132   175   236   220   212   119   144   147   171 ...
    216   232   216   164   185   216   199   236   237   206   87];



[h chi2jb pval crit chi2jbs]=jarqueberatest(anacapa);
close all
figure(1)
histn(chi2jbs, 0, 0.2, 30);
hold on
range=0:0.01:30;
plot(range, chi2pdf(range,2),'r-','linewidth',lw)
axis([0, 12, 0, 0.52])
legend('JB simulation','\chi^2_2')
%
 print -depsc 'C:\STAT\Goodness\Goodnesseps\jbanacapa.eps'

figure(2)
histn(chi2jbs, 0, 0.2, 30);
hold on
range=0:0.01:30;
plot(range, chi2pdf(range,2),'r-','linewidth',lw)
axis([9, 15, 0, 0.007])
legend('JB simulation','\chi^2_2')
%
 print -depsc 'C:\STAT\Goodness\Goodnesseps\jbanacapa2.eps'