casecrossover: Fit a case crossover model with linear and non-parametric...

Description Usage Arguments Value

View source: R/06-casecrossover.R

Description

Fit a case crossover model as described in Stringer et. al. (2019). A case crossover model is used to quantify the association between mortality risk and short-term exposure to environmental risk factors such as extreme temperatures or air pollution. Multiple exposure records are available for a collection of subjects who have died, including exposure on the death day and one or more previous days. Higher exposure on date of death indicates a positive association between exposure and mortality risk.

This function fits a case crossover model with linear and/or non-parametric terms. It has a typical R formula interface, y ~ x, with the following special terms allowed:

- s(x) fits a smooth (non-parametric) risk curve to covariate x, using a RW2 model, - strata(id) indicates that the variable id groups together records from the same subject. Your formula must have an id.

See the package vignette for detailed examples.

Usage

1

Arguments

formula

An R formula, which can contain s() terms and must contain a strata() term.

data

An object inheriting from class data.frame, typically a tibble or a data.table. Must contain multiple rows for each subject, with an id variable which states which records are from the same subject. Must have one case day and one or more control days per subject. There should be a case variable which equals 0 for control days and equals a positive integer for case days. See the vignette.

control

An object created using cc_control(). This is used to specify priors and linear constraints for the s() terms. You can also set internal control parameters for the optimization.

verbose

Logical, print progress updates and debugging information? Default FALSE.

Value

An object of class "cc_fit", with methods for summary() and plot().


awstringer1/casecrossover documentation built on March 11, 2021, 4:41 a.m.