Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

Ocens

Censored Ordinal Variable


Description

Creates a 2-column integer matrix that handles left- right- and interval-censored ordinal or continuous values for use in blrm(). A pair of values [a, b] represents an interval-censored value known to be in the interval [a, b] inclusive of a and b. It is assumed that all distinct values are observed as uncensored for at least one observation. When both input variables are factors it is assume that the one with the higher number of levels is the one that correctly specifies the order of levels, and that the other variable does not contain any additional levels. If the variables are not factors it is assumed their original values provide the orderings. Since all values that form the left or right endpoints of an interval censored value must be represented in the data, a left-censored point is is coded as a=1 and a right-censored point is coded as b equal to the maximum observed value. If the maximum observed value is not really the maximum possible value, everything still works except that predictions involving values above the highest observed value cannot be made. As with most censored-data methods, blrm() assumes that censoring is independent of the response variable values that would have been measured had censoring not occurred.

Usage

Ocens(a, b = a)

Arguments

a

vector representing a factor, numeric, or alphabetically ordered character strings

b

like a. If omitted, it copies a, representing nothing but uncensored values

Value

a 2-column integer matrix of class "Ocens" with an attribute levels (ordered). When the original variables were factors, these are factor levels, otherwise are numerically or alphabetically sorted distinct (over a and b combined) values. When the variables are not factors and are numeric, another attribute median is also returned. This is the median of the uncensored values. When the variables are factor or character, the median of the integer versions of variables for uncensored observations is returned as attribute mid. A final attribute freq is the vector of frequencies of occurrences of all uncensored values. freq aligns with levels.

Author(s)

Frank Harrell


rmsb

Bayesian Regression Modeling Strategies

v0.0.2
GPL (>= 3)
Authors
Frank Harrell [aut, cre] (<https://orcid.org/0000-0002-8271-5493>), Ben Goodrich [ctb] (contributed Stan code), Ben Bolker [ctb] (wrote original code that is folded into the pdensityContour function), Doug Bates [ctb] (write original code for highest posterior density interval that is folded into the HPDint function)
Initial release
2021-02-27

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.