# utils-Heaviside: Haviside and Related Functions In fBasics: Rmetrics - Markets and Basic Statistics

## Description

Functions which compute the Heaviside and related functions. These include the sign function, the delta function, the boxcar function, and the ramp function.

The functions are:

 `Heaviside` Computes Heaviside unit step function, `Sign` Just another signum function, `Delta` Computes delta function, `Boxcar` Computes boxcar function, `Ramp` Computes ramp function.

## Usage

 ```1 2 3 4 5``` ```Heaviside(x, a = 0) Sign(x, a = 0) Delta(x, a = 0) Boxcar(x, a = 0.5) Ramp(x, a = 0) ```

## Arguments

 `a` a numeric value, the location of the break. `x` a numeric vector.

## Details

The Heaviside step function `Heaviside` is 1 for `x>a`, `1/2` for `x=a`, and `0` for `x<a`.

The Sign function `Sign` is `1` for `x>a`, `0` for `x=a`, and `-1` for `x<a`.

The delta function `Delta` is defined as: `Delta(x) = d/dx H(x-a)`.

The boxcar function `Boxcar` is defined as: `Boxcar(x) = H(x+a) - H(x-a)`.

The ramp function is defined as: `Ramp(x)= (x-a)*H(x-a)`.

## Value

returns the function values of the selected function.

## Note

The Heaviside function is used in the implementation of the skew Normal, Student-t, and Generalized Error distributions, distributions functions which play an important role in modelling GARCH processes.

## References

Weisstein W. (2004); http://mathworld.wolfram.com/HeavisideStepFunction.html, Mathworld.

`GarchDistribution`, `GarchDistributionFits`.

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16``` ```## Heaviside - x = sort(round(c(-1, -0.5, 0, 0.5, 1, 5*rnorm(5)), 2)) h = Heaviside(x) ## Sign - s = Sign(x) ## Delta - d = Delta(x) ## Boxcar - Pi = Boxcar(x) ## Ramp - r = Ramp(x) cbind(x = x, Step = h, Signum = s, Delta = d, Pi = Pi, R = r) ```

### Example output

```Loading required package: timeDate
x Step Signum Delta   Pi    R
[1,] -5.89  0.0     -1     0  0.0 0.00
[2,] -5.46  0.0     -1     0  0.0 0.00
[3,] -1.00  0.0     -1     0  0.0 0.00
[4,] -0.50  0.0     -1     0 -0.5 0.00
[5,]  0.00  0.5      0   Inf -1.0 0.00
[6,]  0.06  1.0      1     0 -1.0 0.06
[7,]  0.20  1.0      1     0 -1.0 0.20
[8,]  0.50  1.0      1     0 -0.5 0.50
[9,]  1.00  1.0      1     0  0.0 1.00
[10,]  6.31  1.0      1     0  0.0 6.31
```

fBasics documentation built on March 13, 2020, 9:09 a.m.