# arxRegul

Determine regularization constants for ARX model estimation

## Syntax

``````[lambda,R] = arxRegul(data,orders)``````
``````[lambda,R] = arxRegul(data,orders,options)``````
``````[lambda,R] = arxRegul(data,orders,Name,Value)``````
``````[lambda,R] = arxRegul(data,orders,options,Name,Value)``````

## Description

example

``````[lambda,R] = arxRegul(data,orders)``` returns the regularization constants used for ARX model estimation. Use the regularization constants in `arxOptions` to configure the regularization options for ARX model estimation.```

example

``````[lambda,R] = arxRegul(data,orders,options)``` specifies regularization options such as regularization kernel and I/O offsets.```

example

``````[lambda,R] = arxRegul(data,orders,Name,Value)``` specifies model structure attributes, such as noise integrator and input delay, using one or more `Name,Value` pair arguments.```

example

``````[lambda,R] = arxRegul(data,orders,options,Name,Value)``` specifies both regularization options and model structure attributes.```

## Examples

collapse all

```load iddata1 z1; orders = [10 10 1]; [Lambda,R] = arxRegul(z1,orders);```

The ARX model is estimated using the default regularization kernel `TC`.

Use the `Lambda` and `R` values for ARX model estimation.

```opt = arxOptions; opt.Regularization.Lambda = Lambda; opt.Regularization.R = R; model = arx(z1,orders,opt);```

Specify `'DC'` as the regularization kernel and obtain a regularized ARX model of order [|10 10 1|].

```load iddata1 z1; orders = [10 10 1]; option = arxRegulOptions('RegularizationKernel','DC'); [Lambda,R] = arxRegul(z1,orders,option);```

Use the `Lambda` and `R` values for ARX model estimation.

```arxOpt = arxOptions; arxOpt.Regularization.Lambda = Lambda; arxOpt.Regularization.R = R; model = arx(z1,orders,arxOpt);```

Specify to include a noise source integrator in the noise component of the model.

```load iddata1 z1; orders = [10 10 1]; [Lambda,R] = arxRegul(z1,orders,'IntegrateNoise',true);```

Specify the regularization kernel and include a noise source integrator in the noise component of the model.

```load iddata1 z1; orders = [10 10 1]; opt = arxRegulOptions('RegularizationKernel','DC'); [Lambda,R] = arxRegul(z1,orders,opt,'IntegrateNoise',true);```

## Input Arguments

collapse all

Estimation data, specified as an `iddata` object.

ARX model orders `[na nb nc]`, specified as a matrix of nonnegative integers. See the `arx` reference page for more information on model orders.

Regularization options, specified as an options set you create using `arxRegulOptions`.

### Name-Value Arguments

Specify optional comma-separated pairs of `Name,Value` arguments. `Name` is the argument name and `Value` is the corresponding value. `Name` must appear inside quotes. You can specify several name and value pair arguments in any order as `Name1,Value1,...,NameN,ValueN`.

Example: `[Lambda, R] = arxRegul(z1,orders,option,'InputDelay',10);`

Input delay, specified as a positive, nonzero numeric value representing the number of samples.

Example: `[Lambda, R] = arxRegul(z1,orders,'InputDelay',10);`

Data Types: `double`

Noise source integrator, specified as a logical. Specifies whether the noise source `e(t)` should contain an integrator. The default is `false`, indicating the noise integrator is off. To turn it on, change the value to `true`.

Example: `[Lambda, R] = arxRegul(z1,orders,'IntegrateNoise',true);`

Data Types: `logical`

## Output Arguments

collapse all

Constant that determines the bias versus variance trade-off, returned as a positive scalar.

Weighting matrix, returned as a vector of nonnegative numbers or a positive definite matrix.

## Algorithms

Without regularization, the ARX model parameters vector θ is estimated by solving the normal equation

$\left({J}^{T}J\right)\theta ={J}^{T}y$

where J is the regressor matrix and y is the measured output. Therefore,

$\theta ={\left({J}^{T}J\right)}^{-1}{J}^{T}y$

Using regularization adds the regularization term

$\theta ={\left({J}^{T}J+\lambda R\right)}^{-1}{J}^{T}y$

where λ and R are the regularization constants. For more information on the regularization constants, see `arxOptions`.

## References

[1] T. Chen, H. Ohlsson, and L. Ljung. “On the Estimation of Transfer Functions, Regularizations and Gaussian Processes - Revisited”, Automatica, Volume 48, August 2012.