When using Matlab regress() function, the F-test and its p-value tells how good the regression is:
Quoting from this site:
“The F test is used to test the significance of R, which is the same as testing the significance of R2, which is the same as testing the significance of the regression model as a whole. If prob(F) < .05, then the model is considered significantly better than would be expected by chance and we reject the null hypothesis of no linear relationship of y to the independents. F is a function of R2, the number of independents, and the number of cases. F is computed with k and (n – k – 1) degrees of freedom, where k = number of terms in the equation not counting the constant.
F = [R2/k]/[(1 - R2 )/(n - k - 1)]. Alternatively, F is the ratio of mean square for the model (labeled Regression) divided by mean square for error (labeled Residual), where the mean square are the respective sums of squares divided by the degrees of freedom. Thus in the figure below, F = 16.129/2.294 = 7.031.”