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!