censor: Multiply-censored Data Conversion

View source: R/censor.R

censorR Documentation

Multiply-censored Data Conversion

Description

Censors a vector at user-set limits for left- or right-censoring.

Usage

censor(x, left = -Inf, right = Inf)

Arguments

x

a numeric vector. Missing values are permitted.

left

a vector of left-censoring thresholds. If the length is greater than 1, then they are replicated to the length of x.

right

a vector of right-censoring thresholds. If the length is greater than 1, then they are replicated to the length of x.

Value

An S4 object of class "lcens" if right is Inf, otherwise an S4 object of class "mcens."

Note

Missing velues are generated wherever right is less than or equal to left.
The censor function is provided as a simple function to create either left- or multiply-censored data from numeric values, primarily for simulation pruposes. The functions as.lcens or as.mcens offer greater flexibility and should be used for real data.

References

Lorenz, D.L., in preparation

See Also

as.lcens, as.mcens

Examples

## Create a random vector
set.seed(651)
x.tmp <- rnorm(5)
censor(x.tmp, 0, .75)

USGS-R/smwrQW documentation built on Oct. 11, 2022, 6:13 a.m.