Listings

Listing 6.1 Simple PEANUTS Models

! PEANUTS Examples 6.1 to 6.4

NAMES cases time group @

INPUT ../exdata/feigl.dat @

! Fit baseline hazard only

FIT @

! Estimate group effect and compute likelihood ratio test

NULL

FIT group @

LRT

! Compute Wald and LR bounds

CI @

BOUND 1 @

! Define time-dependent covariates for test of proportional hazards

TTRAN grt = group*%TIME @

! Fit model with time trend in RR and compute LRT

NULL

FIT +grt @

LRT

! Determine cutpoints and define time category variable

QUANTILES time ; WEIGHT cases TERTILES @

TTRAN tcat = 1 + (%TIME >= 6) + (%TIME >=12) @

TLEVEL tcat @

! Fit time category model

FIT tcat*group @

LRT

! Frequency table for cases

TRAN gr = group ; tc = 1 + (time >= 6) + (time >= 12) @

LEVEL gr tc @

FREQ gr tc ; WEIGHT cases @

 

 

Listing 6.2 Plots and Stratification in PEANUTS

! PEANUTS Examples 6.5 to 6.11

! Commands to read the lung cancer trial data

NAMES cases time status dxmnths age prior trmnt cell @

INPUT ../exdata/lung.dat @

TRAN stat50 = status - 50 ; age60 = age - 60 ; trmnt = trmnt - 1 @

LEVELS cell @

FIT cell stat50 age60 dxmnths prior trmnt @

! Print hazard function estimates and plot survival function

SCURV @

! Survival function with restricted time range (no table)

SCURV TMAX 200 @

! Hazard function plot with restricted time scale

SCURV HAZA TMAX 200 @

! Cumulative hazard function plot

SCURV CHAZ @

! Log cumulative hazard versus log time

SCURV LCHAZ LOGTIME TMAX 200 @

! Create variables and fit model for alternate baseline conditions

 TRAN

  notrmnt = 1 - trmnt ;

  stat90 = status - 90 ;

  dxmn6 = dxmnths - 6 ;

  age40 = age - 40 ;

@

LOGL 0 cell stat90 age40 dxmn6 prior notrmnt @

PARA 2=0 @

FIT @

! Plot the survival function

SCURV SURV TIME @

! Plot the smoothed hazard function

SCURV HAZA TMAX 300 NOTABLE @

! A stratified model

STRATA cell @

FIT - cell @

! Plots (unsmoothed) for the stratified model

SCURV SURV @

SCURV LCHAZ LOGTIME TMIN 10 TMAX 400 @

 

Listing 6.3 Generalized Models in PEANUTS

! PEANUTS Examples 6.12 to 6.14

! Commands to read the lung cancer trial data

NAMES cases time status dxmnths age prior trmnt cell @

INPUT ../exdata/lung.dat @

TRAN stat50 = status - 50 ; age60 = age - 60 ; trmnt = trmnt - 1 @

LEVELS cell @

! Fit a simple model

FIT cell stat50 trmnt @

CI @

BOUND 6 @

! Refit this model in a generalized form

LINE 1 trmnt @

FIT - trmnt @

! Compute bounds

CI @

BOUND 6 @

! Test for cell-type-by-treatment interaction

NULL

LINE 1 cell * trmnt @

FIT @

LRT

! Add Karnofsky status interaction

LOGL 1 stat50 @

FIT @

! Display the parameter estimate correlation matrix

CI CORR @

! Fit a stratified model

STRATA cell @

LOGL 1 - stat50 @

FIT - cell @

 

Listing 6.4 Generalized Models in PEANUTS with Time-dependent Covariates

! PEANUTS Examples 6.15 to 6.16

  NAMES id bmo bdy byr accmo accdy accyr trmo trdy tryr xmo xdy xyr

   age surv surgery allele antigen mismtch reject @

  INPUT ../exdata/sheart.dat @

! Define dates at program origin

    CONS #c1067 = JULIAN(1967,10,1) ; #c0167=julian(1967,1,1) @

TRAN

! Modify years to 4 digit years

byr = byr + 1900 ;

accyr = accyr + 1900 ;

tryr = tryr + 1900 ;

xyr = xyr + 1900 ;

! Compute age at acceptance, acceptance date, and survival time

cage = (JULIAN(accyr,accmo,accdy) - JULIAN(byr,bmo,bdy))/365.25 ;

accdt = JULIAN(accyr,accmo,accdy) -1 ;

stime = JULIAN(xyr,xmo,xdy) - accdt ;

IF tryr == 1900 THEN

! Recode for nontransplant subjects

allele = %mv ;

antigen = %mv ;

mismtch = %mv ;

tryr = xyr ; trmo = xmo ; trdy = xdy ;

trns = 0 ;

ELSE

! Recode for transplant subjects

       trns = 1 ;

ENDIF

! Compute exit date, waiting time, and post-transplant survival time

xtdt = JULIAN(tryr,trmo,trdy) ;

wait = xtdt - accdt;

post = stime - wait ;

! Special status code for pre-transplant analyses

IF trns == 1 THEN prestat = 0 ELSE prestat = surv ENDIF

! Compute time since 10/1/67 at exit date and since 1/1/67 at acceptance

ctime = xtdt - #c1067 ;

acc = (accdt - #c0167)/365.25 ;

! Indicator for deselected subjects

ds = (id == 26) or (id == 27) or (id == 82) ;

@

CASES surv @

TIME stime @

FIT @

NULL

TTRAN ht = %TIME > wait @

FIT ht @

LRT

FIT acc ht acc*ht @

FIT age acc surgery ht ht*age ht*acc ht*surgery @

TTRAN preht = 1 - ht @

FIT preht*age preht*acc preht*surgery ht ht*age ht*acc ht*surgery @

! Pre-transplant analysis

CASES prestat @

TIME wait @

TTRAN @

FIT acc age surgery @

! Post-transplant analysis

CASES surv @

TIME post @

SELECT trns == 1 @

FIT @