https://github.com/nhs-transformation-unit/markov_example
Repository for a simple Markov Model that can be amended within a Shiny App
https://github.com/nhs-transformation-unit/markov_example
markov-model r shiny
Last synced: about 1 year ago
JSON representation
Repository for a simple Markov Model that can be amended within a Shiny App
- Host: GitHub
- URL: https://github.com/nhs-transformation-unit/markov_example
- Owner: NHS-Transformation-Unit
- License: gpl-3.0
- Created: 2024-12-03T09:44:04.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-12-17T11:22:23.000Z (over 1 year ago)
- Last Synced: 2025-02-12T22:24:28.420Z (over 1 year ago)
- Topics: markov-model, r, shiny
- Language: R
- Homepage:
- Size: 322 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

# Markov Model - Shiny Example
This repository contains the code for creating a shiny app for running simple
Markov Models.
## Table of Contents
1. [Overview](#overview)
2. [Using the Repository](#using)
3. [Repository Structure](#structure)
4. [Contributors](#contributors)
## Overview
This repository contains the code to create a **Shiny App** to demonstrate how
Markov Models are constructed and how to run simple models. Markov models are
used widely in health economics and epidemiology to understand how patients can
move between different health states. Comparing different models with different
transition probabilities can enable comparisons of employing different healthcare
solutions.
The Markov Model App is available for demonstration [here](https://nhs-tu-andy-wilson.shinyapps.io/markov_example/).
## Using the Repository
To run the model locally the repository can be cloned:
```bash
git clone https://github.com/NHS-Transformation-Unit/markov_example.git
cd markov_example
```
Dependencies should be installed using `renv.lock` but please review the
required packages in the `app.R` script.
The app can then be run using the following command in R:
```r
library(shiny)
runApp("app.R")
```
## Structure
The folder structure of the repository is shown below:
```plaintext
├───R
└───markov_model.R
├───renv
├───.gitignore
├───activate.R
└───settings.json
├───tests
├───testthat.R
├───www
├───images
└───themes
├───README.md
├───renv.lock
├───.gitignore
├───markov_example.Rproj
├───.Rprofile
├───app.R
├───LICENSE
```
### `R`
This folder contains the `markov_model.R` script. This has the necessary
functions for running the markov model.
### `renv`
Contains necessary files for `renv` for reproducibility and collaboration.
### `tests`
Contains unit tests for checking the Markov Model returns correct sized matrix
and that the values returned from multiple cycles are correct.
### `www`
Contains the images and theme files used within the app. The `images` include
diagrams of markov models and screenshots of the app. The `themes` include TU
`.css` themes and ggplot themes for the app.
### `app.R`
This is the shiny app that is deployed [here](https://nhs-tu-andy-wilson.shinyapps.io/markov_example/).
## Contributors
This repository has been created and developed by:
- [Andy Wilson](https://github.com/ASW-Analyst)