Description Usage Arguments Details Value Note Author(s) References See Also Examples

`WCE`

implements a flexible method for modeling cumulative effects of
time-varying exposures, weighted according to their relative proximity in time,
and represented by time-dependent covariates. The current implementation
estimates the weight function in the Cox proportional hazards model. The
function that assigns weights to doses taken in the past is estimated using
cubic regression splines.

1 2 3 |

`data` |
A data frame in an interval (long) format, in which each line corresponds to one and only one time unit for a given individual. |

`analysis` |
Character string. One of 'Cox', 'NCC' or 'CC' for Cox proportional hazards model, conditional logistic regression for nested case controls (NCC) or logistic regression for case-controls (CC). Currently only 'Cox' for the Cox proportional hazards model is implemented, calling the |

`nknots` |
A scalar or a vector. Corresponds to the number(s) of interior knots for the cubic splines to estimate the weight function. For example, if |

`cutoff` |
Integer. Time window over which the WCE model is estimated. Corresponds to the length of the estimated weight function. |

`constrained` |
Controls whether the weight function should be constrained to smoothly go to zero. Set to FALSE for unconstrained models, to 'Right' or 'R' to constrain the weight function to smoothly go to zero for exposure remote in time, and to 'Left' or 'L' to constrain the weight function to start a zero for the current values. |

`int.knots` |
A vector indicating the placement of interior knots. If NULL, then interior knots are placed at quantiles of the exposure variable distribution. Default to NULL. |

`aic` |
Logical. If TRUE, then the AIC is used to select the best fitting model among those estimated for the different numbers of interior knots requested with |

`MatchedSet` |
Argument required for 'NCC' analysis only. Corresponds to the variable in |

`id` |
Name of the variable in |

`event` |
Name of the variable in |

`start` |
Name of the variable in |

`stop` |
Name of the variable in |

`expos` |
Name of the variable in |

`covariates` |
Optional. Vector of characters corresponding to the name(s) of the variable(s) in |

`controls` |
List corresponding to the control parameters to be passed to the |

`...` |
Optional; other parameters to be passed through to |

The current implementation of the `WCE`

function does not allow missing values in the `Id`

, `event`

, `start`

, `stop`

, `expos`

variables.
Intervals in `data`

determined by `start`

and `stop`

are assumed to be open on the left and closed on the right, (start, stop].
Intervals for a given individual (`Id`

) must not overlap, and must cover the entire follow-up for the individual.
The `start`

and `stop`

values for a given interval must not be equal.
Delayed entry is not implemented in this version of the `WCE`

function so all of the `Id`

must start their follow-up at the same `start`

value.

A list of 14 items:

`knotsmat` |
List of vectors of knots used for the spline modelling of the weight function(s). |

`WCEmat` |
Matrix of the estimated weight function. Each row corresponds to an estimated weight function. The number of columns in the |

`PL` |
Partial likelihood for each estimated model. |

`est` |
List of vectors of estimated coefficients for the artificial time-dependent variables used to fit the WCE model(s). |

`vcovmat` |
List of variance-covariance matrices estimated for each model. |

`SED` |
List of vectors of estimated standard errors of the estimated coefficients of the artificial time-dependent variables used to fit each WCE model. |

`beta.hat.covariates` |
List of vectors of estimated coefficients for the covariates. |

`se.covariates` |
List of vectors of standard errors of the estimated coefficients for the covariates. |

`covariates` |
Names of the covariates used in the estimation. |

`constrained` |
Indicator of whether the model(s) was(were) unconstrained, right-constrained or left-constrained. |

`ne` |
Number of events. |

`a` |
Logical value corresponding to the |

`info.criterion` |
Value of the AIC or BIC for each model estimated. |

`analysis` |
Value of the |

`...` |
Potentially, additional arguments (as required by generic). |

Note that the print method for a WCE object returns the estimated WCE function(s), the number of events, the partial likelihoods, the AIC or BIC values, the matrix of coefficients estimates for the covariates (if any) and the matrix of standard error estimates for the covariates (if any).

Marie-Pierre Sylvestre

[email protected]

Sylvestre MP, Abrahamowicz M. Flexible modeling of the cumulative effects of time-dependent exposures on the hazard. Stat Med. 2009 Nov 30;28(27):3437-53.

See also `checkWCE`

, a function to check whether the arguments passed to `WCE`

are correctly specified.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | ```
wce <- WCE(drugdata, "Cox", 1, 90, constrained = "R", id = "Id", event = "Event",
start = "Start", stop = "Stop", expos = "dose", covariates = c("age", "sex"))
## Not run:
# Confidence intervals for HR, as well as pointwise confidence bands
# for the estimated weight function can be obtained via bootstrap.
# Set the number of bootstrap resamples
#(set to 5 for demonstration purposes, should be higher)
B <- 5
# Obtain the list of ID for sampling
ID <- unique(drugdata$Id)
# Prepare vectors to extract estimated weight function and HR
# for the best-fitting model for each bootstrap resample
boot.WCE <- matrix(NA, ncol = 90, nrow=B)
boot.HR <- rep(NA, B)
# Sample IDs with replacement
for (i in 1:B) {
# select observations in bootstrap sample
datab <- drugdata[drugdata$Id %in% sample(ID, replace=TRUE),]
mod <- WCE(data = datab, analysis = "Cox", nknots = 1:3, cutoff = 90,
constrained = "R", int.knots = NULL, aic = FALSE, MatchedSet = NULL,
id = "Id", event = "Event", start = "Start", stop = "Stop",
expos = "dose", covariates = c("sex", "age"))
# return best WCE estimates and corresponding HR
best <- which.min(mod$info.criterion)
boot.WCE[i,] <- mod$WCEmat[best,]
boot.HR[i] <- HR.WCE(mod, rep(1, 90), rep(0, 90))
}
# Summarize bootstrap results using percentile method
apply(boot.WCE, 2, quantile, p = c(0.05, 0.95))
quantile(boot.HR, p = c(0.05, 0.95))
## End(Not run)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.