How to determine if new data lies outside old prediction intervals
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Tony
le 21 Juin 2024
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
Réponses (0)
Voir également
Catégories
En savoir plus sur Curve Fitting Toolbox dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!