[R] differences between survival models between STATA and R

Robert W. Baer rbaer at atsu.edu
Mon Jul 9 17:16:18 CEST 2012


On 7/9/2012 9:17 AM, Javier Palacios Fenech wrote:
> Please.
After, Terry's response I guess I was expecting to hear how your 
comparison between R and STATA went when you used the R function, 
survreg() for your analysis.

We still don't know what your data look like.  The posting guide asks 
for a "reproducible example".  This typically means including at least a 
"toy dataset" if not the actual data you are using.

To learn more:
library(survival)
?survreg
>
> find an example here. With exactly the same data set, I run two hazard
> models following the instructions for each function.
>
> aftreg(formula = Surv(sta, sto, S) ~ a + b + c + d +   e + f + g
> , factor(F), data = data.frame(SURV),
>      dist = "weibull", id = ID)
>
> streg  f1 f2 f3 f4 f5 a b c d g f g,  dist(weibull)   time nolog    (note:
> F= f1, f2,f3,f4,f5)
>
> Results are different. Really different. With aftreg some estimates are
> significant, and with STATA they are not. Many estimates do not even have
> the same sign, therefore predicting contrary effects. Which model should I
> trust?
>
> Best,
>
> J
>
>
>
>
>
> On Mon, Jul 9, 2012 at 9:59 AM, Terry Therneau <therneau at mayo.edu> wrote:
>
>> Without more information, we can only guess what you did, or what you are
>> seeing on the page that is "different".
>>
>> I'll make a random guess though.  There are about 5 ways to paramaterize
>> the Weibull distribution.  The standard packages that I know, however, tend
>> to use the one found in the Kalbfleisch and Prentice book The Statistical
>> Analysis of Failure time Data.  This includes the survreg funciton in R and
>> lifereg in SAS, and likely stata tthought I don't know that package.  The
>> aftreg function in the eha package uses something different.
>>
>> About 1/2 the weibull questions I see are due to a change in parameters.
>>
>> Terry T.
>>
>> ---- begin included message -----
>>
>>
>>
>>
>> Dear Community,
>>
>> I have been using two types of survival programs to analyse a data set.
>>
>> The first one is an R function called aftreg. The second one an STATA
>> function called streg.
>>
>> Both of them include the same analyisis with a weibull distribution. Yet,
>> results are very different.
>>
>> Shouldn't the results be the same?
>>
>> Kind regards,
>> J
>>
>>
>



More information about the R-help mailing list