different prediction bounds for different 2D fit types

2 次查看(过去 30 天)
Dear Matlab Community,
I have a question regarding the prediction bounds which the function predint calculatates for performed regressions. I have data which is split into 5 points of fitting data and 2 points of validation data. I am performing the regression with the fit data and want to check with the confidence bounds whether the validation data is on those bounds or if it is not. my code looks like this:
%%% q_mu50_t2 is 5x7 matrix where each column represents data i want to
%%% analyse
x_fit=q_mu50_t20;
y_fit=h1_mu50_t20;
%%% split data into fit and validation data
x_val=[x_fit(:,2) x_fit(:,4)];
y_val=[y_fit(:,2) y_fit(:,4)];
x_fit(:,4)=[];
x_fit(:,2)=[];
y_fit(:,4)=[];
y_fit(:,2)=[];
err_y_fit=std(y_fit);
err_y_val=std(y_val);
x_fit=mean(x_fit);
y_fit=mean(y_fit);
x_val=mean(x_val);
y_val=mean(y_val);
%%generate fit and prediction intervals
ft=fit(x_fit',y_fit','poly3');
p11 = predint(ft,160:10:1200,0.95);
h=plot(160:10:1200,ft(160:10:1200),'-r');
ax=gca;
hold on
errorbar(x_fit,y_fit,err_y_fit,'ks');
errorbar(x_val,y_val,err_y_val,'bo');
plot(160:10:1200,p11,'m--');
hold off
ax.XAxis.Limits=[150 1200];
%ax.YAxis.Limits=[25 50];
ax.FontSize=12;
xtickangle(45);
%dim=[.68 .6 .3 .3];
dim=[.15 .05 .3 .3];
str={'$h_0=$ $50$ $\mu m$','$T_R =$ $20$ $^\circ C$','$v_w=0,1$ $m/min$','$R^{2}_{Par.}=0.99$'};
%str={'$h_0=$ $50$ $\mu m$','$T_R =$ $20^\circ C$','$v_w=0.1$ $m/min$'};
annotation('textbox',dim,'String',str,'FitBoxToText','on','Interpreter','latex');
xlabel('line load $L$ in $N/mm$ $\longrightarrow$','Interpreter','latex')
ylabel('thickness $h_{1}$ in $\mu$m $\longrightarrow$','Interpreter','latex')
lg=legend ('$regressionline$','$parametrisationdata$','$validationdata$','$95\%$ $confidence$ $bounds$','Interpreter','latex','Location','northeast')
ax.YGrid='off';
However if run the code with two different fitting modes the predint function gives me entirely different confidence bounds, eventhough the performed regessions (first regression mode is 'poly3' and the second one I used is 'power1') both fit the data almost perfectly with an R^2 of 0.99. I have attached the resulting plots for the two different fitting modes as files to this post.
I checked the documentation (https://de.mathworks.com/help/curvefit/confidence-and-prediction-bounds.html) but wasn't able to figure out, why i get such different outputs. In may opinion prediction bounds produced like in the attached file "community_question1.fig" are useless as they are to wide. Can anyone tell me how i can produce decent prediction bounds for the fit generated with 'poly3'?
Thank you for help and best regards
Lukas

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Linear and Nonlinear Regression 的更多信息

产品


版本

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by