# dynreg: Fit time-varying regression model In timereg: Flexible Regression Models for Survival Data

 dynreg R Documentation

## Fit time-varying regression model

### Description

Fits time-varying regression model with partly parametric components. Time-dependent variables for longitudinal data. The model assumes that the mean of the observed responses given covariates is a linear time-varying regression model :

### Usage

dynreg(
formula = formula(data),
data = parent.frame(),
aalenmod,
bandwidth = 0.5,
id = NULL,
bhat = NULL,
start.time = 0,
max.time = NULL,
n.sim = 500,
meansub = 1,
weighted.test = 0,
resample = 0
)


### Arguments

 formula a formula object with the response on the left of a '~' operator, and the independent terms on the right as regressors. data a data.frame with the variables. aalenmod Aalen model for measurement times. Specified as a survival model (see aalen function). bandwidth bandwidth for local iterations. Default is 50% of the range of the considered observation period. id For timevarying covariates the variable must associate each record with the id of a subject. bhat initial value for estimates. If NULL local linear estimate is computed. 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. n.sim number of simulations in resampling. meansub if '1' then the mean of the responses is subtracted before the estimation is carried out. weighted.test to compute a variance weighted version of the test-processes used for testing time-varying effects. resample returns resample processes.

### Details

E( Z_{ij} | X_{ij}(t) ) = β^T(t) X_{ij}^1(t) + γ^T X_{ij}^2(t)

where Z_{ij} is the j'th measurement at time t for the i'th subject with covariates X_{ij}^1 and X_{ij}^2. Resampling is used for computing p-values for tests of timevarying effects. 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. The program assumes that there are no ties, and if such are present random noise is added to break the ties.

### Value

returns an object of type "dynreg". With the following arguments:

 cum the cumulative regression coefficients. This is the efficient estimator based on an initial smoother obtained by local linear regression : \hat B(t) = \int_0^t \tilde β(s) ds+ \hspace{4 cm} \int_0^t X^{-} (Diag(z) -Diag( X^T(s) \tilde β(s)) ) dp(ds \times dz), where \tilde β(t) is an initial estimate either provided or computed by local linear regression. To plot this estimate use type="eff.smooth" in the plot() command. var.cum the martingale based pointwise variance estimates. robvar.cum robust pointwise variances estimates. gamma estimate of semi-parametric components of model. var.gamma variance for gamma. robvar.gamma robust variance for gamma. cum0 simple estimate of cumulative regression coefficients that does not use use an initial smoothing based estimate \hat B_0(t) = \int_0^t X^{-} Diag(z) dp(ds \times dz). To plot this estimate use type="0.mpp" in the plot() command. var.cum0 the martingale based pointwise variance estimates of cum0. cum.ms estimate of cumulative regression coefficients based on initial smoother (but robust to this estimator). \hat B_{ms}(t) = \int_0^t X^{-} (Diag(z)-f(s)) dp(ds \times dz), where f is chosen as the matrix f(s) = Diag( X^T(s) \tilde β(s)) ( I - X_α(s) X_α^-(s) ), where X_{α} is the design for the sampling intensities. This is also an efficient estimator when the initial estimator is consistent for β(t) and then asymptotically equivalent to cum, but small sample properties appear inferior. Its variance is estimated by var.cum. To plot this estimate use type="ms.mpp" in the plot() command. cum.ly estimator where local averages are subtracted. Special case of cum.ms. To plot this estimate use type="ly.mpp" in plot. var.cum.ly the martingale based pointwise variance estimates. gamma0 estimate of parametric component of model. var.gamma0 estimate of variance of parametric component of model. gamma.ly estimate of parametric components of model. var.gamma.ly estimate of variance of parametric component of model. gamma.ms estimate of variance of parametric component of model. var.gamma.ms estimate of variance of parametric component of model. obs.testBeq0 observed absolute value of supremum of cumulative components scaled with the variance. pval.testBeq0 p-value for covariate effects based on supremum test. sim.testBeq0 resampled supremum values. obs.testBeqC observed absolute value of supremum of difference between observed cumulative process and estimate under null of constant effect. pval.testBeqC p-value based on resampling. sim.testBeqC resampled supremum values. obs.testBeqC.is observed integrated squared differences between observed cumulative and estimate under null of constant effect. pval.testBeqC.is p-value based on resampling. sim.testBeqC.is resampled supremum values. conf.band resampling based constant to construct robust 95% uniform confidence bands. test.procBeqC observed test-process of difference between observed cumulative process and estimate under null of constant effect. sim.test.procBeqC list of 50 random realizations of test-processes under null based on resampling. covariance covariances for nonparametric terms of model.

Thomas Scheike

### References

Martinussen and Scheike, Dynamic Regression Models for Survival Data, Springer (2006).

### Examples



## this runs slowly and is therfore donttest
data(csl)
indi.m<-rep(1,length(csl$lt)) # Fits time-varying regression model out<-dynreg(prot~treat+prot.prev+sex+age,data=csl, Surv(lt,rt,indi.m)~+1,start.time=0,max.time=2,id=csl$id,
n.sim=100,bandwidth=0.7,meansub=0)
summary(out)
par(mfrow=c(2,3))
plot(out)

# Fits time-varying semi-parametric regression model.
outS<-dynreg(prot~treat+const(prot.prev)+const(sex)+const(age),data=csl,
Surv(lt,rt,indi.m)~+1,start.time=0,max.time=2,id=csl\$id,
n.sim=100,bandwidth=0.7,meansub=0)
summary(outS)



timereg documentation built on Nov. 10, 2022, 5:48 p.m.