Description Usage Arguments Value Examples
View source: R/formula_probability.R
explore the probability formula to total points and get the best power.
1 | formula_probability(nomogram, power, digits = 6)
|
nomogram |
nomogram after nomogram command in rms package |
power |
if missing, power will be choose automatically up to 100 based on all R2 equealling to 1 |
digits |
default is 6 |
a global variable Formula_probability, the formula of probability and total points
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | library(rms)
set.seed(2018)
n <-2019
age <- rnorm(n,60,20)
sex <- factor(sample(c('female','male'),n,TRUE))
sex <- as.numeric(sex)
weight <- sample(50:100,n,replace = TRUE)
time <- sample(50:800,n,replace = TRUE)
units(time)="day"
death <- sample(c(1,0,0),n,replace = TRUE)
df <- data.frame(time,death,age,sex,weight)
ddist <- datadist(df)
options(datadist='ddist')
f <- cph(formula(Surv(time,death)~sex+age+weight),data=df,
x=TRUE,y=TRUE,surv=TRUE,time.inc=3)
surv <- Survival(f)
nomo <- nomogram(f,
lp=TRUE,
fun=list(function(x) surv(365,x),
function(x) surv(365*2,x)),
funlabel=c("1-Year Survival Prob",
"2-Year Survival Prob"))
library(nomogramFormula)
formula_probability(nomogram = nomo)
formula_probability(nomogram = nomo,power = 2)
formula_probability(nomogram = nomo,power = 3)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.