stepfun {IBMPopSim}R Documentation

Step Function.

Description

Given the vectors ⁠(x[1],...,x[n])⁠ and ⁠(y[0],y[1],...,y[n])⁠ (one value more!), stepfun(x, y) returns an interpolating step function, say f_n. This is the cadlag version (right = FALSE) of the stepfun function from package stats. The step function value f_n(t) equals to the constant y[k-1] for t in ⁠[x[k-1], x[k])⁠ so that

f_n(t) = \sum_{k=1}^{n+1} y_{k-1} {1}_{[x_{k-1}, x_{k})}(t),

withx_0=-\infty and x_{n+1}=+\infty.

Usage

stepfun(x, y)

Arguments

x

Numeric vector giving the knots or jump locations of the step function. Must be sorted with unique values.

y

Numeric vector one longer than x, giving the heights of the function values between the cx values.

Details

This function is defined for documentation purposes only. See stepfun and approxfun.

A C++ version of this function is available. See vignette('IBMPopSim_cpp') for more details.

Value

Objet of class stepfun with option right = FALSE (cadlag function).

See Also

plot.stepfun and max.stepfun.


[Package IBMPopSim version 1.0.0 Index]