ECII
ECII

Reputation: 10629

cr.setup in rms

Could someone please explain how the cr.setup functions in rms package works? I can't seem to figure out how it remaps the initial data and how this remapping is useful for the continuation ratio model and the help and examples are not that helpful. Can't find any other explanation on the net either.

Upvotes: 1

Views: 220

Answers (1)

IRTFM
IRTFM

Reputation: 263411

In his excellent text "Regression Modeling Strategies" Harrell has three pages at the end of his chapter on ordinal logistic regression devoted to the continuation ratio model. cr.setup is supporting the process of "tricking ordinary logistic regression" by duplicating certain rows and creating stratum markers for various comparisons: Y >= 0; Y>=1, ... Y>=K-1 and also creating appropriate response variables to represent the "outcome" for particular strata. Look at his first example for cr.setup:

y <- c(NA, 10, 21, 32, 32)
> cr.setup(y)
$y
[1] NA  1  0  1  0  0  0  0

$cohort
[1] <NA>  all   all   y>=21 all   y>=21 all   y>=21
Levels: all y>=21

$subs
[1] 1 2 3 3 4 4 5 5

$reps
[1] 1 1 2 2 2

With three levels of non-NA Y's, there would be only 2 levels of the neo-outcome. The y vector is the neo-outcome. The subs vector elements are the indices inot the original data. The reps vector tells the software how many replications are needed. You can see how this is used in practice by following down the example :

combinations <- expand.grid(cohort=levels(cohort), sex=levels(sex))
combinations

Upvotes: 4

Related Questions