Cen: Create a Censored Object

Description Usage Arguments Value details Author(s) References See Also Examples

View source: R/cen.R

Description

Create a censored object, usually used as a response variable in a model formula.

Usage

1
Cen(obs, censored, type = "left")

Arguments

obs

A numeric vector of observations. This includes both censored and uncensored observations.

censored

A logical vector indicating TRUE where an observation in obs is censored (a less-than value) and FALSE otherwise.

type

character string specifying the type of censoring. Possible values are "right", "left", "counting", "interval", or "interval2". The default is "left".

Value

An object of class Cen.

details

This, and related routines, are front ends to routines in the survival package. Since the survival routines can not handle left-censored data, these routines transparently handle “flipping" input data and resultant calculations. The Cen function provides part of the necessary framework for flipping.

Author(s)

R. Lopaka Lee <rclee@usgs.gov>

Dennis Helsel <dhelsel@practicalstats.com>

References

Helsel, Dennis R. (2005). Nondectects and Data Analysis; Statistics for censored environmental data. John Wiley and Sons, USA, NJ.

See Also

cenfit, flip-methods

Examples

1
2
3
4
5
    obs      = c(0.5,    0.5,   1.0,  1.5,   5.0,    10,   100)
    censored = c(TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE)

    Cen(obs, censored)
    flip(Cen(obs, censored))

Example output

Loading required package: survival

Attaching package: 'NADA'

The following object is masked from 'package:stats':

    cor

An object of class "Cen"
Slot "Surv":
[1] <  0.5    0.5    1.0 <  1.5    5.0   10.0  100.0

Slot "flipFactor":
[1] 149.75

[1] 149.25+ 149.25  148.75  148.25+ 144.75  139.75   49.75 

NADA documentation built on March 22, 2020, 5:07 p.m.

Related to Cen in NADA...