How do you implement a Distributed lag model using fitlm?

2 次查看(过去 30 天)
Dear All,
I am trying to predict power production of PV generator using a MLR model but using lagged predictors and lagged dependent variable. Suppose my data table (tbl) is:
data Pac Tmod
____________________ ______ ______
01-Sep-2012 05:00:00 6.3 24.555
01-Sep-2012 06:00:00 27.917 28.338
01-Sep-2012 07:00:00 74.833 36.41
Then I construct lagged Pac and Tmod values using:
laggedPac=lagmatrix(tbl.Pac,[1 2]);
laggedTmod=lagmatrix(tbl.Tmod,[1,2]);
laggedPac=array2table(laggedPac,'VariableNames',{'Pac_lg1','Pac_lg2'});
laggedTmod=array2table(laggedTmod,'VariableNames',{'Tmod_lg1','Tmod_lg2'});
tbl=[tbl ,laggedPac ,laggedTmod];
Then I construct a MLR model using fitlm as follow (eventually using also 'RobustOpts'):
lm = fitlm(tbl,'Pac~Tmod+Pac_lg1+Tmod_lg1')
Is this the correct way to implement such a models?

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Analysis of Variance and Covariance 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by