fitlm on timetable: error message

5 ビュー (過去 30 日間)
alpedhuez
alpedhuez 2018 年 6 月 8 日
コメント済み: Walter Roberson 2018 年 6 月 8 日
I try to run fitlm on a time table. I checked dependent and independent variables and got following outputs
ans =
2.5017
1.8388
1.8418
2.0561
5.0655
ans =
17.4631
19.5389
16.5552
15.0083
11.4510
But when I try to run fitlm, I got a following error message:
Error using classreg.regr.FormulaProcessor (line 384)
The model formula contains names not recognized as predictor or response names.
Error in classreg.regr.LinearFormula (line 48)
f = f@classreg.regr.FormulaProcessor(varargin{:});
Error in classreg.regr.TermsRegression.createFormula (line 699)
formula = classreg.regr.LinearFormula(modelDef,varNames,'',intercept,link);
Error in LinearModel.createFormula (line 1388)
formula = classreg.regr.TermsRegression.createFormula(supplied,modelDef, ...
Error in LinearModel.fit (line 1224)
model.Formula = LinearModel.createFormula(supplied,modelDef,X, ...
Error in fitlm (line 121)
model = LinearModel.fit(X,varargin{:});
Error in AAA (line 247)
lm2 = fitlm(T,'VAR1~VAR2');
Please advise.
  3 件のコメント
Walter Roberson
Walter Roberson 2018 年 6 月 8 日
What are the names of the variables in the timetable ?
alpedhuez
alpedhuez 2018 年 6 月 8 日
VAR1 and VAR2

サインインしてコメントする。

採用された回答

Walter Roberson
Walter Roberson 2018 年 6 月 8 日
fitlm() specifically tests for table objects, and timetables are not tables. fitlm is defined for tables, datasets, numeric arrays, and tall arrays, but not defined for timetables.
You can use timetable2table() to convert your timetable for use with fitlm.
  2 件のコメント
alpedhuez
alpedhuez 2018 年 6 月 8 日
Should be fixed in the future release.
Walter Roberson
Walter Roberson 2018 年 6 月 8 日
You can file an enhancement request. It is not a bug because not all methods that apply to tables also apply to timetables.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeTables についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by