# piece: Left Continuous Piecewise Constant Function with a Finite... In smoothSurv: Survival Regression with Smoothed Error Distribution

## Description

Function to evaluate a left continuous piecewise constant function with a finite support.

## Usage

 `1` ``` piece(x, breaks, values) ```

## Arguments

 `x` Vector of values where the piecewise constant function should be evaluated. `breaks` Vector of sorted breakpoints of the piecewise constant function. `values` Values of the piecewise constant function. It takes the value `value[i]` on the interval `(breaks[i], breaks[i+1]]`. The function is assumed to be zero outside its range specified as `(breaks[1], breaks[length(breaks)]]`. The length of the vector `values` must be equal to `length(breaks) - 1`

## Value

The value of the piecewise constant function.

## Author(s)

Arnošt Komárek arnost.komarek[AT]mff.cuni.cz

## Examples

 ```1 2 3 4``` ```my.breaks <- c(-2, 1.5, 4, 7) my.values <- c(0.5, 0.9, -2) grid <- seq(-3, 8, by = 0.25) piece(grid, my.breaks, my.values) ```

### Example output

```Loading required package: survival

### Survival Regression with Smoothed Error Distribution
### Arnost Komarek

### See citation("smoothSurv") or toBibtex(citation("smoothSurv")) for the best way to cite
### the package if you find it useful.

[1]  0.0  0.0  0.0  0.0  0.0  0.5  0.5  0.5  0.5  0.5  0.5  0.5  0.5  0.5  0.5
[16]  0.5  0.5  0.5  0.5  0.9  0.9  0.9  0.9  0.9  0.9  0.9  0.9  0.9  0.9 -2.0
[31] -2.0 -2.0 -2.0 -2.0 -2.0 -2.0 -2.0 -2.0 -2.0 -2.0 -2.0  0.0  0.0  0.0  0.0
```

smoothSurv documentation built on July 8, 2020, 5:46 p.m.