function balanced_change_points=balanced_bootstrap_dwn(input_data,num_bootstrap_runs,len,cp_ID_method) %checked aug 7/2007 ordinal_vecs_balanced=balanced_bootstrap_array_maker(len,num_bootstrap_runs); balanced_change_points=zeros(1,num_bootstrap_runs); for bootstraps_using_balancedarray=1:num_bootstrap_runs if cp_ID_method==1 [change_point_from_balanced,smallest_sse]=find_change_point_using_sum_of_squares(input_data(1,ordinal_vecs_balanced(bootstraps_using_balancedarray,:)));%smallest_sse is not used here elseif cp_ID_method==2 [change_point_from_balanced,changemagnitude]=find_change_point_using_trend_method(input_data(1,ordinal_vecs_balanced(bootstraps_using_balancedarray,:)));%changemagnitude is not used here end balanced_change_points(bootstraps_using_balancedarray)=change_point_from_balanced; end % balanced_change_points=sort(balanced_change_points); % cutoff=(.025*num_bootstrap_runs);%CHOOSE num_bootstrap_runs s.t. there is no need for rounding here % temporal_confidence_window=[balanced_change_points(cutoff) balanced_change_points(end-cutoff)] %%hold on,plot(balanced_change_points,'go')