% ProbMis: Find the probability of a misprediction % based on 20 means and standard deviations. % % Scott F. Smith % Department of Electrical and Computer Engineering % Boise State University % SFSmith@BoiseState.edu % % 09 February 2005 % Specify which distribution is correct (1 through 20) CorrectDist = 20; % Means and standard deviations Means = [ 0.25 0.38 0.74 0.20 0.39 0.31 0.29 0.31 1.50 0.21 0.37 0.89 0.34 0.46 0.45 0.38 0.75 0.77 1.02 3.37 ]; StDevs = [ 0.05 0.06 0.17 0.03 0.09 0.06 0.04 0.04 0.56 0.05 0.06 0.22 0.04 0.08 0.08 0.06 0.13 0.22 0.41 0.93 ]; % Take 10,000 samples of each of the 20 distributions CorrectHits = 0; SampVals = zeros(1,20); for samp = 1:10000 for distrib = 1:20 SampVals(distrib) = Means(distrib) + randn*StDevs(distrib); end [MaxVal, MaxIndex] = max(SampVals); if MaxIndex == CorrectDist CorrectHits = CorrectHits + 1; end end MisPred = 1 - (CorrectHits/10000)