Extract model's p-value from fitnlm

Dear all,
I am using the Statistical Toolbox (Matlab2013b) to perform a regression analysis. Using apply different regression functions to my dataset (linear,quadratic,exponential) using "fitnlm". I want to choose the best function based on R^2 and p-value. The R^2 is found in the model's output fields. The overall p-value I can't find though it is displayed in the command window: Nonlinear regression model, e.g.:
y ~ b1*x1^2 + b2*x1 + b3
Estimated Coefficients:
Estimate SE tStat pValue
b1 0.02495 0.010583 2.3575 0.027708
b2 -0.75062 1.0529 -0.71294 0.48337
b3 14.633 24.854 0.58877 0.56201
Number of observations: 25, Error degrees of freedom: 22 Root Mean Squared Error: 8.27 R-Squared: 0.897, Adjusted R-Squared 0.887 F-statistic vs. constant model: 95.5, p-value = 1.43e-11
My tool should extract the model p-value = 1.43e-11 automatically (not the individual coefficients' pValue in the table). How can I do this?
Thanks!

 Réponse acceptée

Bennett Landman
Bennett Landman le 1 Août 2018

0 votes

In 2016a, this information is accessible via: mdl.Coefficients.pValue (assuming that mdl is the structure returned by fitnlm).

Plus de réponses (2)

dpb
dpb le 14 Avr 2014

0 votes

My release doesn't include fitnlm so can't test but doc page indicates that you can recompute the p-values of the various statistics via the coeftest method although the value doesn't seem to be returned as a property.

1 commentaire

Steven
Steven le 14 Avr 2014
Correct, the coefTest function calculates the p-value as well. The outcome is slightly different though. Probably a different approach is used. I think I'll just use the coefTest.

Connectez-vous pour commenter.

the cyclist
the cyclist le 14 Avr 2014

0 votes

It seems to me from the documentation that the p-value is not an output.
The F-test calculation is in the file NonLinearModel.m. [Lines 800-834 is the ftest() function in R2014a.] I haven't checked, but it looks like you might be able to reconstruct the p-value from the other outputs.

2 commentaires

Steven
Steven le 14 Avr 2014
Thank you for the help! How can I open this NonLinearModel.m file?
Type
edit NonLinearModel
at the command prompt
(Be careful not to make changes. You might want to copy that another file.)

Connectez-vous pour commenter.

Community Treasure Hunt

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

Start Hunting!

Translated by