Learn R Programming

SurvRegCensCov (version 1.1)

censorContVar: Censor a vector of continuous numbers

Description

Given a vector of realizations of a continuous random variable, interval-, left-, or right-censor these numbers at given boundaries. Useful when setting up simulations involving censored observations.

Usage

censorContVar(x, LLOD = NA, ULOD = NA)

Arguments

x
Vector of random numbers.
LLOD
Lower limit where x should be left-censored at. If no left-censoring, set to $NA.
ULOD
Upper limit where x should be left-censored at. If no left-censoring, set to $NA.

Value

Examples

Run this code
## random vector
x <- rnorm(200)

## interval-censor this vector at -1 and 0.5
censorContVar(x, -1, 0.5)

Run the code above in your browser using DataLab