Learn R Programming

timereg (version 1.8.6)

dynreg: 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 :

$$E( Z_{ij} | X_{ij}(t) ) = \beta^T(t) X_{ij}^1(t) + \gamma^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.

Usage

dynreg(formula,data=sys.parent(),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.
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.
id
For timevarying covariates the variable must associate each record with the id of a subject.
n.sim
number of simulations in resampling.
weighted.test
to compute a variance weighted version of the test-processes used for testing time-varying effects.
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.
bhat
initial value for estimates. If NULL local linear estimate is computed.
meansub
if '1' then the mean of the responses is subtracted before the estimation is carried out.
resample
returns resample processes.

Value

  • returns an object of type "dynreg". With the following arguments:
  • cumthe 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 \beta(s) ds+ \hspace{4 cm}$$ $$\int_0^t X^{-} (Diag(z) -Diag( X^T(s) \tilde \beta(s)) ) dp(ds \times dz),$$ where $\tilde \beta(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.cumthe martingale based pointwise variance estimates.
  • robvar.cumrobust pointwise variances estimates.
  • gammaestimate of semi-parametric components of model.
  • var.gammavariance for gamma.
  • robvar.gammarobust variance for gamma.
  • cum0simple 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.cum0the martingale based pointwise variance estimates of cum0.
  • cum.msestimate 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 \beta(s)) ( I - X_\alpha(s) X_\alpha^-(s) ),$$ where $X_{\alpha}$ is the design for the sampling intensities.

    This is also an efficient estimator when the initial estimator is consistent for $\beta(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.lyestimator where local averages are subtracted. Special case of cum.ms. To plot this estimate use type="ly.mpp" in plot.
  • var.cum.lythe martingale based pointwise variance estimates.
  • gamma0estimate of parametric component of model.
  • var.gamma0estimate of variance of parametric component of model.
  • gamma.lyestimate of parametric components of model.
  • var.gamma.lyestimate of variance of parametric component of model.
  • gamma.msestimate of variance of parametric component of model.
  • var.gamma.msestimate of variance of parametric component of model.
  • obs.testBeq0observed absolute value of supremum of cumulative components scaled with the variance.
  • pval.testBeq0p-value for covariate effects based on supremum test.
  • sim.testBeq0resampled supremum values.
  • obs.testBeqCobserved absolute value of supremum of difference between observed cumulative process and estimate under null of constant effect.
  • pval.testBeqCp-value based on resampling.
  • sim.testBeqCresampled supremum values.
  • obs.testBeqC.isobserved integrated squared differences between observed cumulative and estimate under null of constant effect.
  • pval.testBeqC.isp-value based on resampling.
  • sim.testBeqC.isresampled supremum values.
  • conf.bandresampling based constant to construct robust 95% uniform confidence bands.
  • test.procBeqCobserved test-process of difference between observed cumulative process and estimate under null of constant effect.
  • sim.test.procBeqClist of 50 random realizations of test-processes under null based on resampling.
  • covariancecovariances for nonparametric terms of model.

Details

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.

References

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

Examples

Run this code
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)

Run the code above in your browser using DataLab