Effacer les filtres
Effacer les filtres

Fitlm results not obtainable

29 vues (au cours des 30 derniers jours)
John Good
John Good le 30 Nov 2020
Commenté : Walter Roberson le 1 Déc 2020
When I try to run the equation with two variables, one 83x370 (Rdec) and the other 83x8 (F) I get this error:
>> mdl=fitlm(F,Rdec)
Error using classreg.regr.FitObject/selectVariables (line 351)
Response variable must be a numeric vector.
Error in classreg.regr.TermsRegression/selectVariables (line 259)
model = selectVariables@classreg.regr.ParametricRegression(model);
Error in classreg.regr.FitObject/doFit (line 91)
model = selectVariables(model);
Error in LinearModel.fit (line 1043)
model = doFit(model);
Error in fitlm (line 121)
model = LinearModel.fit(X,varargin{:});
I have NaN values in my 83x370 but cant remove them whilst maitining the shape of the matrix. I have loaded the F and Rdec as numeric matrixes. Any help would be appreciated.
  4 commentaires
John Good
John Good le 30 Nov 2020
My F is my factor data of managers of 83 funds. My Rdec is the fund returns over 25 years for those 83 funds
Jeff Miller
Jeff Miller le 1 Déc 2020
What are the 370 variables in Rdec? Are these fund returns at various time points within the 25 years?

Connectez-vous pour commenter.

Réponses (1)

Walter Roberson
Walter Roberson le 30 Nov 2020
The response variable must be a vector . Not a matrix.
If your intention is that you want to fit the 370 different responses for the same data, then you need to do so one response (column) at a time.
  4 commentaires
Jeff Miller
Jeff Miller le 1 Déc 2020
I think your 'for' loop would basically work, assuming 'i' would go from 1 to 370 (though I'm not sure what these 370 represent).
However, I would think that you would want to save coefficients for all 8 factors, not just the first one.
Given what you want to do, it seems to me that your best bet is to form some kind of composite measure of fund performance combining across all 370 variables, and then just look at a single regression predicting that composite from your 8 fund manager factors.
Walter Roberson
Walter Roberson le 1 Déc 2020
The loop looks plausible.

Connectez-vous pour commenter.

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by