Calculation of prediction interval for a new observation

11 次查看(过去 30 天)
Hello,
does anyone know how the calculation of the 95% prediction interval for a new observation in the "grpstats"-function is performed? I can't find anything in the documentation. Is there any documentation availible?
If I have a set of values (x), is there an other way for calculating the prediction interval?
I can only find the calculation for regression models, but not for single vectors.
x = [95 84 105 96 86 86 95 94 75 93]';
Group = (ones(10,1));
T = table(x,Group,'VariableNames',{'Data','Group'});
statarray = grpstats(T,{'Group'},{'predci','meanci'},'DataVars',{'Data'});

回答(1 个)

Star Strider
Star Strider 2022-1-11
The code is not doing a regression, so the ±95% confidence intervals on the vector would be the confidence intervals on the mean, calculated here as ‘MeanCI’ and corresponding to 'meanci'. I am not certain that 'predci' is appropriate here because no regression is being calculated, as would be the situation in something like Plot Prediction Intervals for a New Observation in Each Group.
x = [95 84 105 96 86 86 95 94 75 93]';
Group = (ones(10,1));
T = table(x,Group,'VariableNames',{'Data','Group'})
T = 10×2 table
Data Group ____ _____ 95 1 84 1 105 1 96 1 86 1 86 1 95 1 94 1 75 1 93 1
statarray = grpstats(T,{'Group'},{'predci','meanci'},'DataVars',{'Data'})
statarray = 1×4 table
Group GroupCount predci_Data meanci_Data _____ __________ ________________ ________________ 1 1 10 71.194 110.61 84.958 96.842
MeanCI = std(x)/sqrt(numel(x)) * tinv([0.025 0.975],numel(x)-1) + mean(x)
SEMCI = 1×2
84.9583 96.8417
.
  4 个评论
Paul Müller
Paul Müller 2022-1-14
I think i understand the problem.
In the context of a regression, the prediction intervall makes perfect sence to me.
In the context with the grpstats function, the 'meanci'-statistic calculates the confidence intervall for the mean with the given significance level.
What makes sense from my point of view for 'predci': It could calculate the prediction of the 95%-quantile with the given significance level. So if I don't want to predict the mean, but the 95%-quantile or the range of 'meanci', the uncertainty will get greater.
If 'predci' is not appropriate for a simple set of grouped values, it would not make sence that you can call it in the grpstats function?
It would be very helpfull if there is a more detailed documentation besides the one from the "grpstats" function which says "95% prediction interval for a new observation. You can specify different significance levels using the Alpha name-value pair argument."
Star Strider
Star Strider 2022-1-14
If 'predci' is not appropriate for a simple set of grouped values, it would not make sence that you can call it in the grpstats function?
In the context of grpstats, the 'predci' option makes sense for regeressions, as the documentation demonstrates. There is no regression here. (This also applies to the paragraph that follows in your previous Comment.)
So 'meanci' applies to vectors of observations that are not regressions. Prediction intervals are appropriate only in the situation of a regression that actually predicts a future dependent variable oin the basis of a new independnet variable. That does not apply here.

请先登录,再进行评论。

标签

Community Treasure Hunt

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

Start Hunting!

Translated by