计科学Java和ph_绘制来自coxph对象的估计HR与时间相关系数和样条曲线

我想绘制估计风险比作为时间的函数,在具有基于样条项的时间相关系数的情况下_822176_模型 . 我使用函数 tt 创建了时间相关系数,类似于直接来自 ?coxph 的此示例:

# Fit a time transform model using current age

cox = coxph(Surv(time, status) ~ ph.ecog + tt(age), data=lung,

tt=function(x,t,...) pspline(x + t/365.25))

调用 survfit(cox) 会导致 survfit 无法理解具有 tt 术语(as described in 2011 by Terry Therneau)的模型的错误 .

您可以使用 cox$linear.predictors 提取线性预测器,但我需要以某种方式提取年龄,而不是简单地提取每个时间 . 因为 tt 在事件时间拆分数据集,所以我不能只将输入数据帧的列与 coxph 输出匹配 . 另外,我真的想绘制估计函数本身,而不仅仅是对观察到的数据点的预测 .

这里有a related question涉及样条曲线,但它不涉及 tt .

编辑(7/7)

我仍然坚持这个 . 我一直在深入研究这个对象:

spline.obj = pspline(lung$age)

str(spline.obj)

# something that looks very useful, but I am not sure what it is

# cbase appears to be the cardinal knots

attr(spline.obj, "printfun")

function (coef, var, var2, df, history, cbase = c(43.3, 47.6,

51.9, 56.2, 60.5, 64.8, 69.1, 73.4, 77.7, 82, 86.3, 90.6))

{

test1

xmat

xsig

cmat

linear

lvar1

lvar2

test2

cmat

1, 1 - pchisq(test2, 1)), c(NA, NA, NA, test1 - test2,

df - 1, 1 - pchisq(test1 - test2, max(0.5, df - 1))))

dimnames(cmat)

nn

if (length(nn))

theta

else theta

list(coef = cmat, history = paste("Theta=", format(theta)))

}

所以,我有结,但我仍然不确定如何将 coxph 系数与结合并以实际绘制函数 . 任何领导都非常感激 .

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值