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

rank.predict

Generate predicted ranks for new observations given a new covariate profile


Description

This function is called by coxed when method="gam" and new data are specified, and is not intended to be used by itself.

Usage

rank.predict(x, v, warn = TRUE)

Arguments

x

A vector of linear predictors for the estimation sample

v

A vector of linear predictors for the new data

warn

If TRUE the function warns the user when linear predictors in the new data are greater than or less than all of the linear predictors in the estimation sample

Details

The purpose of rank.predict is to determine for a single new observation what the rank of that observation's linear predictor would have been had the observation been in the original estimation sample. It calculates the predicted rank by appending the new observation to the vector of linear predictors for the estimation sample and calculating the rank of the observation in the new vector. If the new data contain more than one observation, rank.predict calculates the predicted rank for each observation independently, without taking the other observations in the new data into account.

Any observation with a linear predictor less than the minimum linear predictor in the estimation sample will have a predicted rank of 1; any observation with a linear predictor greater than the maximum linear predictor in the estimation sample will have a predicted rank of length(v). If either condition exists, the function provides a warning.

Value

A numeric vector containing the predicted ranks for the observations in x.

Author(s)

Jonathan Kropko <jkropko@virginia.edu> and Jeffrey J. Harden <jharden2@nd.edu>

See Also

Examples

estimationLPs <- rnorm(20)
cbind(estimationLPs, rank(estimationLPs))
newLPs <- rnorm(5)
newLP.rank <- rank.predict(x=newLPs, v=estimationLPs)
cbind(newLPs, newLP.rank)

coxed

Duration-Based Quantities of Interest for the Cox Proportional Hazards Model

v0.3.3
GPL-2
Authors
Kropko, Jonathan [aut, cre], Harden, Jeffrey J. [aut]
Initial release

We don't support your browser anymore

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