function [lag_samples lag_dim] = correlation_function_thresholding(X, threshold, t)

positive_half_X = X(floor(numel(X)/2)+1:end);
lag_samples = min(find(positive_half_X <= threshold))-1;
lag_dim = t(floor(numel(X)/2)+1+lag_samples);
