-
Notifications
You must be signed in to change notification settings - Fork 1
/
template_design_report.Rmd
116 lines (98 loc) · 3.73 KB
/
template_design_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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
---
title: "*pfhrp2/3* Planner: Design report"
date: "*Downloaded on: `r Sys.Date()` | DRpower interactive app v1.0.1*"
output:
html_document:
# theme: flatly
version: 5
bg: "#F9F9F9"
fg: "#5e5ea3"
primary: "#5e5ea3"
base_font: !expr bslib::font_google("Lato")
code_font: !expr bslib::font_google("JetBrains Mono")
params:
design_ss_icc: NA
design_ss_prev: NA
design_final_sizes: NA
design_nclusters: NA
design_paramprev: NA
design_paramicc: NA
design_paramsims: NA
design_poweroutput: NA
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(tidyverse)
library(kableExtra)
library(janitor)
set.seed(10)
```
```{css, echo=F}
.title{
color: #605ca3;
}
.date{
color: #605ca3;
text-align: right;
font-size: 14px;
}
/* Styles for the h3 headers */
h3 {
color: #605ca3 !important;
}
hr {
opacity: 1;
border-top: 2.5px solid #605ca3;
}
```
```{r create objects from params, echo=F}
df_final_sizes <- params$design_final_sizes
n_clusters <- params$design_nclusters
param_prev <- params$design_paramprev
param_icc <- params$design_paramicc
param_sims <- params$design_paramsims
power_output <- params$design_poweroutput
```
-----
### Background
This report presents the results generated by using the [*pfhrp2/3* planner web application](https://shiny.dide.ic.ac.uk/DRpower-app/). This application was used to help guide the appropriate number of health facilities (or sites) and a target sample size per health facility for the design of a *pfhrp2/3* deletion prevalence study. For more information on the statistical method used, see the [DRpower R package website](https://mrc-ide.github.io/DRpower).
### Final sample sizes
The adjusted sample sizes based on the expected drop-out proportion in each of the `r params$design_nclusters` health facilities are shown below and should be considered for study design.
```{r echo=F}
kable(df_final_sizes %>%
# add total samples row
adorn_totals(name = "Total samples", where = "row", ,,, -c(cluster, percent_dropout)) %>%
# annoyingly need to change dash to endash because rmd changes it to a bullet point thinking its a list!
mutate(percent_dropout = ifelse(row_number() == nrow(df_final_sizes)+1, "--", percent_dropout)),
format = "html",
digits = 2,
col.names = c("Health facility", "Target sample size", "Dropout (%)", "Adjusted sample size")) %>%
kable_styling(
bootstrap_options = "striped",
position = "left",
full_width = F) %>%
row_spec(nrow(df_final_sizes) + 1, italic = T)
```
### Estimated power
To estimate the power of the study assuming the target sample sizes as per above, we used the [DRpower R package](https://mrc-ide.github.io/DRpower) with the following parameters:
<!-- - The sample sizes for the `r params$design_nclusters` clusters (shown above) -->
- Prevalence of `r params$design_paramprev`%
- Intra-cluster correlation of `r params$design_paramicc`
- `r params$design_paramsims` simulations
The estimated power is `r power_output$power`% (95%CI: `r ceiling(power_output$lower)` - `r ceiling(power_output$upper)`%).
```{r fig.height=3, fig.width=3, echo=F}
power_output %>%
ggplot() +
geom_segment(aes(x = " ", xend = " ",y = lower, yend = upper), color = "black", linewidth = 1) +
geom_point(aes(x = " ", y = power),
size = 2,
shape = 21,
fill = "mediumpurple") +
geom_hline(yintercept = 80, color = "darkgrey", linetype = "dashed") +
geom_text(aes(x= " ", y = 83, label = "80% threshold"), color = "darkgrey", size = 3) +
scale_y_continuous(labels = scales::percent_format(1, scale = 1), limits = c(0,100)) +
labs(x = "",
y = "Estimated power") +
theme_light() +
theme(text = element_text(size = 12))
```