FUNCTION REFERENCE
predict
Predict responses from a fitted regression model or labels and scores from a classifier.
Predict responses from a fitted regression model or labels and scores from a classifier.
Syntax
ypred = predict(mdl,Xnew); [ypred,yci] = predict(mdl,Xnew); ypred = predict(mdl,tbl)Syntax
label = predict(mdl,Xnew); [label,score] = predict(mdl,Xnew); [label,score] = predict(mdl,tbl)Regression (LinearModel, GeneralizedLinearModel): matrix columns match the original predictor order; table predictors are matched by name and unused variables may be omitted. The second output has lower and upper 95 percent confidence bounds for the mean response; linear and normal GLM models use Student's t, binomial and poisson models use normal bounds on the linear predictor transformed through the inverse link. Classifiers: score columns follow mdl.ClassNames; prediction tables select numeric columns by mdl.PredictorNames, in any order.
Example
mdl=fitlm([0;1;2;3;4],[1;3;4;8;9]); [ypred,yci]=predict(mdl,[1.5;2.5])Differences from MATLAB: only the two positional arguments are supported; no Alpha, simultaneous bounds or observation prediction intervals. Rank deficient regression models return NaN confidence intervals. Partitioned classifiers use kfoldPredict; other model types raise a named unsupported-model error.
Identified models: yp = predict(sys, data, k) returns the k-step-ahead prediction (default k = 1, Inf = simulation) of an idpoly, idtf, idss or idproc model as an iddata object, with zero initial conditions (yhat = y - Hk(q) e, Hk the first k terms of the noise model).
These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.