How to export coefficients names when using rstool?
5 ビュー (過去 30 日間)
古いコメントを表示
Rafael Schwarzenegger
2018 年 10 月 3 日
コメント済み: Rafael Schwarzenegger
2018 年 10 月 8 日
Hello,
if I use
Rstool(X,Y,'purequadratic');
it is possible to extract the values of the coefficients by
stats = regstats(Y,X,'purequadratic');
stats.beta
How is it possible to obtain the coefficients names please?
Best regards,
Rafael
0 件のコメント
採用された回答
dpb
2018 年 10 月 3 日
編集済み: dpb
2018 年 10 月 3 日
Real issue with the Matlab user interface for most of the Curve Fitting and Statistics Toolbox stuff -- frequently it is very difficult to get the information back out in human-legible format.
AFAIK, the only way to get the model associated with the numbers is by actually fitting the linear model object and getting the info from it...afaict, while rstool has to have built it internally, there's no way to actually export it from the GUI.
lm=fitlm(X,Y,'purequadratic');
will leave you with the linear model object lm and in it are
>> lm.CoefficientNames
ans =
1×7 cell array
{'(Intercept)'} {'x1'} {'x2'} {'x3'} {'x1^2'} {'x2^2'} {'x3^2'}
>> lm.Formula
ans =
y ~ 1 + x1 + x2 + x3 + x1^2 + x2^2 + x3^2
>>
>> lm.disp
Linear regression model:
y ~ 1 + x1 + x2 + x3 + x1^2 + x2^2 + x3^2
Estimated Coefficients:
Estimate SE tStat pValue
__________ __________ ________ __________
(Intercept) 68.813 11.517 5.9749 5.0652e-08
x1 -0.0089158 0.0062355 -1.4299 0.15638
x2 -0.26388 0.10866 -2.4285 0.017246
x3 -0.43451 0.97939 -0.44365 0.65841
x1^2 7.5652e-07 9.3838e-07 0.8062 0.42235
x2^2 0.00062257 0.00033999 1.8311 0.070547
x3^2 0.0039153 0.030748 0.12733 0.89897
Number of observations: 93, Error degrees of freedom: 86
Root Mean Squared Error: 3.94
R-squared: 0.777, Adjusted R-Squared 0.762
F-statistic vs. constant model: 50, p-value = 5.51e-26
and the coefficients will be the same as those computed independently and returned in regstats.
Having the .disp output table is indeed useful, but that there are all these other methods that do bits and pieces and give only those is very redundant and confusing to use -- and that the GUIs don't export the whole model but just bits 'n pieces in disjointed fashion has always been and remains mind-boggling as to "why?" they were so designed/implemented.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Programmatic Model Editing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!