-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreport.Rmd
75 lines (61 loc) · 1.29 KB
/
report.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
---
title: "Example report"
subtitle: 'DRAFT'
author: "Name"
date: "`r format(Sys.time(), '%Y-%m-%d')`"
fontsize: 12pt
output:
pdf_document:
fig_caption: yes
highlight: tango
latex_engine: xelatex
word_document:
fig_caption: true
html_document:
df_print: paged
header-includes: \usepackage{fancyhdr}
mainfont: Arial
geometry: margin=.7in
papersize: a4
always_allow_html: yes
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
library(deSolve)
library(ggplot2)
source('functions.R')
pp <- readxl::read_excel('parameters.xlsx', sheet = 'parameters')
values <- as.list(pp$Value)
names(values) <- pp$Code
```
```{r run, echo = FALSE}
# Run models
sir_out <- run_model(sir)
sis_out <- run_model(sis)
out <- data.frame(rbind(cbind(sir_out, model = 'SIR')
, cbind(sis_out, model = 'SIS')
))
```
# Model functions
```{r show, echo = TRUE}
# SIR model definition
sir
# SIS model definition
sis
# Function to run models
run_model
```
## Parameter Table
```{r table, echo=FALSE, include = TRUE}
knitr::kable(pp[, -ncol(pp)])
```
## Example Plot
```{r plot, echo=FALSE}
(ggplot(out)
+ aes(x = time, y = I, color = model)
+ geom_line(size = 1.5)
+ xlab('Time (in disease generations)')
+ ylab('Proportion of the population infected')
+ theme_bw()
)
```