Removed the measurement of autocorrelation, modifications made for the bootstrap sample size and number to be user-defined.
This commit is contained in:
parent
e29c923723
commit
8ac0a018f2
@ -1,14 +1,7 @@
|
|||||||
function [LoadingRate, StandardError, ConfidenceInterval] = bootstrapErrorEstimation(this, ovenObj, NumberOfLoadedAtoms)
|
function [LoadingRate, StandardError, ConfidenceInterval] = bootstrapErrorEstimation(this, ovenObj, NumberOfLoadedAtoms)
|
||||||
n = this.NumberOfAtoms;
|
n = this.NumberOfAtoms;
|
||||||
NumberOfTimeSteps = int64(this.SimulationTime/this.TimeStep);
|
SampleLength = this.BootstrapSampleLength;
|
||||||
|
NumberOfBootsrapSamples = this.BootstrapSampleNumber;
|
||||||
Autocorrelation = autocorr(NumberOfLoadedAtoms,'NumLags', double(NumberOfTimeSteps - 1));
|
|
||||||
|
|
||||||
if Autocorrelation(1)~=0
|
|
||||||
CorrelationFactor = table(Helper.findAllZeroCrossings(linspace(1, double(NumberOfTimeSteps), double(NumberOfTimeSteps)), Autocorrelation)).Var1(1);
|
|
||||||
if ~isnan(CorrelationFactor)
|
|
||||||
SampleLength = floor(CorrelationFactor);
|
|
||||||
NumberOfBootsrapSamples = 1000;
|
|
||||||
MeanCaptureRatioInEachSample = zeros(1,NumberOfBootsrapSamples);
|
MeanCaptureRatioInEachSample = zeros(1,NumberOfBootsrapSamples);
|
||||||
for SampleNumber = 1:NumberOfBootsrapSamples
|
for SampleNumber = 1:NumberOfBootsrapSamples
|
||||||
BoostrapSample = datasample(NumberOfLoadedAtoms, SampleLength); % Sample with replacement
|
BoostrapSample = datasample(NumberOfLoadedAtoms, SampleLength); % Sample with replacement
|
||||||
@ -26,14 +19,4 @@ function [LoadingRate, StandardError, ConfidenceInterval] = bootstrapErrorEstima
|
|||||||
|
|
||||||
ts = tinv([0.025 0.975],NumberOfBootsrapSamples-1); % T-Score
|
ts = tinv([0.025 0.975],NumberOfBootsrapSamples-1); % T-Score
|
||||||
ConfidenceInterval = LoadingRate + ts*StandardError; % 95% Confidence Intervals
|
ConfidenceInterval = LoadingRate + ts*StandardError; % 95% Confidence Intervals
|
||||||
else
|
|
||||||
LoadingRate = nan;
|
|
||||||
StandardError = nan;
|
|
||||||
ConfidenceInterval = [nan nan];
|
|
||||||
end
|
|
||||||
else
|
|
||||||
LoadingRate = nan;
|
|
||||||
StandardError = nan;
|
|
||||||
ConfidenceInterval = [nan nan];
|
|
||||||
end
|
|
||||||
end
|
end
|
Loading…
Reference in New Issue
Block a user