function [o,v,b,t1]=optimal(u) % generates optimal linear combination of five estimators and outputs % average estimator and variance. t1=cputime; Y1=(.53/2)*(fn(.47+.53*u)+fn(1-.53*u)); t1=[t1 cputime]; Y2=.37*.5*(fn(.47+.37*u)+fn(.84-.37*u))+.16*.5*(fn(.84+.16*u)+fn(1-.16*u)); t1=[t1 cputime]; Y3=.37*fn(.47+.37*u)+.16*fn(1-.16*u); t1=[t1 cputime]; intg=2*(.53)^3+.53^2/2; Y4=intg+fn(u)-GG(u); t1=[t1 cputime]; Y5=importance('fn','importancedens(IM)','Ginverse(u)',u); t1=[t1 cputime]; X=[Y1' Y2' Y3' Y4' Y5']; mean(X) V=cov(X); Z=ones(5,1); V1=inv(V); b=V1*Z/(Z'*V1*Z); o=mean(X*b); t1=[t1 cputime]; v=1/(Z'*V1*Z); t1=diff(t1); % these are the cputimes of the various estimators.