Description Usage Arguments Details Value Examples

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

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

1 2 |

`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 |

See the vignette file for more details.

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.

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))
}
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.