title |
author |
date |
output |
预测模型 |
sjy |
2023-11-22 |
html_document |
# 准备
```{r}
#加载r包
library(openxlsx) #加载数据
library(tidyverse) #数据处理
library(pROC) #roc及auc
library(PredictABEL) #nri及idi
library(rms)#校准曲线
library(ResourceSelection)#HL检验
library(caret) #交叉验证
#加载数据
sjydata % select(overweight,underweight,matches("weizm\\d+"),contains("slope_wei"),)
adam % na.omit(adam)
adam$overweight % mutate(overweight=if_else(overweight=="正常",0,1))
reclassification(data=adam,
cOutcome=1,
predrisk1=model1$fitted.values,
predrisk2=model2$fitted.values,
cutoff=c(0,0.15,1))
```
# 验证预测效果
```{r}
adam$overweight