matchtime

An R-Package to perform Time-Dependent Matching for Observational Data in Discrete and Continuous Time

https://github.com/robindenz1/matchtime

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (19.8%) to scientific vocabulary

Keywords

causal-inference confounding matching time
Last synced: 6 months ago · JSON representation

Repository

An R-Package to perform Time-Dependent Matching for Observational Data in Discrete and Continuous Time

Basic Info
Statistics
  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Topics
causal-inference confounding matching time
Created over 1 year ago · Last pushed 7 months ago
Metadata Files
Readme Changelog License Codemeta

README.Rmd

---
output: github_document
---



```{r, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)
```


[![Project Status: WIP - Initial development is in progress, but there has not yet been a stable, usable release suitable for the public.](https://www.repostatus.org/badges/latest/wip.svg)](https://www.repostatus.org/#wip)
[![](https://www.r-pkg.org/badges/version/MatchTime?color=green)](https://cran.r-project.org/package=MatchTime)
[![](http://cranlogs.r-pkg.org/badges/grand-total/MatchTime?color=blue)](https://cran.r-project.org/package=MatchTime)
[![R-CMD-check](https://github.com/RobinDenz1/MatchTime/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/RobinDenz1/MatchTime/actions/workflows/R-CMD-check.yaml)
[![Codecov test coverage](https://codecov.io/gh/RobinDenz1/MatchTime/graph/badge.svg)](https://app.codecov.io/gh/RobinDenz1/MatchTime)


# MatchTime 

`MatchTime` is an R-Package which can be used to perform different sorts of time-dependent matching, which is also known as *sequential trial emulation*. In this type of matching, the treatment, outcome, and confounders are allowed to change over time. At each point in time where individuals switch from "untreated" to "treated", controls which at this point in time are still "untreated" are matched to these individuals using standard matching methods. The point in time that this matching occurred is considered to be the "point of randomization" or "time-zero" for both cases and their matched controls. The result is a dataset that can be analyzed using standard time-to-event methods, such as simple Cox proportional-hazards regression models, even when
complex forms of time-dependent confounding and treatment-confounder feedback are present in the data.
 
The package is designed to be as similar as possible to the excellent `MatchIt` package, and implements direct support for it when matching at each separate point in time. It supports treatment and covariate changes in discrete and continuous time by requiring the user to input *start-stop* data. Because generating and dealing with start-stop data can be difficult, it also implements various functions to make this easier for the user. Large parts of `MatchTime` were originally developed for the purpose of analyzing data from a large German health-insurance provider. As such, the functions are designed to be very fast and RAM efficient, relying almost entirely on the `data.table` package internally. Input datasets with ~ 20 million rows can be used in any function on a regular computer without any issues.

Note that this package is still in early phases of development. Large breaking changes may therefore occur without any warnings.

## Installation

The developmental version may be installed from github using the `remotes` R-Package:

```R
library(remotes)

remotes::install_github("RobinDenz1/MatchTime")
```

## Bug Reports and Feature Requests

If you encounter any bugs or have any specific feature requests, please file an [Issue](https://github.com/RobinDenz1/MatchTime/issues).

## Example

A small example for time-dependent matching on continuous start-stop data is given below, using the `heart` dataset from the `survival` package:

```{r, warning=FALSE, message=FALSE}
library(data.table)
library(MatchTime)
library(MatchIt)
library(survival)

data("heart")

set.seed(1234)

m_obj <- match_time(transplant ~ age + surgery, data=heart, id="id",
                    match_method="nearest")
```

As in `MatchIt`, balance statistics (at "baseline") can be calculated using:

```{r}
summary(m_obj)
```

The actual number of cases and matched controls over time, as well as the number of potential controls at these points in time can additionally be visualized using:

```{r example_plot}
plot(m_obj)
```

In this particular example, after around t = 45, there are no potential controls anymore, because no replacement was used and there are more cases than controls.

## Citation

Use `citation("MatchTime")` to get the relevant citation information.

## License

© 2024 Robin Denz

The contents of this repository are distributed under the GNU General Public License. You can find the full text of this License in this github repository. Alternatively, see .

Owner

  • Name: Robin Denz
  • Login: RobinDenz1
  • Kind: user

I am a researcher at the Ruhr-University of Bochum in Germany and am currently enrolled as a PhD Student in "Epidemiology & Clinical Research".

CodeMeta (codemeta.json)

{
  "@context": "https://doi.org/10.5063/schema/codemeta-2.0",
  "@type": "SoftwareSourceCode",
  "identifier": "MatchTime",
  "description": "More about what it does (maybe more than one line) Use four spaces when indenting paragraphs within the Description.",
  "name": "MatchTime: Perform Time-Dependent Matching for Time-To-Event Outcomes",
  "license": "https://spdx.org/licenses/GPL-3.0",
  "version": "0.1.0",
  "programmingLanguage": {
    "@type": "ComputerLanguage",
    "name": "R",
    "url": "https://r-project.org"
  },
  "runtimePlatform": "R version 4.2.1 (2022-06-23 ucrt)",
  "author": [
    {
      "@type": "Person",
      "givenName": "Robin",
      "familyName": "Denz",
      "email": "robin.denz@rub.de"
    }
  ],
  "maintainer": [
    {
      "@type": "Person",
      "givenName": "Robin",
      "familyName": "Denz",
      "email": "robin.denz@rub.de"
    }
  ],
  "softwareSuggestions": [
    {
      "@type": "SoftwareApplication",
      "identifier": "MatchIt",
      "name": "MatchIt",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=MatchIt"
    },
    {
      "@type": "SoftwareApplication",
      "identifier": "simDAG",
      "name": "simDAG",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=simDAG"
    },
    {
      "@type": "SoftwareApplication",
      "identifier": "knitr",
      "name": "knitr",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=knitr"
    },
    {
      "@type": "SoftwareApplication",
      "identifier": "rmarkdown",
      "name": "rmarkdown",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=rmarkdown"
    },
    {
      "@type": "SoftwareApplication",
      "identifier": "testthat",
      "name": "testthat",
      "version": ">= 3.2.1",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=testthat"
    },
    {
      "@type": "SoftwareApplication",
      "identifier": "covr",
      "name": "covr",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=covr"
    }
  ],
  "softwareRequirements": {
    "1": {
      "@type": "SoftwareApplication",
      "identifier": "data.table",
      "name": "data.table",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=data.table"
    },
    "2": {
      "@type": "SoftwareApplication",
      "identifier": "fastmatch",
      "name": "fastmatch",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=fastmatch"
    },
    "SystemRequirements": null
  },
  "fileSize": "173.365KB",
  "codeRepository": "https://github.com/RobinDenz1/MatchTime"
}

GitHub Events

Total
  • Public event: 1
  • Push event: 16
Last Year
  • Public event: 1
  • Push event: 16

Dependencies

.github/workflows/R-CMD-check.yaml actions
  • actions/checkout v4 composite
  • r-lib/actions/check-r-package v2 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/pkgdown.yaml actions
  • JamesIves/github-pages-deploy-action v4.5.0 composite
  • actions/checkout v4 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/test-coverage.yaml actions
  • actions/checkout v4 composite
  • actions/upload-artifact v4 composite
  • codecov/codecov-action v5 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
DESCRIPTION cran
  • cobalt * imports
  • data.table * imports
  • fastmatch * imports
  • MatchIt * suggests
  • covr * suggests
  • ggplot2 * suggests
  • ggtext * suggests
  • knitr * suggests
  • methods * suggests
  • rmarkdown * suggests
  • survival * suggests
  • testthat >= 3.2.1 suggests