fitnlm w/ table using not all Variables

3 ビュー (過去 30 日間)
Benedict Kriegler
Benedict Kriegler 2015 年 12 月 10 日
コメント済み: Benedict Kriegler 2015 年 12 月 14 日
Hello,
I am looking for a way to specify a modelfun for a non linear regression, using fitnlm, without using all Variables of the table. mdl = fitnlm(tbl,modelfun,beta0) Is it somehow possible to specify a modelfun by using the VariableNames of the table including the response variable?
I already performed the regression with a new table, containing the relevant variables only, but i would like to filter the table by other variables and i would like to prevent from double storage of large datasets.
Thanks in advance,
Benedict

採用された回答

Tom Lane
Tom Lane 2015 年 12 月 13 日
You can specify modelfun using variable names:
load carsmall
t = table(MPG,Weight,Origin)
nlm = fitnlm(t,'MPG~b1+b2*Weight^b3',[1 1 1])
In this case the property nlm.Data will contain all the variables in the table, including Origin. However, you could pass in just the part of the table you need:
nlm = fitnlm(t(:,{'MPG' 'Weight'}),'MPG~b1+b2*Weight^b3',[1 1 1])
  1 件のコメント
Benedict Kriegler
Benedict Kriegler 2015 年 12 月 14 日
Thanks, it's working fine.

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

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by