-
Notifications
You must be signed in to change notification settings - Fork 1
/
template_design_report_pdf.Rmd
98 lines (85 loc) · 3.22 KB
/
template_design_report_pdf.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
---
title: "*pfhrp2/3* Planner: Design report"
subtitle: "*Downloaded on: `r Sys.Date()` | DRpower interactive app v1.0.0*"
output:
pdf_document:
fig_caption: yes
number_sections: no
latex_engine: xelatex
df_print: kable
fig_width: 6
fig_height: 4
header-includes:
- \usepackage{booktabs}
mainfont: Arial
documentclass: article
links-as-notes: true
geometry:
- margin=0.75in
- top=0.5in
papersize: letter
always_allow_html: true
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)
set.seed(10)
```
```{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
<!-- \begin{center}\rule{7in}{0.4pt}\end{center} -->
This report presents the results generated by using the [*pfhrp2/3* planner web application](https://github.com/shaziaruybal/DRpower_app). This application was used to help guide the appropriate number of clusters and a target sample size per cluster 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 cluster sizes
<!-- \begin{center}\rule{7in}{0.4pt}\end{center} -->
The adjusted sample sizes based on the expected drop-out proportion in each of the `r params$design_nclusters` clusters are shown below and should be considered for study design.
```{r echo=F}
kable(df_final_sizes,
format = "latex",
booktabs = T,
digits = 2) %>%
kable_styling(
bootstrap_options = "striped",
position = "left",
full_width = F)
```
## Estimated power
<!-- \begin{center}\rule{7in}{0.4pt}\end{center} -->
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))
```