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'});
0 个评论
回答(1 个)
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'})
statarray = grpstats(T,{'Group'},{'predci','meanci'},'DataVars',{'Data'})
MeanCI = std(x)/sqrt(numel(x)) * tinv([0.025 0.975],numel(x)-1) + mean(x)
.
4 个评论
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!