Forms vectors for fitting a proportional hazards model as a generalized linear model (R.W. Payne).
||Subject corresponding to each observation|
||Time of each observation|
||Contains the value 1 for censored observations, otherwise 0; if unset it is assumed that there is no censoring|
||Response variate for the generalized linear model|
||Mapping variate used to produce the expanded variables|
||Expanded subjects factor|
||Expanded times factor|
||Offset variate for fitting the proportional hazards model|
||Lists the x-variables that are to be expanded|
||Identifiers to store the expanded x-variables; if no
The data for a proportional hazards model consist of a set of subjects observed at one or more times. The final time is usually at the time of death (or failure), otherwise (if the subject survives the trial) the observation is said to be censored. The
CENSORED option of
RPHVECTORS can be used to specify a variate with an entry for each subject containing one when there is censoring, and zero when there is no censoring. If this is not specified, it is assumed that there is no censoring. The
SUBJECTS option can specify a factor to indicate the subject corresponding to each observation; this can be omitted if there is only one observation per subject. The time at which each observation was made must be specified by the
TIMES option, in either a factor or a variate.
The proportional hazards model (Cox 1972) can be fitted in Genstat using the
RPHFIT procedure. To fit this as a generalized linear model, the vectors in the model must be expanded so that, for each subject, there is a unit for every time interval up to the last one during which the subject was observed. If (as usually happens) the subject was not observed at every cutpoint, the covariates and treatment factors are taken to be constant during the intervals between the times of the observations.
RPHVECTORS is used by
RPHFIT to produce these expanded vectors, and is made available as a Library procedure in its own right to allow you to program your own proportional hazards analyses. The variates and factors to be expanded are specified using the
X parameter, and the
NEWX parameter can specify identifiers for the each expanded variate or factor. If
NEWX is not specified, the expanded version will replace the original one. The
INDEX option allows the variate of indexes used to produce the expanded vectors from the original ones to be saved. The
NEWTIMES option can save an expanded factor indicating the time interval corresponding to each unit of the expanded vectors, and the
NEWSUBJECTS option can save an expanded factor indicating the subject corresponding to each of their units. The
RESPONSE option saves a variate containing one or zero according to whether or not the relevant subject “responded” (i.e. died or failed) during the time period corresponding to each unit of the expanded vectors.
The generalized linear model also needs an offset variate, containing the log of the exposure time corresponding to each units of the expanded variables. This can be saved using the
NEWOFFSET option. This will incorporate any additional offset, which can be specified by the
RPHVECTORS uses the standard Genstat manipulation commands.
None of the vectors must be restricted, and any restrictions will be cancelled.
Cox, D.R. (1972). Regression models and life tables (with discussion). Journal of the Royal Statistical Society B, 34, 187-220.
Commands for: Survival analysis.
CAPTION 'RPHVECTORS example',\ 'Data from Gehan (1965, Biometrika, 52, 203-223).';\ STYLE=meta,plain VARIATE [VALUES=1,1,2,2,3,4,4,5,5,8,8,8,8,11,11,12,12,15,17,22,23,\ 6,6,6,6,7,9,10,10,11,13,16,17,19,20,22,23,25,32,32,34,35] Time & [VALUES=24(0),1,0,1,0,1,1,0,0,1,1,1,0,0,1,1,1,1,1] Censor FACTOR [LABELS=!t(control,'6-mercaptopurine'); VALUES=21(1,2)] Treatment FACTOR [LEVELS=42; VALUES=1...42] Subject RPHVECTORS [TIMES=Time; SUBJECTS=Subject; CENSORED=Censor; RESPONSE=Yvar;\ INDEX=Index; NEWTIMES=ExTimes; NEWSUBJECTS=ExSubj]\ Treatment; NEWX=ExTreatment PRINT Yvar,ExSubj,ExTimes,Index,ExTreatment;\ FIELD=4(9),18; DECIMALS=0