Documentation Center |
Nonlinear regression model class
An object comprising training data, model description, diagnostic information, and fitted coefficients for a nonlinear regression. Predict model responses with the predict or feval methods.
nlm = fitnlm(tbl,modelfun,beta0) or nlm = fitnlm(X,y,modelfun,beta0) create a nonlinear model of a table or dataset array tbl, or of the responses y to a data matrix X. For details, see fitnlm.
CoefficientCovariance |
Covariance matrix of coefficient estimates. | ||||||||||||
CoefficientNames |
Cell array of strings containing a label for each coefficient. | ||||||||||||
Coefficients |
Coefficient values stored as a table. Coefficients has one row for each coefficient and these columns:
To obtain any of these columns as a vector, index into the property using dot notation. For example, in mdl the estimated coefficient vector is beta = mdl.Coefficients.Estimate Use coefTest to perform other tests on the coefficients. | ||||||||||||
Diagnostics |
Table with diagnostics helpful in finding outliers and influential observations. The table contains the following fields.
| ||||||||||||
DFE |
Degrees of freedom for error (residuals), equal to the number of observations minus the number of estimated coefficients. | ||||||||||||
Fitted |
Vector of predicted values based on the training data. fitnlm attempts to make Fitted as close as possible to the response data. | ||||||||||||
Formula |
Object that represents the mathematical form of the model. | ||||||||||||
Iterative |
Structure with information about the fitting process. Fields:
| ||||||||||||
LogLikelihood |
Log likelihood of the model distribution at the response values, with mean fitted from the model, and other parameters estimated as part of the model fit. | ||||||||||||
ModelCriterion |
AIC and other information criteria for comparing models. A structure with fields:
To obtain any of these values as a scalar, index into the property using dot notation. For example, in a model mdl, the AIC value aic is: aic = mdl.ModelCriterion.AIC | ||||||||||||
MSE |
Mean squared error, a scalar that is an estimate of the variance of the error term in the model. | ||||||||||||
NumCoefficients |
Number of coefficients in the fitted model, a scalar. NumCoefficients is the same as NumEstimatedCoefficients for NonLinearModel objects. NumEstimatedCoefficients is equal to the degrees of freedom for regression. | ||||||||||||
NumEstimatedCoefficients |
Number of estimated coefficients in the fitted model, a scalar. NumEstimatedCoefficients is the same as NumCoefficients for NonLinearModel objects. NumEstimatedCoefficients is equal to the degrees of freedom for regression. | ||||||||||||
NumPredictors |
Number of variables fitnlm used as predictors for fitting. | ||||||||||||
NumVariables |
Number of variables in the data. NumVariables is the number of variables in the original table or dataset, or the total number of columns in the predictor matrix and response vector when the fit is based on those arrays. It includes variables, if any, that are not used as predictors or as the response. | ||||||||||||
ObservationInfo |
Table with the same number of rows as the input data (tbl or X).
| ||||||||||||
ObservationNames |
Cell array of strings containing the names of the observations used in the fit.
| ||||||||||||
PredictorNames |
Cell array of strings, the names of the predictors used in fitting the model. | ||||||||||||
Residuals |
Table of residuals, with one row for each observation and these variables.
To obtain any of these columns as a vector, index into the property using dot notation. For example, in a model mdl, the ordinary raw residual vector r is: r = mdl.Residuals.Raw Rows not used in the fit because of missing values (in ObservationInfo.Missing) contain NaN values. Rows not used in the fit because of excluded values (in ObservationInfo.Excluded) contain NaN values, with the following exceptions:
| ||||||||||||
ResponseName |
String giving naming the response variable. | ||||||||||||
RMSE |
Root mean squared error, a scalar that is an estimate of the standard deviation of the error term in the model. | ||||||||||||
Robust |
Structure that is empty unless fitnlm constructed the model using robust regression.
| ||||||||||||
Rsquared |
Proportion of total sum of squares explained by the model. The ordinary R-squared value relates to the SSR and SST properties: Rsquared = SSR/SST = 1 - SSE/SST. Rsquared is a structure with two fields:
To obtain any of these values as a scalar, index into the property using dot notation. For example, the adjusted R-squared value in mdl is r2 = mdl.Rsquared.Adjusted | ||||||||||||
SSE |
Sum of squared errors (residuals). The Pythagorean theorem implies SST = SSE + SSR. | ||||||||||||
SSR |
Regression sum of squares, the sum of squared deviations of the fitted values from their mean. The Pythagorean theorem implies SST = SSE + SSR. | ||||||||||||
SST |
Total sum of squares, the sum of squared deviations of y from mean(y). The Pythagorean theorem implies SST = SSE + SSR. | ||||||||||||
VariableInfo |
Table containing metadata about Variables. There is one row for each term in the model, and the following columns.
| ||||||||||||
VariableNames |
Cell array of strings containing names of the variables in the fit.
| ||||||||||||
Variables |
Table containing the data, both observations and responses, that the fitting function used to construct the fit. If the fit is based on a table or dataset array, Variables contains all of the data from that table or dataset array. Otherwise, Variables is a table created from the input data matrix X and response vector y. |
coefCI | Confidence intervals of coefficient estimates of nonlinear regression model |
coefTest | Linear hypothesis test on nonlinear regression model coefficients |
disp | Display nonlinear regression model |
feval | Evaluate nonlinear regression model prediction |
fit | Fit nonlinear regression model |
plotDiagnostics | Plot diagnostics of nonlinear regression model |
plotResiduals | Plot residuals of nonlinear regression model |
plotSlice | Plot of slices through fitted nonlinear regression surface |
predict | Predict response of nonlinear regression model |
random | Simulate responses for nonlinear regression model |
The hat matrix H is defined in terms of the data matrix X and the Jacobian matrix J:
Here f is the nonlinear model function, and β is the vector of model coefficients.
The Hat Matrix H is
H = J(J^{T}J)^{–1}J^{T}.
The diagonal elements H_{ii} satisfy
where n is the number of observations (rows of X), and p is the number of coefficients in the regression model.
The leverage of observation i is the value of the ith diagonal term, h_{ii}, of the hat matrix H. Because the sum of the leverage values is p (the number of coefficients in the regression model), an observation i can be considered to be an outlier if its leverage substantially exceeds p/n, where n is the number of observations.
The Cook's distance D_{i} of observation i is
where
is the jth fitted response value.
is the jth fitted response value, where the fit does not include observation i.
MSE is the mean squared error.
p is the number of coefficients in the regression model.
Cook's distance is algebraically equivalent to the following expression:
where e_{i} is the ith residual.
Value. To learn how value classes affect copy operations, see Copying Objects in the MATLAB^{®} documentation.
fitnlm | GeneralizedLinearModel | LinearModel | nlinfit | NonLinearModel.predict