Skip to content

Commit

Permalink
nsamp cotrol corrected to account for LS. See lines 1394 - 1415.
Browse files Browse the repository at this point in the history
  • Loading branch information
DomenicoPerrottaJRC committed Jan 18, 2025
1 parent e1c7027 commit afb7a2d
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions toolbox/regression/LTSts.m
Original file line number Diff line number Diff line change
Expand Up @@ -1392,15 +1392,27 @@
end

% Check number of subsamples to extract
if options.nsamp>ncomb
nsamp_gt_ncomb = false;
if any(options.nsamp>ncomb)
nsamp_gt_ncomb = true;
if options.msg==true
disp('Number of subsets to extract greater than (n p). It is set to (n p)');
disp('Number of subsets to extract greater than (n p)');
end
options.nsamp=0;
elseif options.nsamp<0
error('FSDA:LTSts:WrongInput','Number of subsets to extract must be 0 (all) or a positive number');
end

% adjust nsamp if it is greater than (n p)
if nsamp_gt_ncomb
if isscalar(options.nsamp)
options.nsamp = ncomb;
disp(['It is reduced to (n p)=' num2str(ncomb)]);
elseif numel(options.nsamp) == 2
options.nsamp(1) = min(options.nsamp(1) , ncomb);
options.nsamp(2) = min(options.nsamp(2) , ncomb);
disp(['It is reduced to nsamp(1)=' num2str(options.nsamp(1)) ' and nsamp(2)=' num2str(options.nsamp(2))]);
end
end

h=floor(options.h); % Number of data points on which estimates are based

Expand Down Expand Up @@ -1512,8 +1524,7 @@
% vector.
LSH = lshift(:)';
% total number of subsets to pass to procedure subsets.
ncombLSH=bc(T-1-nummissing,pini+1);

ncombLSH = bc(T-1-nummissing,pini+1); %DDD
else
LSH=0;
ncombLSH=0;
Expand Down

0 comments on commit afb7a2d

Please sign in to comment.