官网教程:https://github.com/KunHuo/plotRCS,安装指令:
# 安装 devtools(如果您还没有安装)
install.packages("devtools")
devtools::install_github("kunhuo/plotRCS")
线性回归模型的 RCS 曲线
library(plotRCS)
# 查看数据
head(cancer)
# 线性回归模型的 RCS 曲线
rcsplot(data = cancer,
outcome = "size",
exposure = "age",
covariates = c("sex", "race", "metastasis"))
res.line <- rcsplot(data = cancer,
outcome = "size",
exposure = "age",
covariates = c("sex", "race", "metastasis"))
res. line$data
逻辑回归模型的 RCS 曲线
# RCS curves for a logistic regression model
rcsplot(data = cancer,
positive = "Dead",#可以在逻辑回归中人为指定事件
outcome = "status",
exposure = "age",
covariates = c("sex", "race", "size", "metastasis"))
Cox 回归模型的 RCS 曲线
rcsplot(data = cancer,
outcome = "status",
time = "time",
exposure = "age",
covariates = c("sex", "race", "size", "metastasis"))
特别申明:本文为转载文章,转载自刘老师医学统计,不代表贪吃的夜猫子立场,如若转载,请注明出处:https://mp.weixin.qq.com/s/5Ge8-CHcS5p9xn1gkMrOeg