How to determine if new data lies outside old prediction intervals
조회 수: 1 (최근 30일)
이전 댓글 표시
I have made a prediction model (using fit and predint) based on data in my table T. I know how to test if the existing data is outside the prediction interval, but I am unsure how to test new datapoints. I do not want to use the new data to make a new fit, I want to use the existing fit model and prediction intervals from the original data.
I am not sure how to generate a continuous function for the upper and lower interval.
Thanks.
load example_table.mat
T=sortrows(T,"Xdata");
x=T.Xdata;
y=T.Ydata;
fitresult = fit(x,y,'exp1');
pred = predint(fitresult,x,0.95);
plot(fitresult,x,y)
hold on
plot(x,pred,'m--')
legend({'Data','Fitted curve', 'Prediction intervals'},...
'FontSize',8,'Location','northwest')
%% See which rows fall outside of interval
outside = (y < pred(:, 1)) | (y > pred(:, 2));
rows_outside_interval = T(outside, :)
% Now I add a new row (that would fall outside), and want to test this against the existing
% prediction interval. Stuck here.
ht=height(T);
T(ht+1,:)=T(1,:);
T(ht+1,"Xdata")={300};
T(ht+1,"Ydata")={25};
T(ht+1,:)
댓글 수: 2
Tony
2024년 6월 21일
One idea is to find the pair of x points in the prediction interval series where the new data x lies in-between, assume the prediction is interpolated linearly in that interval, find the y value of the prediction intervals via linear interpolation for the data x, and then compare with your data y
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Curve Fitting Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!