Reputation: 138
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). 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.
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,
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.
Upvotes: 2
Views: 4264
Reputation: 263342
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:
(mydatasr <- survreg(Surv(Time, Censor) ~ Score , dist = "w", control = list(maxiter=90) )
See ?survreg.control for further options. I also am guessing you may have missed that a Surv-object has a closing parenthesis before the formula-~
Upvotes: 3
Reputation: 1127
Try this:
survreg(Surv(Time, Censor) ~ Score, data=mydata, dist = "w", scale=1)
Upvotes: 0