简体   繁体   English

R生存分析:使用Weibull的survreg错误

[英]R Survival Analysis: error in survreg using Weibull

I'm trying to replicate some survival analysis using the Weibull distribution that I have previously produced in SAS - I'm now working from an unlicensed machine so am using R (both from Windows). 我正在尝试使用以前在SAS中生成的Weibull分布来复制一些生存分析-我现在使用的是无执照的计算机,因此使用R(均来自Windows)。 My (right censored) input data looks like: 我的(经过审查)输入数据如下所示:

> head(mydata)
  ID         Key  Time  Score    Event    Censor
1 1231231    ZXC   28   182.34   0      1
2 4564564    ASD   28   320.04   0      1
3 7897897    QWE   28   306.32   0      1
4 9879879    QWE   28   211.92   0      1
5 6546546    ASD   28   276.14   0      1
6 3213213    ZXC   28   331.50   0      1

with Event and Censor being binaries, Score varying between about 150 and 450 and Time between 1 and 28. There are some 30,000 rows in the input dataset. “事件”和“检查器”是二进制文件,“分数”在150到450之间变化,“时间”在1到28之间变化。输入数据集中大约有30,000行。

When I try: 当我尝试:

mydatasr <- survreg(Surv(Time, Censor) ~ Score, dist = "w")

I get a warning message: 我收到警告消息:

In survreg.fit(X, Y, weights, offset, init = init, controlvals = control, : Ran out of iterations and did not converge, 在survreg.fit(X,Y,weights,offset,init = init,controlvals = control,中:跑出迭代并且没有收敛,

And no output. 而且没有输出。

I've searched for this msg online (and through this site) but have not managed to find anything that indicates what the problem might be. 我已经在线(并且通过本网站)搜索了此味精,但没有找到任何可以指出问题所在的信息。 I had no convergence issues putting the same data through (proc logistic and) lifereg in SAS. 我没有收敛问题,可以通过SAS中的(过程逻辑和)lifereg来放入相同的数据。

It's difficult to know in the absence of data. 在没有数据的情况下很难知道。 You can double (or as illustrated below, triple) the number of iterations which defaults to 30: 您可以将迭代次数加倍(或如下图所示,加倍),默认为30:

(mydatasr <- survreg(Surv(Time, Censor) ~ Score , dist = "w", control = list(maxiter=90) )

See ?survreg.control for further options. 有关更多选项,请参见?survreg.control。 I also am guessing you may have missed that a Surv-object has a closing parenthesis before the formula- ~ 我还猜想您可能已经错过了Surv对象在公式之前有一个右括号的~

尝试这个:

   survreg(Surv(Time, Censor) ~ Score, data=mydata, dist = "w", scale=1)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM