function out=vofvBetaResample(data1,nreps)
% resamples the best beta distribution fit of turn bias data nreps times. 

x=0:.01:1;
out=zeros(nreps,length(x));

data1(isnan(data1))=[];

n1=length(data1);

h=waitbar(0);

for i=1:nreps
    
   which1=ceil(rand(n1,1)*n1);
   data1Temp=data1(which1);
   
   mu=mean(data1Temp);
   va=var(data1Temp);
   
   A=mu*(mu*(1-mu)/va-1);
   B=(1-mu)*(mu*(1-mu)/va-1);
   
   temp=betapdf(x,A,B);
   
   out(i,:)=temp/sum(temp);
   
   waitbar(i/nreps,h);
end
    
close(h);