How do you implement a Distributed lag model using fitlm?
3 ビュー (過去 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 件のコメント
回答 (0 件)
参考
カテゴリ
Help Center および File 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!