Categories &

Functions List

Function Reference: statset

statistics: options = statset ()
statistics: options = statset (funcname)
statistics: options = statset (name, value, …)
statistics: options = statset (oldopts, name, value, …)
statistics: options = statset (oldopts, newopts)
statistics: statset ()

Create or modify an options structure for iterative statistics algorithms.

options = statset () returns a structure carrying every recognized option name, each set to an empty value. An empty option means "use the calling function's own default", so an all-empty structure changes nothing wherever it is passed.

options = statset (funcname) returns the options that funcname uses by default, with the remaining fields left empty. funcname must name a function of this package that documents an "Options" argument; see the list below. Unlike the name/value forms, this form takes no further arguments.

options = statset (name, value, …) returns an otherwise empty structure with the named options set. Option names are matched case-insensitively and must be given in full.

options = statset (oldopts, name, value, …) copies oldopts and applies the given name/value pairs to the copy. oldopts is left unchanged.

options = statset (oldopts, newopts) merges two structures: every non-empty field of newopts overrides its counterpart in oldopts, while an empty field of newopts leaves the oldopts value in place. Fields that are not recognized option names are ignored in both structures.

statset () called with no output argument displays the recognized option names together with their permitted values, marking each default in braces.

The recognized options are:

OptionDescription
"Display"Level of reporting: "off", "final", or "iter".
"MaxFunEvals"Maximum number of objective function evaluations, a positive scalar.
"MaxIter"Maximum number of iterations, a positive scalar.
"TolBnd"Positive scalar tolerance on parameter bounds.
"TolFun"Positive scalar tolerance on the objective function value.
"TolTypeFun"Whether "TolFun" is absolute, "abs", or relative, "rel".
"TolX"Positive scalar tolerance on the parameters.
"TolTypeX"Whether "TolX" is absolute, "abs", or relative, "rel".
"GradObj"Whether the objective function returns a gradient, "off" or "on".
"Jacobian"Whether the model function returns a Jacobian, "off" or "on".
"DerivStep"Relative step size for finite-difference derivatives, a positive scalar or vector.
"FunValCheck"Whether to check the objective function for invalid values, "off" or "on".
"Robust"Whether to invoke a robust fit, "off" or "on". Superseded by "RobustWgtFun".
"RobustWgtFun"Weight function for robust fitting: one of "andrews", "bisquare", "cauchy", "fair", "huber", "logistic", "talwar", "welsch", a function handle, or empty for a non-robust fit.
"WgtFun"Weight function used with "Robust". Superseded by "RobustWgtFun".
"Tune"Positive tuning constant for the robust weight function. Set automatically for a named weight function; required for a function handle.
"UseParallel"Logical flag requesting parallel computation.
"UseSubstreams"Logical flag requesting reproducible random substreams.
"Streams"A random stream or a cell array of them.
"OutputFcn"A function handle, or a cell array of them, called after each iteration.

Source Code: statset

funcname may name any of the following functions, each of which documents an "Options" argument: copulafit, coxphfit, crossval, evfit, factoran, fitcox, fitglm, fitglme, fitlme, fitlmematrix, fitnlm, gamfit, gevfit, glmfit, gmdistribution, gpfit, kmeans, kmedoids, lasso, lassoglm, lognfit, mdscale, mlecov, mlecustom, mvncdf, mvtcdf, nbinfit, nlinfit, nnmf, normfit, pca, plsregress, ppca, rocmetrics, tsne, wblfit, GeneralizedLinearMixedModel, and LinearMixedModel.

Any function accepting an "Options" argument also accepts a plain structure carrying only the fields it needs, so statset is a convenience rather than a requirement.

MATLAB’s statset additionally accepts the names of functions this package does not provide. Those names are rejected here rather than answered, since returning options for an absent function would assert a capability that does not exist.

See also: statget, nlinfit, fitnlm, nnmf, mdscale, ppca, tsne, kmedoids

Source Code: statset

The default options of a given function

 options = statset ('nlinfit')
options =

  scalar structure containing the fields:

    Display = off
    MaxFunEvals = [](0x0)
    MaxIter = 200
    TolBnd = [](0x0)
    TolFun = 1.0000e-08
    TolTypeFun = [](0x0)
    TolX = 1.0000e-08
    TolTypeX = [](0x0)
    GradObj = [](0x0)
    Jacobian = [](0x0)
    DerivStep = 6.0555e-06
    FunValCheck = on
    Robust = off
    RobustWgtFun = [](0x0)
    WgtFun = bisquare
    Tune = [](0x0)
    UseParallel = [](0x0)
    UseSubstreams = [](0x0)
    Streams = {}(0x0)
    OutputFcn = [](0x0)

Raise the iteration limit of an existing options structure

 options = statset ('nlinfit');
 options = statset (options, 'MaxIter', 500);
 [options.MaxIter, options.TolFun]
ans =

   5.0000e+02   1.0000e-08