diff --git a/+Simulator/@TwoDimensionalMOT/bootstrapErrorEstimation.m b/+Simulator/@TwoDimensionalMOT/bootstrapErrorEstimation.m index d47cb5d..4c26441 100644 --- a/+Simulator/@TwoDimensionalMOT/bootstrapErrorEstimation.m +++ b/+Simulator/@TwoDimensionalMOT/bootstrapErrorEstimation.m @@ -9,20 +9,20 @@ function [LoadingRate, StandardError, ConfidenceInterval] = bootstrapErrorEstima if ~isnan(CorrelationFactor) SampleLength = floor(CorrelationFactor); NumberOfBootsrapSamples = 1000; - MeanLoadingRatioInEachSample = zeros(1,NumberOfBootsrapSamples); + MeanCaptureRatioInEachSample = zeros(1,NumberOfBootsrapSamples); for SampleNumber = 1:NumberOfBootsrapSamples BoostrapSample = datasample(NumberOfLoadedAtoms, SampleLength); % Sample with replacement - MeanLoadingRatioInEachSample(SampleNumber) = mean(BoostrapSample) / n; % Empirical bootstrap distribution of sample means + MeanCaptureRatioInEachSample(SampleNumber) = mean(BoostrapSample) / n; % Empirical bootstrap distribution of sample means end - LoadingRate = mean(MeanLoadingRatioInEachSample) * ovenObj.ReducedFlux; + LoadingRate = mean(MeanCaptureRatioInEachSample) * ovenObj.ReducedFlux; Variance = 0; % Bootstrap Estimate of Variance for SampleNumber = 1:NumberOfBootsrapSamples - Variance = Variance + (MeanLoadingRatioInEachSample(SampleNumber) - mean(MeanLoadingRatioInEachSample))^2; + Variance = Variance + (MeanCaptureRatioInEachSample(SampleNumber) - mean(MeanCaptureRatioInEachSample))^2; end - StandardError = sqrt((1 / (NumberOfBootsrapSamples-1)) * Variance) * ovenObj.ReducedFlux; + StandardError = sqrt((1 / (NumberOfBootsrapSamples-1)) * Variance) * ovenObj.ReducedFlux; ts = tinv([0.025 0.975],NumberOfBootsrapSamples-1); % T-Score ConfidenceInterval = LoadingRate + ts*StandardError; % 95% Confidence Intervals