Borrar filtros
Borrar filtros

Fitlm results not obtainable

29 visualizaciones (últimos 30 días)
John Good
John Good el 30 de Nov. de 2020
Comentada: Walter Roberson el 1 de Dic. de 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 comentarios
John Good
John Good el 30 de Nov. de 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 el 1 de Dic. de 2020
What are the 370 variables in Rdec? Are these fund returns at various time points within the 25 years?

Iniciar sesión para comentar.

Respuestas (1)

Walter Roberson
Walter Roberson el 30 de Nov. de 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 comentarios
Jeff Miller
Jeff Miller el 1 de Dic. de 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 el 1 de Dic. de 2020
The loop looks plausible.

Iniciar sesión para comentar.

Categorías

Más información sobre Dimensionality Reduction and Feature Extraction en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by