Main Content

statset

Create statistics options structure

Syntax

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

Description

statsetwith 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™ functionstatfun。Specifystatfunusing a character vector, a string scalar, or a function handle.

options = statset(...)creates a statistics options structureoptions。With no input arguments, all fields of the options structure are an empty array ([]). With a specifiedstatfun, function-specific fields are default values and the remaining fields are[]。函数专用字段集合to[]indicate that the function is to use its default value for that parameter. For availableoptions, 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 character vectors or string scalars for field names. For named values, you must input the complete character vector or string scalar for the value. If you provide an invalid character vector or string scalar for a value,statsetuses the default.

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

options = statset(oldopts,newopts)结合现有的选择结构re,oldopts, with a new options structure,newopts。Any parameters innewoptswith nonempty values overwrite corresponding parameters inoldopts

Input Arguments

DerivStep

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.

Display

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.

FunValCheck

Check for invalid values, such asNaNorInf, from the objective function.

  • 'off'

  • 'on'

GradObj

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

  • 'off'

  • 'on'

Jacobian

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

  • 'off'

  • 'on'

MaxFunEvals

Maximum number of objective function evaluations allowed. Positive integer.

MaxIter

Maximum number of iterations allowed. Positive integer.

OutputFcn

The solver calls all output functions after each iteration.

  • Function handle specified using @

  • a cell array with function handles

  • an empty array (default)

Robust

(Not recommended) Invoke robust fitting option.

  • 'off'

  • 'on'

Robustis not recommended. UseRobustWgtFunfor robust fitting.

RobustWgtFun

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 aTuneconstant. SeeRobust Options

Streams

A single instance of theRandStreamclass, or a cell array ofRandStreaminstances. The Streams option is accepted by some functions to govern what stream(s) to use in generating random numbers within the function. If'UseSubstreams'istrue, the Streams value must be a scalar, or must be empty. If'UseParallel'istrueand'UseSubstreams'isfalse, then the Streams argument must either be empty, or its length must match the number of processors used in the computation: equal to theparpoolsize if aparpoolis open, a scalar otherwise.

TolBnd

Parameter bound tolerance. Positive scalar.

TolFun

Termination tolerance for the objective function value. Positive scalar.

TolTypeFun

UseTolFunfor absolute or relative objective function tolerances.

  • 'abs'

  • 'rel'

TolTypeX

UseTolXfor absolute or relative parameter tolerances.

  • 'abs'

  • 'rel'

TolX

Termination tolerance for the parameters. Positive scalar.

Tune

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. SeeRobust Options

UseParallel

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 PCTparpoolis in effect. Valid values arefalse(the default), for serial computation, andtrue, for parallel computation.

UseSubstreams

Flag indicating whether the random number generator in eligible functions should useSubstreamproperty of theRandStreamclass.false(default) ortrue。Whentrue, high level iterations within the function will set theSubstreamproperty to the value of the iteration. This behavior helps to generate reproducible random number streams in parallel and/or serial mode computation.

WgtFun

(Not recommended) Weight function for robust fitting. Valid only whenRobustis'on'。Can also be a function handle that accepts a normalized residual as input and returns the robust weights as output. SeeRobust Options

WgtFunis not recommended. UseRobustWgtFuninstead.

Examples

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

statset('evfit') 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 thatevfituses areDisplayandTolX。To create an options structure with the value ofTolXset to1e-8, enter:

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

More About

collapse all

Robust Options

Weight Function Equation Default Tuning Constant
'andrews' w = (abs(r) 1.339
'bisquare'(default) w = (abs(r)<1) .* (1 - r.^2).^2 4.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) ./ r 1.205
'talwar' w = 1 * (abs(r)<1) 2.795
'welsch' w = exp(-(r.^2)) 2.985
[] 没有健壮的拟合

See Also

Introduced before R2006a