Package {VOWR}


Title: Vital Operational Waiting Risk for Healthcare Systems
Version: 0.1.0
Description: Vital Operational Waiting Risk (VOWR) provides tools for analysing monthly Referral-to-Treatment (RTT) panel data in healthcare systems. The package supports provider-level profiling, operational risk classification, waiting-time volatility assessment, Kaplan-Meier survival analysis, Cox proportional hazards modelling, and visualisation of time-to-threshold breach patterns. It is designed to help analysts and decision-makers identify providers with high waiting times, unstable performance, and increased risk of earlier threshold breach. The survival modelling methods follow Cox (1972) <doi:10.1111/j.2517-6161.1972.tb00899.x> and Kaplan and Meier (1958) <doi:10.1080/01621459.1958.10501452>.
License: MIT + file LICENSE
Encoding: UTF-8
RoxygenNote: 7.3.3
Imports: dplyr, ggplot2, survival, stats, utils, survminer
Suggests: testthat (≥ 3.0.0),
Config/testthat/edition: 3
URL: https://github.com/zerish12/VOWR
BugReports: https://github.com/zerish12/VOWR/issues
NeedsCompilation: no
Packaged: 2026-05-17 08:24:39 UTC; muhammadzahirkhan
Author: Muhammad Zahir Khan ORCID iD [aut, cre]
Maintainer: Muhammad Zahir Khan <zahirstat007@gmail.com>
Repository: CRAN
Date/Publication: 2026-05-20 09:10:21 UTC

Kaplan-Meier plot by group

Description

Kaplan-Meier plot by group

Usage

plot_km_by_delay(data, time, event, group)

Arguments

data

A data frame.

time

Name of duration/time variable.

event

Name of event variable: 1 = event occurred, 0 = censored.

group

Name of grouping variable.

Value

A survminer ggsurvplot object.


Estimate Cox proportional hazards model for threshold breach

Description

Estimate Cox proportional hazards model for threshold breach

Usage

vowr_cox_model(surv_profile)

Arguments

surv_profile

Data frame from vowr_survival_merge()

Value

A fitted Cox proportional hazards model


Flag high-risk providers

Description

Flag high-risk providers

Usage

vowr_flag(profile, wait_threshold = 18, vol_percentile = 0.9)

Arguments

profile

A data frame produced by vowr_profile()

wait_threshold

The mean wait time threshold (default 18 weeks)

vol_percentile

The percentile for volatility (default 0.90)

Value

The profile data frame with a 'risk_flag' column


Import and validate RTT data

Description

Import and validate RTT data

Usage

vowr_import(path = NULL)

Arguments

path

Optional path to an NHS Referral-to-Treatment (RTT) CSV file. If NULL, the example data included in the package is loaded.

Value

A cleaned data frame.

Examples

sample_path <- system.file(
  "extdata",
  "rtt_trust_month_panel_last24_FIXED-2.csv",
  package = "VOWR"
)

data <- vowr_import(sample_path)
head(data)


Kaplan-Meier plot by provider risk group

Description

Kaplan-Meier plot by provider risk group

Usage

vowr_km_by_risk(surv_profile)

Arguments

surv_profile

Data frame from vowr_survival_merge()

Value

A survminer Kaplan-Meier plot object


Visualize provider risk distribution

Description

Visualize provider risk distribution

Usage

vowr_plot(flagged_data)

Arguments

flagged_data

A data frame produced by vowr_flag()

Value

A ggplot object


Profile National Health Service provider performance

Description

Profile National Health Service provider performance

Usage

vowr_profile(data)

Arguments

data

A data frame from vowr_import().

Value

A summary table with the number of months, mean waiting time, median waiting time, waiting-time volatility, and total backlog for each provider.


Estimate time-to-breach survival model

Description

Estimate time-to-breach survival model

Usage

vowr_survival(data, threshold = 18)

Arguments

data

A data frame from vowr_import().

threshold

Mean waiting-time threshold in weeks. Default is 18.

Value

A list containing a Kaplan-Meier survival model object and the data used to fit the model.


Merge survival output with provider profile and risk flags

Description

Merge survival output with provider profile and risk flags

Usage

vowr_survival_merge(surv_result, profile, flagged)

Arguments

surv_result

Output from vowr_survival()

profile

Output from vowr_profile()

flagged

Output from vowr_flag()

Value

A provider-level survival analysis data frame


Run complete Volatility-Oriented Waiting-time Risk workflow

Description

Run complete Volatility-Oriented Waiting-time Risk workflow

Usage

vowr_workflow(data, wait_threshold = 18, vol_percentile = 0.9)

Arguments

data

A data frame from vowr_import()

wait_threshold

Waiting-time breach threshold. Default is 18 weeks.

vol_percentile

Volatility percentile for risk flagging. Default is 0.90.

Value

A list containing profile, flagged data, risk plot, survival output, survival profile, Cox model, and Kaplan-Meier plot by risk group.