How do you implement a Distributed lag model using fitlm?
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu Analysis of Variance and Covariance finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!