{"id":32207765,"url":"https://github.com/wittenberg/vlad","last_synced_at":"2025-10-22T05:59:16.096Z","repository":{"id":50996323,"uuid":"121756003","full_name":"wittenberg/vlad","owner":"wittenberg","description":"Variable Life Adjusted Display and other risk-adjusted quality control charts","archived":false,"fork":false,"pushed_at":"2021-05-26T08:26:14.000Z","size":1005,"stargazers_count":7,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-10-22T05:59:14.665Z","etag":null,"topics":["cpp","healthcare","quality-control","r","risk-adjustment","surgery"],"latest_commit_sha":null,"homepage":"","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wittenberg.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-02-16T13:50:10.000Z","updated_at":"2024-11-27T18:15:59.000Z","dependencies_parsed_at":"2022-09-22T14:25:57.935Z","dependency_job_id":null,"html_url":"https://github.com/wittenberg/vlad","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/wittenberg/vlad","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wittenberg%2Fvlad","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wittenberg%2Fvlad/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wittenberg%2Fvlad/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wittenberg%2Fvlad/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wittenberg","download_url":"https://codeload.github.com/wittenberg/vlad/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wittenberg%2Fvlad/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280389299,"owners_count":26322507,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-22T02:00:06.515Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpp","healthcare","quality-control","r","risk-adjustment","surgery"],"created_at":"2025-10-22T05:59:12.425Z","updated_at":"2025-10-22T05:59:16.091Z","avatar_url":"https://github.com/wittenberg.png","language":"R","readme":"---\noutput: github_document\nbibliography: inst/VLAD.bib\npandoc_args: [ \"--csl\", \"vignettes/ims.csl\" ]\nbiblio-style: plain\nlink-citations: true\n---\n\n\u003c!--  --\u003e\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r setup, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\",\n  out.width = \"100%\"\n)\n```\n# vlad \n\u003c!-- [![Build Status](https://travis-ci.org/wittenberg/vlad.svg)](https://travis-ci.org/wittenberg/vlad) --\u003e\n\u003c!-- [![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/vlad)](http://cran.r-project.org/package=vlad) --\u003e\n\u003c!-- [![Coverage Status](https://codecov.io/gh/wittenberg/vlad/graph/badge.svg)](https://codecov.io/github/wittenberg/vlad?branch=master) --\u003e\n\u003c!-- [![Downloads](https://cranlogs.r-pkg.org/badges/vlad)](https://CRAN.R-project.org/package=vlad) --\u003e\n\u003c!-- [![Total Downloads](https://cranlogs.r-pkg.org/badges/grand-total/vlad?color=orange)](https://CRAN.R-project.org/package=vlad) --\u003e\n\nAn R-package which contains functions to set up risk-adjusted quality control charts in health care.\n\n## Main features\n\n- Risk-adjusted CUSUM chart control limit calculations based on fast and accurate Markov chain approximations [@Knoth.etal_2019]\n- Risk-adjusted CUSUM chart based on E-O [@Wittenberg.etal_2018]\n- Risk-adjusted CUSUM chart based on log-likelihood ratio statistic [@Steiner.etal_2000]\n- Algorithms are implemented using Rcpp, RcppArmadillo and parallel computation\n\n## Installation\n\nYou can install the released version of **vlad** from\n[CRAN](https://CRAN.R-project.org/package=vlad) with:\n\n``` r\ninstall.packages(\"vlad\")\n```\n\nYou can install the development version from [GitHub](https://github.com/wittenberg/vlad) with:\n\n``` r\n# install.packages(\"devtools\")\ndevtools::install_github(\"wittenberg/vlad\")\n```\n\nThe package compiles C++ source code during installation, therefore you need the appropriate compilers:\n\nOn _Windows_ you need [Rtools](https://cran.r-project.org/bin/windows/Rtools/) available from CRAN. \n\nOn _macOS_ you need the Clang 6.x compiler and the GNU Fortran compiler from [macOS tools](https://cran.r-project.org/bin/macosx/tools/).\nHaving installed the compilers, you need to open a terminal and start R via 'PATH=/usr/local/clang6/bin:$PATH R'. \nYou can then install the package via *devtools::install_github(\"wittenberg/vlad\")*\n\n## Examples\n\n[Supplemental material: Risk-adjusted CUSUM charts under model error](https://raw.githubusercontent.com/wittenberg/vlad/master/man/examples/Supplemental-material-SIM-18-0571.R)\n\n\u003c!-- Load libraries: --\u003e\n\u003c!-- ```{r load libraries, message=FALSE} --\u003e\n\u003c!-- library(\"vlad\") --\u003e\n\u003c!-- library(\"dplyr\") --\u003e\n\u003c!-- library(\"tidyr\") --\u003e\n\u003c!-- library(\"ggplot2\") --\u003e\n\u003c!-- ``` --\u003e\n\n\u003c!-- Subset the dataset `cardiacsurgery` into Phase I (first two years) and Phase II (five years) and estimate a risk model based on `phaseI`. --\u003e\n\u003c!-- ```{r estimate risk model} --\u003e\n\u003c!-- data(\"cardiacsurgery\", package = \"spcadjust\") --\u003e\n\u003c!-- cardiacsurgery \u003c- cardiacsurgery %\u003e% rename(s = Parsonnet) %\u003e% --\u003e\n\u003c!--   mutate(y = ifelse(status == 1 \u0026 time \u003c= 30, 1, 0), --\u003e\n\u003c!--         phase = factor(ifelse(date \u003c 2*365, \"I\", \"II\"))) --\u003e\n\u003c!-- head(cardiacsurgery) --\u003e\n\u003c!-- phaseI \u003c- filter(cardiacsurgery, phase == \"I\") %\u003e% select(s, y) --\u003e\n\u003c!-- coeff \u003c- round(coef(glm(y ~ s, data = phaseI, family = \"binomial\")), 3) --\u003e\n\u003c!-- print(coeff) --\u003e\n\u003c!-- ``` --\u003e\n\n\u003c!-- ### Create VLADs for seven surgeons --\u003e\n\u003c!-- By using the estimated risk model coefficients `coeff`, for each pair of Parsonnet score `s` and operation outcome values `y`, the difference between expected and observed outcome is calculated with the function `calceo()`. --\u003e\n\u003c!-- Thereafter, differences are cummulated to create the VLAD. This is done for all seven surgeons of the `cardiacsurgery` dataset. Results are saved to the object `vlads7`. --\u003e\n\u003c!-- ```{r vlads7} --\u003e\n\u003c!-- vlads7 \u003c- lapply(1:7, function(j){ --\u003e\n\u003c!--   Si \u003c- filter(cardiacsurgery, surgeon == j) --\u003e\n\u003c!--   EO \u003c- sapply(seq_along(Si$s), function(i) calceo(df = Si[i, c(\"s\", \"y\")], coeff = coeff)) --\u003e\n\u003c!--   select(Si, surgeon, phase) %\u003e%  mutate(n = 1:length(EO), cEO = cumsum(EO)) --\u003e\n\u003c!-- })  --\u003e\n\n\u003c!-- ``` --\u003e\n\n\u003c!-- Create Variable life-adjusted Displays for each surgeon from the object `vlads7`. --\u003e\n\u003c!-- ```{r VLADS1-7, fig.align='center', fig.width=8, fig.height=10} --\u003e\n\u003c!-- vlads7 %\u003e%  --\u003e\n\u003c!--   bind_rows() %\u003e%   --\u003e\n\u003c!--   gather(key = \"Surgeon\", value = value, c(-n, -surgeon, -phase)) %\u003e% --\u003e\n\u003c!--   ggplot(aes(x = n, y = value, colour = phase, group = Surgeon)) + --\u003e\n\u003c!--     geom_hline(yintercept = 0, colour = \"darkgreen\", linetype = \"dashed\") + --\u003e\n\u003c!--     geom_line(size = 1.1) + facet_wrap( ~ surgeon, ncol = 2, scales = \"free\") + --\u003e\n\u003c!--     labs(x=\"Patient number n\", y=\"CUSUM E-O\") + theme_classic() + --\u003e\n\u003c!--     scale_y_continuous(sec.axis = dup_axis(name = NULL, labels = NULL)) + --\u003e\n\u003c!--     scale_x_continuous(sec.axis = dup_axis(name = NULL, labels = NULL)) --\u003e\n\u003c!-- ``` --\u003e\n\n\u003c!-- ### Create a VLAD for surgeon 2 --\u003e\n\u003c!-- ```{r vladS2, fig.align='center'} --\u003e\n\u003c!-- S2 \u003c- filter(cardiacsurgery, surgeon == 2) %\u003e% select(phase, s, y) --\u003e\n\u003c!-- S2I \u003c- subset(S2, c(phase == \"I\")) --\u003e\n\u003c!-- S2II \u003c- subset(S2, c(phase == \"II\")) --\u003e\n\u003c!-- coeff \u003c- coef(glm(y ~ s, data = S2I, family = \"binomial\")) --\u003e\n\u003c!-- EO \u003c- sapply(1:nrow(S2), function(i) calceo(df = S2[i, c(\"s\", \"y\")], coeff = coeff)) --\u003e\n\n\u003c!-- df1 \u003c- select(S2, phase) %\u003e% mutate(n = row_number(), cEO = cumsum(EO)) --\u003e\n\u003c!-- df2 \u003c- gather(df1, variable, value, c(-n, -phase)) --\u003e\n\n\u003c!-- p1 \u003c- ggplot(df2, aes(x = n, y = value, colour = phase)) + --\u003e\n\u003c!--   geom_hline(yintercept = 0, linetype = \"dashed\") + geom_line() + geom_point() +  --\u003e\n\u003c!--   labs(x = \"Patient number\", y = \"CUSUM E-O\") + theme_classic() + --\u003e\n\u003c!--   scale_y_continuous(sec.axis = dup_axis(name = NULL, labels = NULL)) + --\u003e\n\u003c!--   scale_x_continuous(sec.axis = dup_axis(name = NULL, labels = NULL)) --\u003e\n\u003c!-- p1 --\u003e\n\u003c!-- ``` --\u003e\n\n\u003c!-- ### Compute thresholds of a risk-adjusted CUSUM chart for surgeon 2  --\u003e\n\n\n\u003c!-- Upper and lower control limits of the risk-adjusted CUSUM chart based on log-likelihood ratio statistic can be computed with the function `racusum_arl_h_sim()`. The implemention uses parallel simulation and a multi-stage search procedure.   --\u003e\n\u003c!-- ```{r} --\u003e\n\u003c!-- # set a random number generator for parallel computations --\u003e\n\u003c!-- RNGkind(\"L'Ecuyer-CMRG\") --\u003e\n\u003c!-- # number of simulation runs --\u003e\n\u003c!-- m \u003c- 10^4 --\u003e\n\u003c!-- # assign cores --\u003e\n\u003c!-- nc \u003c- parallel::detectCores() --\u003e\n\u003c!-- # verbose calculation  --\u003e\n\u003c!-- UCL_sim \u003c- racusum_crit_sim(L0 = 740, df = S2I[, c(\"s\", \"y\")], coeff = coeff, m = m, RA = 2, nc = nc, verbose = TRUE) --\u003e\n\u003c!-- # quite calculation --\u003e\n\u003c!-- LCL_sim \u003c- racusum_crit_sim(L0 = 740, df = S2I[, c(\"s\", \"y\")], coeff = coeff, m = m, RA = 1/2, nc = nc, verbose = FALSE) --\u003e\n\u003c!-- round(cbind(UCL_sim, LCL_sim), 3) --\u003e\n\u003c!-- ``` --\u003e\n\n### Authors\n\nPhilipp Wittenberg and Sven Knoth\n\n### License\n\nGPL (\u003e= 2)\n\n### References\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwittenberg%2Fvlad","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwittenberg%2Fvlad","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwittenberg%2Fvlad/lists"}