regression analysis of lagged days
11 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Keran
le 26 Juil 2020
Commenté : Keran
le 26 Juil 2020
Hi,
I'm quite new with matlab and I need help with one thing. I want to make regression analysis where dependent variable is premium of day and independent is premium at day t-1 and so on. I can only regress one day lag but not further. I couldn'tdo this with fitlm. Below is my regression but when running there's an error: Error in LinearModel.fit (line 1224)
model.Formula =
LinearModel.createFormula(supplied,modelDef,X, ...
Error in fitlm (line 121)
model = LinearModel.fit(X,varargin{:});
pdpersistency1=fitlm(pd(1:1268,1), pd(2:1269,1), pd(3:1270,1))
0 commentaires
Réponse acceptée
Thiago Henrique Gomes Lobato
le 26 Juil 2020
Your first argument should be a matrix with all the variables you need for prediction. So, in your case, you need to form a matrix with both time lags. Ex:
pd = randn(100,1); % Your data
pdpersistency1=fitlm([pd(1:end-2),pd(2:end-1)],pd(3:end))
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Regression dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!