two.stage.reg {timereg} | R Documentation |
Fit Clayton-Oakes-Glidden Two-Stage model with Cox-Aalen marginals and regression on the variance parameters.
The key here is that the variance is allowed to depend on covariates fixed within clusters
theta_{k} = Q_{k}^T nu
The simple univariate model can also be fitted by the two.stage function.
Fits an Cox-Aalen survival model. Time dependent variables and counting process data (multiple events per subject) are not possible !
The marginal baselines are on the Cox-Aalen form
λ_{ki}(t) = Y_{ki}(t) ( X_{ki}^T(t) α(t) ) exp(Z_{ki}^T β )
The model thus contains the Cox's regression model and the additive hazards model as special cases. (see cox.aalen function for more on this).
The modelling formula uses the standard survival modelling given in the survival package.
two.stage.reg(formula=formula(data),data=sys.parent(),beta=0,Nit=10, detail=0,start.time=0,max.time=NULL,id=NULL,clusters=NULL, robust=1,rate.sim=1,beta.fixed=0,theta=NULL,theta.des=NULL)
formula |
a formula object with the response on the left of a '~' operator, and the independent terms on the right as regressors. The response must be a survival object as returned by the `Surv' function. Terms with a proportional effect are specified by the wrapper prop(), and cluster variables (for computing robust variances) by the wrapper cluster(). |
data |
a data.frame with the variables. |
start.time |
start of observation period where estimates are computed. |
max.time |
end of observation period where estimates are computed. Estimates thus computed from [start.time, max.time]. Default is max of data. |
robust |
to compute robust variances and construct processes for resampling. May be set to 0 to save memory. |
id |
For timevarying covariates the variable must associate each record with the id of a subject. |
clusters |
cluster variable for computation of robust variances. |
beta |
starting value for relative risk estimates |
Nit |
number of iterations for Newton-Raphson algorithm. |
detail |
if 0 no details is printed during iterations, if 1 details are given. |
rate.sim |
rate.sim=1 such that resampling of residuals is based on estimated martingales and thus valid in rate case, rate.sim=0 means that resampling is based on counting processes and thus only valid in intensity case. |
beta.fixed |
option for keeping beta in the Cox-Aalen model fixed. |
theta |
starting values for the frailty variance (default=0.1). |
theta.des |
design for regression for variances. The defauls is NULL that is equivalent to just one theta and the design with only a baseline. |
The data for a subject is presented as multiple rows or 'observations', each of which applies to an interval of observation (start, stop]. For counting process data with the )start,stop] notation is used the 'id' variable is needed to identify the records for each subject. Only one record per subject is allowed in the current implementation for the estimation of theta. The program assumes that there are no ties, and if such are present random noise is added to break the ties.
returns an object of type "two.stage". With the following arguments:
cum |
cumulative timevarying regression coefficient estimates are computed within the estimation interval. |
var.cum |
the martingale based pointwise variance estimates. |
robvar.cum |
robust pointwise variances estimates. |
gamma |
estimate of parametric components of model. |
var.gamma |
variance for gamma. |
robvar.gamma |
robust variance for gamma. |
D2linv |
inverse of the derivative of the score function. |
score |
value of score for final estimates. |
theta |
estimate of Gamma variance for frailty. |
var.theta |
estimate of variance of theta. |
S.theta |
estimate of derivative of score of theta. |
Thomas Scheike
Glidden (2000), A Two-Stage estimator of the dependence parameter for the Clayton Oakes model.
Martinussen and Scheike, Dynamic Regression Models for Survival Data, Springer (2006).
library(survival) data(diabetes) # Marginal Cox model with treat as covariate fit<-two.stage.reg(Surv(time,status) ~ prop(treat) + cluster(id), diabetes,Nit=40,theta=1) summary(fit) # Stratification after adult theta.des<-model.matrix(~-1+factor(adult),diabetes); des.t<-model.matrix(~-1+factor(treat),diabetes); design.treat<-cbind(des.t[,-1]*(diabetes$adult==1), des.t[,-1]*(diabetes$adult==2)) fit.s<-two.stage.reg(Surv(time,status) ~ -1+factor(adult)+prop(design.treat)+cluster(id), diabetes,Nit=40,theta=1,theta.des=theta.des) summary(fit.s) # test for common baselines fit.s1<-cox.aalen(Surv(time,status) ~ factor(adult)+prop(design.treat)+cluster(id),diabetes) summary(fit.s1) # with common baselines and common treatment effect (although test reject this) fit.s2<-two.stage.reg(Surv(time,status) ~+1+prop(treat) + cluster(id), diabetes,Nit=40,theta=1,theta.des=theta.des) summary(fit.s2) # test for same variance among the two strata theta.des<-model.matrix(~factor(adult),diabetes); fit.s3<-two.stage.reg(Surv(time,status) ~+1+prop(treat)+cluster(id), diabetes,Nit=40,theta=1,theta.des=theta.des) summary(fit.s3)