Create statistics options structure


options = statset(...)
options = statset(fieldname1,val1,fieldname2,val2,...)
options = statset(oldopts,fieldname1,val1,fieldname2,val2,...)
options = statset(oldopts,newopts)


statset with no input arguments and no output arguments displays all fields of a statistics options structure and their possible values.

statset(statfun) displays fields and default values used by the Statistics and Machine Learning Toolbox™ function statfun. Specify statfun using a string name or a function handle.

options = statset(...) creates a statistics options structure options. With no input arguments, all fields of the options structure are an empty array ([]). With a specified statfun, function-specific fields are default values and the remaining fields are []. Function-specific fields set to [] indicate that the function is to use its default value for that parameter. For available options, see Inputs.

options = statset(fieldname1,val1,fieldname2,val2,...) creates an options structure in which the named fields have the specified values. Any unspecified values are []. Use strings for field names. For fields that are string-valued, you must input the complete string for the value. If you provide an invalid string for a value, statset uses the default.

options = statset(oldopts,fieldname1,val1,fieldname2,val2,...) creates a copy of oldopts with the named parameters changed to the specified values.

options = statset(oldopts,newopts) combines an existing options structure, oldopts, with a new options structure, newopts. Any parameters in newopts with nonempty values overwrite corresponding parameters in oldopts.

Input Arguments


Relative difference used in finite difference derivative calculations. A positive scalar, or a vector of positive scalars the same size as the vector of parameters estimated by the Statistics and Machine Learning Toolbox function using the options structure.


Amount of information displayed by the algorithm.

  • 'off' — Displays no information.

  • 'final' — Displays the final output.

  • 'iter' — Displays iterative output to the command window for some functions; otherwise displays the final output.


Check for invalid values, such as NaN or Inf, from the objective function.

  • 'off'

  • 'on'


Flags whether the objective function returns a gradient vector as a second output.

  • 'off'

  • 'on'


Flags whether the objective function returns a Jacobian as a second output.

  • 'off'

  • 'on'


Maximum number of objective function evaluations allowed. Positive integer.


Maximum number of iterations allowed. Positive integer.


The solver calls all output functions after each iteration.

  • Function handle specified using @

  • a cell array with function handles

  • an empty array (default)


Invoke robust fitting option.

  • 'off'

  • 'on'

Robust will be removed in a future software release. Use RobustWgtFun for robust fitting.


Weight function for robust fitting. Can also be a function handle that accepts a normalized residual as input and returns the robust weights as output. If you use a function handle, give a Tune constant. See Robust Options.


A single instance of the RandStream class, or a cell array of RandStream instances. The Streams option is accepted by some functions to govern what stream(s) to use in generating random numbers within the function. If 'UseSubstreams' is true, the Streams value must be a scalar, or must be empty. If 'UseParallel' is true and 'UseSubstreams' is false, then the Streams argument must either be empty, or its length must match the number of processors used in the computation: equal to the parpool size if a parpool is open, a scalar otherwise.


Parameter bound tolerance. Positive scalar.


Termination tolerance for the objective function value. Positive scalar.


Use TolFun for absolute or relative objective function tolerances.

  • 'abs'

  • 'rel'


Use TolX for absolute or relative parameter tolerances.

  • 'abs'

  • 'rel'


Termination tolerance for the parameters. Positive scalar.


Tuning constant used in robust fitting to normalize the residuals before applying the weight function. The default value depends upon the weight function. This parameter is necessary if you specify the weight function as a function handle. Positive scalar. See Robust Options.


Flag indicating whether eligible functions should use capabilities of the Parallel Computing Toolbox™ (PCT), if the capabilities are available. That is, if the PCT is installed, and a PCT parpool is in effect. Valid values are false (the default), for serial computation, and true, for parallel computation.


Flag indicating whether the random number generator in eligible functions should use Substream property of the RandStream class. false (default) or true. When true, high level iterations within the function will set the Substream property to the value of the iteration. This behavior helps to generate reproducible random number streams in parallel and/or serial mode computation.


Weight function for robust fitting. Valid only when Robust is 'on'. Can also be a function handle that accepts a normalized residual as input and returns the robust weights as output. See Robust Options.

WgtFun will be removed in a future software release. Use RobustWgtFun instead.


Suppose you want to change the default parameter values for the function evfit, which fits an extreme value distribution to data. The defaults parameter values are:

ans = 
          Display: 'off'
      MaxFunEvals: []
          MaxIter: []
           TolBnd: []
           TolFun: []
       TolTypeFun: []
             TolX: 1.0000e-06
         TolTypeX: []
          GradObj: []
         Jacobian: []
        DerivStep: []
      FunValCheck: []
           Robust: []
     RobustWgtFun: []
           WgtFun: []
             Tune: []
      UseParallel: []
    UseSubstreams: []
          Streams: []
        OutputFcn: []

The only parameters that evfit uses are Display and TolX. To create an options structure with the value of TolX set to 1e-8, enter:

options = statset('TolX',1e-8)
% Pass options to evfit:
mu = 1;
sigma = 1;
data = evrnd(mu,sigma,1,100);

paramhat = evfit(data,[],[],[],options)

More About

collapse all

Robust Options

Weight FunctionEquationDefault Tuning Constant
'andrews'w = (abs(r)<pi) .* sin(r) ./ r1.339
'bisquare' (default)w = (abs(r)<1) .* (1 - r.^2).^24.685
'cauchy'w = 1 ./ (1 + r.^2)2.385
'fair'w = 1 ./ (1 + abs(r))1.400
'huber'w = 1 ./ max(1, abs(r))1.345
'logistic'w = tanh(r) ./ r1.205
'talwar'w = 1 * (abs(r)<1)2.795
'welsch'w = exp(-(r.^2))2.985
[]No robust fitting

See Also

Introduced before R2006a

Was this topic helpful?