Fitlm results not obtainable
조회 수: 18 (최근 30일)
이전 댓글 표시
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
Jeff Miller
2020년 12월 1일
What are the 370 variables in Rdec? Are these fund returns at various time points within the 25 years?
답변 (1개)
Walter Roberson
2020년 11월 30일
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
Jeff Miller
2020년 12월 1일
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.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!