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) ) =
β^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.

1 2 3 |

`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. |

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.

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

`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
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).
where
where This is also an efficient estimator when the initial estimator is
consistent for 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

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | ```
## 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)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.