# smoothts

`smoothts` is not recommended. Use `smoothdata` instead.

## Syntax

``output = smoothts(input)``
``output = smoothts(input,'e',n)``
``output = smoothts(input,method)``
``output = smoothts(___,wsize)``
``output = smoothts(___,stdev)``
``output = smoothts(___,n)``

## Description

example

````output = smoothts(input)` smooths the input data using the default Box method with window size, `wsize`, of `5`.`output = smoothts(input,'b',wsize)` smooths the input data using the Box (simple, linear) method. `wsize` specifies the width of the box to be used. `output = smoothts(input,'g',wsize,stdev)` smooths the input data using the Gaussian window method. `output = smoothts(input,'e',n)` smooths the input data using the Exponential method. `n` can represent the window size (period length) or alpha. If `n > 1`, `n` represents the window size. If `0 < n < 1`, `n` represents alpha, where$\alpha =\frac{2}{wsize+1}.$If `input` is a financial time series object, `output` is a financial time series object identical to `input` except for contents. If `input` is a row-oriented matrix, `output` is a row-oriented matrix of the same length.```

example

````output = smoothts(input,method)` smooths the input data using a smoothing method.```

example

````output = smoothts(___,wsize)` smooths the input data using a smoothing method where `wsize` specifies the width of the box to be used.```

example

````output = smoothts(___,stdev)` represents the standard deviation of the Gaussian window. ```

example

````output = smoothts(___,n)` smooths the input data using the Exponential method (`'e'`). `n` can represent the window size (period length) or alpha. If `n > 1`, `n` represents the window size. If `0 < n < 1`, `n` represents alpha, where$\alpha =\frac{2}{wsize+1}.$```

## Examples

collapse all

1. Create a financial times series (`fints`) object using `dates` and `data`.

```data = [1:6]'; dates = [today:today+5]'; tsobj = fints(dates, data)```
```Warning: FINTS is not recommended. Use TIMETABLE instead. For more information, see Convert Financial Time Series Objects (fints) to Timetables. > In fints (line 169) tsobj = desc: (none) freq: Unknown (0) {'dates: (6)'} {'series1: (6)'} {'01-Sep-2021'} {[ 1]} {'02-Sep-2021'} {[ 2]} {'03-Sep-2021'} {[ 3]} {'04-Sep-2021'} {[ 4]} {'05-Sep-2021'} {[ 5]} {'06-Sep-2021'} {[ 6]}```
2. Use `smoothts` to smooth the data.

`output = smoothts(tsobj)`
``` output = desc: Box-smoothed of freq: Unknown (0) {'dates: (6)'} {'series1: (6)'} {'01-Sep-2021'} {[ 1.2000]} {'02-Sep-2021'} {[ 2.0000]} {'03-Sep-2021'} {[ 3.0000]} {'04-Sep-2021'} {[ 4]} {'05-Sep-2021'} {[ 3.6000]} {'06-Sep-2021'} {[ 3]}```

## Input Arguments

collapse all

Input data, specified as a `fints` object or a row-oriented matrix. In a row-oriented matrix, each row represents an individual set of observations.

Data Types: `object` | `double`

Smoothing method, specified as a scalar logical character vector with one of the following values:

• `'b'` — Box

• `'e'` — Exponential

• `'g'` — Gaussian

Data Types: `char`

Window size, specified as a scalar numeric.

Note

The `wsize` input argument can only be used when the `method` is `'b'` (Box) or `'g'` (Gaussian).

Data Types: `double`

Standard deviation of the Gaussian window, specified as a scalar numeric.

Note

The `stdev` input argument can only be used when the `method` is `'g'` (Gaussian).

Data Types: `numeric`

Window size or exponential factor depending upon value, specified as a scalar numeric with one of the following values:

• `n > 1` (window size) or period length

• `n < 1` and `> 0` (exponential factor: alpha)

• `n = 1` (either window size or alpha)

Note

The `n` input argument can only be used when the `method` is `'e'` (exponential).

Data Types: `double`

## Output Arguments

collapse all

Output, returned as a `fints` object or row-oriented matrix.

If `input` is a financial time series object, `output` is a financial time series object identical to `input` except for contents. If `input` is a row-oriented matrix, `output` is a row-oriented matrix of the same length.

## Version History

Introduced before R2006a