Linear regression model with fitlm

4 ビュー (過去 30 日間)
Marianna
Marianna 2018 年 8 月 7 日
コメント済み: Star Strider 2018 年 8 月 7 日
I have two arrays and I am doing a weighted correlation with the function fitlm.
If I write:
tbl = table(ones(9,1),a(:),b(:),'VariableNames',{'Weight','array1','array2'});
correlation = fitlm(tbl)
I get:
correlation =
Linear regression model: map2 ~ 1 + Weight + map1
Estimated Coefficients: Estimate SE tStat pValue ______ _____ ______ ______
(Intercept) 0.66696 0.24971 2.671 0.036979
Weight 0 0 NaN NaN
map1 -0.22041 0.39988 -0.55119 0.60141
Number of observations: 9, Error degrees of freedom: 7 Root Mean Squared Error: 0.292 R-squared: 0.0416, Adjusted R-Squared -0.0953 F-statistic vs. constant model: 0.304, p-value = 0.599
In correlation I can find almost all the values printed in the workspace, with the exeption of the p-value = 0.599
Why? Where is it and what is it?
Thank you.

採用された回答

Star Strider
Star Strider 2018 年 8 月 7 日
You may have to do a separate anova call to get it:
Anova = anova(correlation);
AnovaP = Anova.pValue(2);
That works for your model.
(I usually am interested in the coefficient statistics, that are generally easier to recover.)
  2 件のコメント
Marianna
Marianna 2018 年 8 月 7 日
That works, thank you.
Yes, my problem was to check the significance of the correlation.
Star Strider
Star Strider 2018 年 8 月 7 日
My pleasure.
If my Answer helped you solve your problem, please Accept it!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAnalysis of Variance and Covariance についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by