0
votes

I have a set of data in Matlab, a matrix 6256x48, that I have found the mean, std dev, and CI intervals for. This was done using:

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

My question is, how can I find the number of results or data points in each column of the original data that are within the confidence intervals within the muci1 array.

The muci1 array is 2 rows of 48 points, the top row being the lower bound and the bottom row being the upper bound.

1

1 Answers

1
votes
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

The for loop searches for entries in each column that are between the two bounds as given by muci1. If a number is between the bounds it gets a 1 in the mask, otherwise it becomes a 0.