Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/72.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用RMS软件包从三次样条cox比例风险模型进行内部或外推_R_Prediction_Predict_Rms - Fatal编程技术网

使用RMS软件包从三次样条cox比例风险模型进行内部或外推

使用RMS软件包从三次样条cox比例风险模型进行内部或外推,r,prediction,predict,rms,R,Prediction,Predict,Rms,我正在使用RMS软件包中的cph功能来评估体重与事件结果的关联。我使用的是三次样条曲线,有3个节点 如何使用该模型预测原始数据中未包含的权重的风险比?i、 e.我如何使用模型进行内部或外推 以下是一个例子: set.seed(123) library(rms) WT <- rnorm(10, 30, 10) EVENT <- sample(c(0,1), replace=TRUE, size=10) TIME <- c(seq(1,10,1)) df <- as.dat

我正在使用RMS软件包中的
cph
功能来评估体重与事件结果的关联。我使用的是三次样条曲线,有3个节点

如何使用该模型预测原始数据中未包含的权重的风险比?i、 e.我如何使用模型进行内部或外推

以下是一个例子:

set.seed(123)
library(rms)
WT <- rnorm(10, 30, 10)
EVENT <- sample(c(0,1), replace=TRUE, size=10)
TIME <- c(seq(1,10,1))

df <- as.data.frame(cbind(TIME,EVENT,WT))
fit <- cph(Surv(TIME, EVENT==1) ~ rcs(WT, 3), data = df)
fit

d = datadist(df)
options(datadist = 'd')

Predict(fit, WT) # this predicts hazard for WT included in the data
set.seed(123)
图书馆(rms)

WT只是一个粗略的猜测,但是如何
预测(fit,WT=70)
@Edward Nope。我试过:-)对我有用。我得到:
yhat=-1.234295
。你得到了什么?哦!是的。我添加了
=
而不是
=