From e8c8e2b7d2514b5b4f5e8927bd7f789043003020 Mon Sep 17 00:00:00 2001 From: DomenicoPerrottaJRC Date: Sat, 11 Jan 2025 13:47:48 +0100 Subject: [PATCH] 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); --- toolbox/regression/LTSts.m | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/toolbox/regression/LTSts.m b/toolbox/regression/LTSts.m index 27f8fe401..dc741a036 100644 --- a/toolbox/regression/LTSts.m +++ b/toolbox/regression/LTSts.m @@ -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 @@ -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