How to get the p-value as an output of fitlm?
20 views (last 30 days)
Show older comments
Casey Jemima Shepheard
on 28 Oct 2016
Commented: Star Strider
on 28 Oct 2016
Hi,
I'm trying to isolate the p-value from the output of the fitlm function, to put into a table. I have 180 regressions to get the p-value for, so manually copying and pasting isn't practical.
I have managed to do this for the R-squared value using the following:
mdl = fitlm(x,y);
p_val = mdl.squared.Ordinary;
Does anyone know how to do the same for the p-value?
Thanks!
0 Comments
Accepted Answer
Star Strider
on 28 Oct 2016
Try this:
p_val = mdl.Coefficients.pValue;
That will give you the p-values of the coefficients (from the t-statistic).
2 Comments
More Answers (0)
See Also
Categories
Find more on Linear Regression 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!