disp('---------------------------------------------------------- ml_tut1.m')
disp('Theory says the llf should increase by 0.5 when final')
disp('parameters are perturbed by their insensitivities if')
disp('the minimum is quadratic. Lets check - be patient.');
disp(' ')

llffinal=llf;deltallf=0*pidf;insens=exp(-log(diag(hes))/2);
    for ii=1:prod(size(pid));
    p=pfin;p(pid(ii))=p(pid(ii))+insens(ii);
    eval(dolike);deltallf(ii)=nllf-llffinal;
    end
disp('Delta_llf''s are');deltallf'
disp(' ')
disp('Now lets find the displacements from pfin that put us at')
disp('the points on the confidence ellipsoid corresponding to ')
disp('the Cramer-Rao bounds. eval(dopcr) puts the pts in cols of pcr')
eval(dopcr)
disp(' ')
disp('The diagonal gives the Cramer-Rao bounds');disp(' ');
disp('The columns in diag(insens) also reach the ellipsoid')
diaginsens=diag(insens)
disp(' ')
disp('Now prove the col vectors in pcr lie on the ellipsoid')
disp('If this is so, pcr(:,i)''*hes*pcr(:,i) should equal one')
disp('i.e., diag(pcr''*hes*pcr) should = eye')
pcr'*hes*pcr
disp('It is.')
disp('------------------------------------------------------ end ml_tut1.m')
