How can I get F and p-value after regression?

After using the command lsline I got the the regression line that I wanted! But How can I see the statistics of the regression?How do I get the F and P-values?

 Accepted Answer

The lsline function does not give you any information on the fit.
It even takes a bit of effort to get the slope and intercept:
figure(1)
scatter(1:10, rand(1, 10))
hl = lsline;
B = [ones(size(hl.XData(:))), hl.XData(:)]\hl.YData(:);
Slope = B(2)
Intercept = B(1)
You need to use the Statistics and Machine Learning Toolbox regress function to get the information you want.

5 Comments

Panos Ale
Panos Ale on 13 Jun 2017
Edited: Panos Ale on 13 Jun 2017
Is this toolbox implanted in matlab R215A(which I have) or I have to download it?
You need to pay for it first. It is not part of basic MATLAB. Or you can do the computations yourself. But that requires an understanding of those computations.
@John — Thank you.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!