Linear regression model with fitlm

4 Ansichten (letzte 30 Tage)
Marianna
Marianna am 7 Aug. 2018
Kommentiert: Star Strider am 7 Aug. 2018
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.

Akzeptierte Antwort

Star Strider
Star Strider am 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 Kommentare
Marianna
Marianna am 7 Aug. 2018
That works, thank you.
Yes, my problem was to check the significance of the correlation.
Star Strider
Star Strider am 7 Aug. 2018
My pleasure.
If my Answer helped you solve your problem, please Accept it!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Analysis of Variance and Covariance finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by