marginalized.risk.threshold: Compute Maringalized Risk as a Function of S>=s

Description Usage Arguments Details Value Examples

View source: R/marginalized.risk.threshold.R

Description

Computes risk of disease conditional on S>=s by marginalizedizing over a covariate vector Z.

Usage

1
2
marginalized.risk.threshold(formula, marker.name, data, weights=rep(1, nrow(data)), 
    t, ss=NULL, verbose=FALSE) 

Arguments

formula

A formula for coxph

marker.name

string

data

A data frame containing the phase 2 data

ss

A vector of marker values

weights

Inverse prob sampling weight, optional

t

t is the time at which survival will be assessed

verbose

Boolean

Details

See the vignette file for more details.

Value

If ss is not NULL, a vector of probabilities are returned. If ss is NULL, a matrix of two columns are returned, where the first column is the marker value and the second column is the probabilties.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
#### suppose wt.loss is the marker of interest

if(requireNamespace("survival")) {

library(survival)

dat=subset(lung, !is.na(wt.loss) & !is.na(ph.ecog))
f1=Surv(time, status) ~ ph.ecog + age + sex
ss=quantile(dat$wt.loss, seq(.05,.95,by=0.01))
t0=1000
prob = marginalized.risk.threshold(f1, "wt.loss", dat, t = t0, ss=ss)

plot(ss, prob, type="l", xlab="Weight loss (S>=s)", 
    ylab=paste0("Probability of survival at day ", t0))

}

marginalizedRisk documentation built on Feb. 16, 2021, 5:07 p.m.