Skip to content

Commit

Permalink
Incredible bug fixed: LTSts was not working without intercept. Check
Browse files Browse the repository at this point in the history
y = 3.14*(1:1000)' + 100*randn(1000,1);
out1_int    = LTSts(y,'intercept',true);
out1_noint0 = LTSts(y,'intercept',false);
  • Loading branch information
DomenicoPerrottaJRC committed Jan 11, 2025
1 parent 6fe8b56 commit e8c8e2b
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions toolbox/regression/LTSts.m
Original file line number Diff line number Diff line change
Expand Up @@ -2350,7 +2350,7 @@

% Store matrix B in table format (with labels for rows and columns)
if coder.target('MATLAB')
Btable=array2table(B,'RowNames',string(lab)','VariableNames',{'Coeff','SE','t','pval'});
Btable=array2table(B,'RowNames',string(lab(2-intercept:end,:))','VariableNames',{'Coeff','SE','t','pval'});
else
Btable=array2table(B,'VariableNames',{'Coeff','SE','t','pval'});
end
Expand Down Expand Up @@ -2946,8 +2946,13 @@
% to call this function to compute fitted values for the units specified in bsb
function obj=lik(beta0)

yhattrend=Xtrend(bsb,:)*beta0(1:trend+1);
npar=trend+1;
if intercept ==true
yhattrend=Xtrend(bsb,:)*beta0(1:trend+1);
npar=trend+1;
else
yhattrend=Xtrend(bsb,:)*beta0(2:trend+1);
npar=trend;
end

if seasonal >0
if seasonal<s/2
Expand Down

0 comments on commit e8c8e2b

Please sign in to comment.