Linear regression model with fitlm
4 views (last 30 days)
Show older comments
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.
0 Comments
Accepted Answer
Star Strider
on 7 Aug 2018
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 Comments
Star Strider
on 7 Aug 2018
My pleasure.
If my Answer helped you solve your problem, please Accept it!
More Answers (0)
See Also
Categories
Find more on Analysis of Variance and Covariance in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!