Categories &

Functions List

Function Reference: gampredict

statistics: yFit = gampredict (Parameters, X, Intercept)
statistics: score = gampredict (Parameters, X, Intercept, Link)

Evaluate a generalized additive model on new data.

yFit = gampredict (Parameters, X, Intercept) adds the intercept to the sum of the additive terms evaluated at each row of X and returns the Nx1 result. It is the prediction engine shared by ClassificationGAM and RegressionGAM, and it is not meant to be called directly.

  • Parameters is a 1xP structure array of piecewise polynomials, as returned by gamtrain in the field of the same name.
  • X is an NxP numeric matrix with one column per additive term, and a count that does not match is an error. A model carrying interaction terms must therefore be given the augmented matrix, not the predictors alone. A missing value predicts NaN, since no term of the model is defined at it. A value outside the range the term was fitted over is extrapolated from the nearest piece, as ppval extrapolates.
  • Intercept is the model’s constant term.
  • Link, if given, selects what the additive prediction is mapped through: 0 returns it as it stands and 1 takes it as a log-odds, returning the Nx2 matrix of class probabilities whose second column is the logistic function of it. The default is 0.

See also: gamtrain, ClassificationGAM, RegressionGAM, fitcgam, fitrgam

Source Code: gampredict