Linear regression model with fitlm

4 visualizaciones (últimos 30 días)
Marianna
Marianna el 7 de Ag. de 2018
Comentada: Star Strider el 7 de Ag. de 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.

Respuesta aceptada

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

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Analysis of Variance and Covariance en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by