My intension is to use these commands with weights that I previously estimated in R. My problem is that my results are exactly the same before and after applying the weights. This is not the case when I run the same methods on R.
I need to use Stata because there are other methods that I would like to apply to the weighted dataset which are only available in Stata, for example stpm2cr. More important, I would like to know if I am doing something wrong in the application of weights.
Code:
*without weights stset time, failure(status==1) stpm2 treatment X1 X2 X3 X4, scale(hazard) df(3) *with weights stset time [pw=weights], failure(status==1) stpm2 treatment X1 X2 X3 X4, scale(hazard) df(3)
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input byte(time status) double weights float(treatment X1 X2 X3 X4) 3 0 1.4604129 15 10 2605.559 8 12 11 0 23.083236 15 10 20 8 3278.887 1 1 .48926576 15 1503.3397 20 8 12 2 1 .46333202 15 2386.374 20 8 12 17 1 .6506184 15 10 20 8 12 1 1 2.1885115 15 382.853 20 8 12 6 0 .66756524 15 10 20 8 12 5 1 1.2288773 15 145.71672 20 156.42982 12 3 1 .65057605 15 10 20 8 12 12 0 .84084604 15 10 20 8 12 2 1 .95130992 15 1070.0483 20 8 12 2 1 .91851318 15 10 20 8 12 2 0 .65573917 15 10 20 8 12 1 1 .71186415 15 10 20 8 12 2 1 3.2528202 15 10 20 8 12 3 1 .92747711 15 587.6436 20 8 12 2 0 .68974901 15 10 20 8 12 3 1 .65163102 15 1200.7521 20 8 12 24 0 .67443723 15 10 20 12.05285 12 1 1 1.2309379 15 1207.485 20 8 12 26 0 1.8565074 15 10 20 8 12 3 1 .96479149 15 10 20 8 12 2 0 .70658756 15 10 20 8 12 5 1 .88191331 15 192.86145 20 8 12 10 1 .88146971 15 10 313.3779 8 12 14 0 .83921143 15 314.0365 20 8 12 2 1 .83636617 15 10 20 8 12 2 0 .04888261 15 10 3273.6006 8 12 6 1 .65229927 15 10 20 8 12 6 1 .42746456 15 1183.8452 1655.827 8 12 6 0 .65086466 15 10 20 8 12 1 1 5.1154777 15 2334.6 20 8 12 9 1 1.1140292 15 10 20 8 12 1 1 .13345336 15 2341.2798 20 8 12 3 0 .62912737 15 10 2024.962 8 12 1 1 1.6312554 15 10 20 8 12 9 1 .78533731 15 10 20 8 12 30 0 1.0038068 15 10 20 8 12 7 0 .70452734 15 10 20 8 12 16 0 .92091238 15 10 611.4637 8 12 4 0 .93993108 15 10 76.1757 8 12 21 1 .65929165 15 10 20 8 12 1 0 1.2487904 15 413.9762 20 8 12 2 1 .16289446 15 2457.991 20 8 12 6 1 .13342259 15 3343.1545 20 8 12 10 1 .87474915 15 10 20 8 12 4 1 1.1920197 15 173.78465 20 8 12 30 0 .99722067 15 10 20 8 12 2 0 .66238793 15 10 20 8 12 13 0 .88021289 15 10 453.8784 8 12 26 0 .85527902 15 10 20 8 12 2 1 1.4221644 15 10 465.9346 8 12 10 1 .65338268 15 10 20 8 12 1 0 .80789489 15 10 20 8 12 2 0 1.1671576 15 10 20 8 12 2 1 1.1651706 15 605.37604 20 8 12 15 1 .75858948 15 10 175.63806 8 12 15 1 .82070603 15 10 20 8 12 29 1 .7656754 15 10 145.83495 8 12 3 1 .63747885 15 1489.353 1380.4884 8 12 29 0 .65339315 15 10 20 8 12 1 1 .25808769 15 2361.5754 20 8 12 1 1 .19123299 15 2461.6355 20 8 12 19 1 1.3935881 15 10 20 8 12 2 1 1.6890985 15 407.8892 20 8 12 7 1 1.5301718 15 10 20 256.97437 12 3 1 1.4760532 15 10 187.54504 8 12 19 0 4.02731 15 1997.6754 20 8 12 1 0 .90140108 15 10 20 8 12 7 0 .93141544 15 10 20 8 12 1 1 1.404244 15 88.35081 20 8 402.98465 1 0 6.6182105 15 317.3073 20 8 12 15 1 .86335156 15 10 20 187.9944 12 9 1 .66942946 15 10 20 8 39.63388 1 0 .6591931 15 10 20 8 12 2 1 .10345764 15 2500.829 20 8 12 1 0 .28990141 15 2411.8962 20 8 12 14 0 1.0079619 15 10 20 503.33975 12 6 0 .75937 15 10 1052.7992 8 12 4 1 .65606119 15 10 20 8 12 15 0 .65064123 15 10 20 8 12 4 0 .65178225 15 10 1287.235 8 12 5 0 .48942932 15 10 1519.4556 8 12 5 1 .72200763 15 10 20 8 12 23 0 1.3289784 15 10 20 155.78465 12 14 0 2.7602864 15 10 20 8 12 5 0 .71546041 15 1094.6628 20 8 12 3 0 .66982245 15 10 20 8 12 22 0 .77654105 15 10 20 248.5658 12 12 0 .97220879 15 10 20 8 12 1 1 .39323613 15 1608.7666 20 8 12 6 0 .71816694 15 10 20 8 12 4 1 .44544529 15 1630.9617 20 8 12 10 1 1.3503812 15 10 20 17.642162 12 7 0 .95570709 15 10 20 8 12 1 1 6.0525292 15 10 20 8 12 6 1 3.4503232 15 10 20 8 12 30 0 .66612439 15 10 20 8 12 8 0 .69383394 15 10 20 8 12 4 1 .70326604 15 10 20 8 12 end
0 Response to Survival model (stpm2) using previously estimated weights.
Post a Comment