Skip to content

Commit e8c8e2b

Browse files
Incredible bug fixed: LTSts was not working without intercept. Check
y = 3.14*(1:1000)' + 100*randn(1000,1); out1_int = LTSts(y,'intercept',true); out1_noint0 = LTSts(y,'intercept',false);
1 parent 6fe8b56 commit e8c8e2b

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

toolbox/regression/LTSts.m

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2350,7 +2350,7 @@
23502350

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

2949-
yhattrend=Xtrend(bsb,:)*beta0(1:trend+1);
2950-
npar=trend+1;
2949+
if intercept ==true
2950+
yhattrend=Xtrend(bsb,:)*beta0(1:trend+1);
2951+
npar=trend+1;
2952+
else
2953+
yhattrend=Xtrend(bsb,:)*beta0(2:trend+1);
2954+
npar=trend;
2955+
end
29512956

29522957
if seasonal >0
29532958
if seasonal<s/2

0 commit comments

Comments
 (0)