1 function perc = est_max(ps,r)
2 %estimate best cut-off for ROS when fitting model
3 %mdl2_1 = fitlm(pc17.red.fmc_g(msk_1),r2(msk_1))
4 %mdl.Coefficients(1,4),(2,4) are the pvaleus
7 for i = 100:-1:1;%1:100
11 msk = logical(msk1.*msk2);
14 mdl = fitlm(ps.red.fmc_g(msk),r(msk));
15 p(i)=table2array(mdl.Coefficients(2,4));
16 if p(i) <= 0.01 && stopping == 0
17 fprintf('cutoff at ros = %f \n',r_cut(i))
25 % figure,plot(r_cut,p)
30 % figure,plot(r_cut,s)