MATLAB 查找置信区间内的数据点数

MATLAB Finding the number of data points within confidence intervals

我在 Matlab 中有一组数据,一个 6256x48 的矩阵,我已经找到了它的均值、标准偏差和 CI 区间。这是使用以下方法完成的:

[muhat1,sigmahat1,muci1,sigmaci1] = normfit(data);

我的问题是,如何在 muci1 数组的置信区间内找到原始数据每列中结果或数据点的数量。

muci1 数组是 2 行 48 个点,顶行是下限,底行是上限。

data = rand(6258,48); %//data
[A,B]=size(data); %// size of your data
[muhat1,sigmahat1,muci1,sigmaci1] = normfit(data); %//stats of your data

mask(A,B)=0; %// create output mask
for ii = 1:B
    mask(:,ii) = data(:,ii)<muci1(2,ii)&data(:,ii)>muci1(1,ii); %// fill mask
end
FinalResult = sum(mask,1); %// number of points within CI per column
finalresult2 = sum(FinalResult); %// number of points within all CIs total

for 循环搜索每列中位于 muci1 给定的两个边界之间的条目。如果一个数字在边界之间,它在 mask 中得到一个 1,否则它变成一个 0.