区间删失数据:考克斯比例风险和R的存在差异

时间:2017-02-06 13:50:46

标签: r survival-analysis cox-regression

关于如何使用int beginRawY = 0; int beginScrollValue = 0; Integer firstPointerId = null; [...] private boolean onTouchEvent(MotionEvent event) { int index = event.getActionIndex(); int action = event.getActionMasked(); int pointerId = event.getPointerId(index); int rawY = (int) event.getRawY(); // This is meant to deal with multitouch: scroll only if I'm using "the same finger". boolean rightPointer = firstPointerId != null && firstPointerId == pointerId; switch (action) { case MotionEvent.ACTION_DOWN: initVelocityTracker(event); if(firstPointerId == null) { // Save initial scrollValue and touch position beginRawY = rawY; beginScrollValue = scrollValue; firstPointerId = pointerId; return true; } case MotionEvent.ACTION_MOVE: if(rightPointer) { updateVelocity(event); // Updates scroll value to new scroll value scrollValue = beginScrollValue -rawY + beginRawY; return true; } case MotionEvent.ACTION_UP: if(rightPointer) { //Start the Dissipator runnable, passing to it the speed of the player's touch (number of pixels in 30 milliseconds) dissipator.setVelocity(updateVelocity(event).pixelY()); dissipator.run(); firstPointerId = null; return true; } } return false; } private void initVelocityTracker(MotionEvent event) { if(mVelocityTracker == null) { // Retrieve a new VelocityTracker object to watch the velocity of a motion. mVelocityTracker = VelocityTracker.obtain(); } else { // Reset the velocity tracker back to its initial state. mVelocityTracker.clear(); } // Add a user's movement to the tracker. mVelocityTracker.addMovement(event); } private PixelDot updateVelocity(MotionEvent event) { int pointerId = event.getPointerId(event.getActionIndex()); mVelocityTracker.addMovement(event); mVelocityTracker.computeCurrentVelocity(30); return new PixelDot( VelocityTrackerCompat.getXVelocity(mVelocityTracker, pointerId), VelocityTrackerCompat.getYVelocity(mVelocityTracker, pointerId)); } [...] private class DissipatorRunnable implements Runnable { private float velocity = 0; public void setVelocity(float velocity) { this.velocity = velocity; } @Override public void run() { // Simply linear descreasing of the scroll speed float vValue = velocity; if(velocity > 0) { while (vValue > 0 && scrollValue > 0) { scrollValue = scrollValue - vValue; vValue -= 5; try { Thread.sleep(10); } catch (InterruptedException e) { e.printStackTrace(); } } } else { while (vValue < 0 && scrollValue < height) { scrollValue = scrollValue - vValue; vValue += 5; try { Thread.sleep(10); } catch (InterruptedException e) { e.printStackTrace(); } } } } } 包在R中进行生存分析,有很多信息(互联网和教科书)。但是当您有左删失数据时,我无法找到有关如何执行此操作的任何信息。

问题背景:

我有一个自行构建的数据集,其中包含已发布的生存数据。通常会给出事件时间和最后一次跟进日期(右侧审查)。然而,有一项研究只表明事件发生在第360天之前。所以我留下了审查这些数据。

我想做什么:

我想用左截断,事件和右截断来分析完整的数据集。我想按性别绘制Kaplan-Meier曲线,然后

  1. 进行对数排名测试
  2. 做Cox回归
  3. 我需要什么:

    我可以用survival创建一个Surv对象。但这既不允许计算生存包的type = interval2,也不计算survdiff

    我从CRAN中删除了coxph个包,但我找不到我在intcoxicenReg个包中搜索的内容。

    任何人都可以告诉我如何解决我的问题或在哪里找到有关此问题的实用信息?我已经在这个上花了好几天。

    非常感谢!

1 个答案:

答案 0 :(得分:0)

您可以使用icenReg功能在ic_sp中使用左右删除功能调整Cox-PH模型。您可以使用标准的Surv响应变量来拟合它,即

fit <- ic_sp(Surv(L, R, type = 'interval2') ~ treatment, data = myData)

或者更简洁一点

fit <- ic_sp(cbind(L, R) ~ treatment, data = myData)

icenReg中没有日志排名测试,但可以在interval包中找到。