* Rep_Weibull Fitting to Cox Regression.sps.
* Written by PSKL on 21/05/03.

GET DATA /TYPE=XLS
   /FILE='H:\documents\PhD\Full Longitudinal\Rep_Cox Regression Survival.xls'
   /SHEET=name 'Sheet1'
   /CELLRANGE=full
   /READNAMES=on .

save outfile= 'd:\temp1.sav'
 /keep time survival.

get file=  'd:\temp1.sav'.

* Check log-cumulative hazard plot for linearity.

Compute LLS=ln(-ln( survival)).
compute Ltime=ln(time).


GRAPH
  /SCATTERPLOT(BIVAR)=Ltime WITH LLS
  /MISSING=LISTWISE
  /TITLE= 'Log Cumulative Hazard Plot '.

Graph

Notes
Output Created 30-JUN-2003 16:50:54
Comments
Input Data d:\temp1.sav
Filter <none>
Weight <none>
Split File <none>
N of Rows in Working Data File 3760
Syntax GRAPH
/SCATTERPLOT(BIVAR)=Ltime WITH LLS
/MISSING=LISTWISE
/TITLE= 'Log Cumulative Hazard Plot '.
Resources Elapsed Time 0:00:00.65

Scatter of log cumulative hazard plot

* Weibull fitting, with starting values derived from overall plot.

* NonLinear Regression.
MODEL PROGRAM LAMBDA=0.0000454 GAMMA=1 .
COMPUTE Weipred = exp(-lambda*time**gamma).
NLR survival
  /PRED WEIPRED
  /SAVE PRED RESID
  /CRITERIA SSCONVERGENCE 1E-9 PCON 1E-9 .

Non-linear Regression

Notes
Output Created 30-JUN-2003 16:50:55
Comments
Input Data d:\temp1.sav
Filter <none>
Weight <none>
Split File <none>
N of Rows in Working Data File 3760
Syntax MODEL PROGRAM LAMBDA=0.0000454 GAMMA=1 .
COMPUTE Weipred = exp(-lambda*time**gamma).
NLR survival
/PRED WEIPRED
/SAVE PRED RESID
/CRITERIA SSCONVERGENCE 1E-9 PCON 1E-9 .
Resources Elapsed Time 0:00:02.56

All the derivatives will be calculated numerically.

The following new variables are being created:

Name          Label

WEIPRED       Predicted Values
RESID         Residuals




 Iteration  Residual SS      LAMBDA       GAMMA

     1      392.0103770  .000045400  1.00000000
     1.1    647.0585693  .000762519  -.53875994
     1.2    565.8635652  .000364975  .570454345
     1.3    3.938044626  .000192013  1.05155172
     2      3.938044626  .000192013  1.05155172
     2.1    44.11958233  .000420392  .891106336
     2.2    2.579483860  .000211235  1.03157390
     3      2.579483860  .000211235  1.03157390
     3.1    2.125572178  .000260697  1.00177290
     4      2.125572178  .000260697  1.00177290
     4.1    1.594787485  .000314576  .978189283
     5      1.594787485  .000314576  .978189283
     5.1    1.616188622  .000424861  .935469092
     5.2    1.189544857  .000369166  .958269649
     6      1.189544857  .000369166  .958269649
     6.1    1.087281501  .000479780  .921413785
     7      1.087281501  .000479780  .921413785
     7.1    .5087711752  .000537900  .910642444
     8      .5087711752  .000537900  .910642444
     8.1    .4048527996  .000652686  .883993841
     9      .4048527996  .000652686  .883993841
     9.1    .2295263795  .000769212  .863530448
    10      .2295263795  .000769212  .863530448
    10.1    .1532055624  .000886313  .845705393
    11      .1532055624  .000886313  .845705393
    11.1    .1148451503  .000946855  .838232082
    12      .1148451503  .000946855  .838232082
    12.1    .1133020083  .000946314  .838591243
    13      .1133020083  .000946314  .838591243
    13.1    .1133020020  .000946255  .838599493
    14      .1133020020  .000946255  .838599493
    14.1    .1133020020  .000946257  .838599284

Run stopped after 32 model evaluations and 14 derivative evaluations.
Iterations have been stopped because the relative reduction between successive
residual sums of squares is at most SSCON = 1.000E-09


Nonlinear Regression Summary Statistics     Dependent Variable SURVIVAL

  Source                 DF  Sum of Squares  Mean Square

  Regression              2     1552.94132      776.47066
  Residual             3758         .11330   3.014955E-05
  Uncorrected Total    3760     1553.05462

  (Corrected Total)    3759      105.50339

  R squared = 1 - Residual SS / Corrected SS =     .99893

                                           Asymptotic 95 %
                          Asymptotic     Confidence Interval
  Parameter   Estimate    Std. Error     Lower         Upper

  LAMBDA      .000946257  4.68873E-06   .000937064   .000955450
  GAMMA       .838599284   .000641805   .837340964   .839857604

  Asymptotic Correlation Matrix of the Parameter Estimates

              LAMBDA     GAMMA

  LAMBDA      1.0000    -.9981
  GAMMA       -.9981    1.0000

GRAPH
  /SCATTERPLOT(OVERLAY)=time time  WITH survival weipred (PAIR)
  /MISSING=LISTWISE .

Graph

Notes
Output Created 30-JUN-2003 16:50:58
Comments
Input Data d:\temp1.sav
Filter <none>
Weight <none>
Split File <none>
N of Rows in Working Data File 3760
Syntax GRAPH
/SCATTERPLOT(OVERLAY)=time time WITH survival weipred (PAIR)
/MISSING=LISTWISE .
Resources Elapsed Time 0:00:00.54

Scatter of survival weipred time time

SAVE TRANSLATE OUTFILE='I:\Research Projects\Longevity\Rep_Weibull Fitting to Cox Regression.xls'
  /TYPE=XLS /MAP /REPLACE /FIELDNAMES.

Data written to I:\Research Projects\Longevity\Rep_Weibull Fitting to Cox Regression.xls.
6 variables and 3760 cases written to range: SPSS.
Variable: TIME       Type: Number   Width: 11   Dec: 0



Variable: SURVIVAL   Type: Number   Width: 11   Dec: 5
Variable: LLS        Type: Number   Width:  8   Dec: 2
Variable: LTIME      Type: Number   Width:  8   Dec: 2
Variable: WEIPRED    Type: Number   Width:  8   Dec: 2
Variable: RESID      Type: Number   Width:  8   Dec: 2