NonLinearModel
statistics: mdl = NonLinearModel (…)
Nonlinear regression model class.
A NonLinearModel object holds a nonlinear regression fitted by
fitnlm, together with its coefficients, fit statistics, and methods
for inference, prediction, and diagnostics. Construct one with
fitnlm, which documents the accepted inputs and
Name/Value pairs.
The estimated coefficients and their statistics are in the
Coefficients table; Rsquared, ModelCriterion,
LogLikelihood, RMSE, SSE, SST, and SSR
summarize the fit. The methods predict, feval, random,
coefCI, coefTest, plotResiduals, plotDiagnostics,
and plotSlice operate on the fitted model.
The fit statistics follow MATLAB’s conventions. SSE is the residual
sum of squares, SST the total sum of squares of the response about its
(weighted) mean, and SSR the regression sum of squares of the fitted
values about that mean; because the model is nonlinear, SST does
not in general equal SSR + SSE. Rsquared.Ordinary is
1 - SSE / SST and Rsquared.Adjusted corrects for
the error degrees of freedom. RMSE is sqrt (MSE), and
the Gaussian LogLikelihood uses the maximum-likelihood error variance
SSE / n. The information criteria in ModelCriterion
(AIC, AICc, BIC, CAIC) count the
coefficients as the only parameters – the error variance is not
counted. coefTest is a Wald test: for a contrast matrix H it
forms (H*b)' * inv (H*V*H') * (H*b) / r
with V the coefficient covariance and the number of rows of
H, referred to an distribution on and DFE
degrees of freedom. The summary printed by disp instead reports an
statistic versus the zero model, formed from the uncorrected
regression sum of squares (the sum of the squared fitted values).
See also: fitnlm, nlinfit, nlparci, nlpredci, LinearModel, GeneralizedLinearModel
Source Code: NonLinearModel
Fit an exponential growth model y = b1 exp (b2 x) and inspect it.
x = (1:10)'; y = [2.1; 2.9; 4.2; 5.3; 7.1; 9.4; 12.8; 16.5; 22.1; 29.8]; modelfun = @(b, x) b(1) .* exp (b(2) .* x); mdl = fitnlm (x, y, modelfun, [1; 0.3]); disp (mdl.Coefficients)
2x4 table
Estimate SE tStat pValue
________ __________ _______ ___________
b1 1.68375 0.0351945 47.8412 4.03037e-11
b2 0.286911 0.00235084 122.046 2.27082e-14
printf ("RMSE = %g, R^2 = %g\n", mdl.RMSE, mdl.Rsquared.Ordinary);
RMSE = 0.170943, R^2 = 0.999689