karissawhiting / cureit Goto Github PK
View Code? Open in Web Editor NEWHome Page: http://www.karissawhiting.com/cureit/
License: Other
Home Page: http://www.karissawhiting.com/cureit/
License: Other
library(ISwR)
library(tidyverse)
library(cureit)
mel <- ISwR::melanom %>%
mutate(status = case_when(status %in% c(1, 3) ~ 1,
TRUE ~ 0)) %>%
mutate(thick_cat =
case_when(thick <= 129 ~ "less equal 129",
thick <= 322 ~ "less equal 322",
thick > 322 ~ "greater 322")) %>%
mutate(thick_cat = fct_relevel(thick_cat, "≤ 129", "≤ 322")) %>%
mutate(sex = case_when(sex == 2 ~ "male",
sex == 1 ~ "female"),
ulc = case_when(ulc == 1 ~ "present",
ulc == 2 ~ "absent"))
x <- cureit(surv_formula = Surv(days, status) ~ ulc + sex + thick_cat + thick,
cure_formula = ~ ulc + sex, data = mel)
nomogram.cureit(x,time=300)
predict(x,times=c(100,300)
One thing we can further add is to allow the nomogram.cureit
function to take more than one time point, so that survival probabilities at multiple times can be generated on the nomogram.
Greetings, I encountered a quandary whilst executing the program. Upon meticulous examination of my data, all appears to be in order, devoid of discrepancies. Might I inquire as to the location of the error within my code?
mydata=read.table('huizong11.txt',sep = '\t',header = T)
mydata$CEA=as.numeric(mydata$CEA)
mydata$CEA2=as.factor(mydata$CEA2)
mydata$CA125=as.numeric(mydata$CA125)
mydata$CA1252=as.factor(mydata$CA1252)
mydata$cyfra211=as.numeric(mydata$cyfra211)
mydata$cyfra2112=as.factor(mydata$cyfra2112)
mydata$diameter=as.numeric(mydata$diameter)
mydata$diameter2=as.factor(mydata$diameter2)
mydata$LVI=as.factor(mydata$LVI)
mydata$disease=as.factor(mydata$disease)
mydata$symptom=as.factor(mydata$symptom)
mydata$smoke=as.factor(mydata$smoke)
mydata$surgery1=as.factor(mydata$surgery1)
mydata$age=as.numeric(mydata$age)
mydata$age1=as.factor(mydata$age1)
mydata$sex=as.factor(mydata$sex)
mydata$subtype4=as.factor(mydata$subtype4)
mydata$wei1<-as.factor(mydata$wei1)
mydata$wei2<-as.factor(mydata$wei2)
mydata$wei2.1<-as.factor(mydata$wei2.1)
mydata$local<-as.factor(mydata$local)
mydata$nian<-as.factor(mydata$nian)
mydata$NLR<-as.numeric(mydata$NLR)
mydata$PLR<-as.numeric(mydata$PLR)
mydata$recrudescence1<-as.numeric(mydata$recrudescence1)
mydata$PFS<-as.numeric(mydata$PFS)
library(cureit)
library(ROCR)
library(evacure)
library(MASS)
str(mydata)
'data.frame': 1064 obs. of 27 variables:
$ num : int 670 673 678 682 683 686 692 729 730 732 ...
$ CEA : num 2.15 0.27 0.2 2.2 0.9 3.3 1.4 2.7 1.7 0.91 ...
$ CEA2 : Factor w/ 2 levels "0","1": 1 1 1 1 1 1 1 1 1 1 ...
$ CA125 : num 7.84 1.95 4.32 5.78 5.9 ...
$ CA1252 : Factor w/ 2 levels "0","1": 1 1 1 1 1 1 2 1 1 1 ...
$ cyfra211 : num 0.47 0.1 0.51 3.45 6.02 5.12 0.59 3.2 4.49 0.15 ...
$ cyfra2112 : Factor w/ 2 levels "0","1": 1 1 1 2 2 2 1 1 2 1 ...
$ nian : Factor w/ 2 levels "0","1": 1 1 1 1 1 1 1 1 1 1 ...
$ diameter : num 0.6 1.1 0.9 0.9 2.6 1.8 0.8 1 1.4 1.6 ...
$ diameter2 : Factor w/ 3 levels "0","1","2": 1 2 1 1 3 2 1 1 2 2 ...
$ LVI : Factor w/ 2 levels "0","1": 1 1 1 1 1 1 1 1 1 1 ...
$ disease : Factor w/ 2 levels "0","1": 1 2 1 1 2 1 1 2 2 1 ...
$ symptom : Factor w/ 2 levels "0","1": 1 1 1 1 1 1 1 2 1 1 ...
$ smoke : Factor w/ 2 levels "0","1": 1 2 1 1 1 1 1 1 1 1 ...
$ surgery1 : Factor w/ 2 levels "0","1": 1 1 1 1 1 1 2 2 2 2 ...
$ age : num 74 70 60 55 81 68 41 70 81 76 ...
$ age1 : Factor w/ 2 levels "0","1": 2 2 2 1 2 2 1 2 2 2 ...
$ sex : Factor w/ 2 levels "0","1": 2 2 1 2 2 1 1 1 2 1 ...
$ subtype4 : Factor w/ 2 levels "0","1": 1 1 1 1 1 1 1 1 1 1 ...
$ wei1 : Factor w/ 2 levels "0","1": 1 1 1 1 2 1 1 1 1 1 ...
$ wei2 : Factor w/ 2 levels "0","1": 1 1 1 1 2 1 1 1 1 1 ...
$ wei2.1 : Factor w/ 2 levels "0","1": 1 1 1 1 1 1 1 1 1 1 ...
$ local : Factor w/ 5 levels "1","2","3","4",..: 4 4 1 3 3 4 4 4 3 5 ...
$ NLR : num 1.7 1.7 0.9 1.8 2.9 1.1 2.6 1.9 1.8 0.8 ...
$ PLR : num 126.8 122.2 71.2 205.9 118.1 ...
$ recrudescence1: num 0 0 0 0 0 0 0 0 0 0 ...
$ PFS : num 66 79 69 66 80 78 107 80 105 122 ...
mydata$PFS=as.numeric(mydata$PFS)
p<-cureit(
.calc_k_index(p)
[1] 0.5450771
nomogram(x = p,time=30)
Error in if (type == "factor") { : argument is of length zero
smcure::smcure()
function to save the bootstrap iterations. This will allow us to use these bootstraps to calculate Brier score. (Evacure package has done this already but we may want to keep changes to a minimum: https://github.com/elong0527/evacure/blob/master/R/smcure1.R) - @tengfei-emoryem()
function. Right now you get errors or warnings with bootstraps (example coming soon)- @karissawhitingA certain way of resampling data often causes warning or even an error of the Cox submodel in the cure model. This essentially means the more bootstrap runs we generate, the higher chance of observing a warning or getting an error.
Greetings, as a medical student, I am greatly intrigued by the mix cure model. The Cureit package, which enriches the smcure function with evaluation metrics and visualization capabilities, is an invaluable R package. However, these evaluations pertain solely to the training set, with no apparent consideration for the test set. I am curious about how to apply the predict function to the mix cure model.
Look at examples with broom mixture models and gam models.
sc
on the nomogramlp
is scaled: what's the theoretical maximum and minimum of lp
? Is it necessary to get the range of lp
from real data?Make sure there are tests for all basic functionality
Add a function that calculates K-index (https://academic.oup.com/biostatistics/article/19/1/14/3798781).
{evacure} package has code for this https://github.com/elong0527/evacure
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.