forked from higgi13425/rmrwr-book
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathio43-rand_block.Rmd
executable file
·89 lines (67 loc) · 2.26 KB
/
io43-rand_block.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
---
title: "LearnR blockrand Tutorial"
output: learnr::tutorial
runtime: shiny_prerendered
---
```{r setup, include=FALSE}
library(learnr)
knitr::opts_chunk$set(echo = FALSE)
if (!require(blockrand)){ # checks if already installed
install.packages(blockrand) #installs if not
}
library(blockrand)
library(knitr)
library(kableExtra)
library(tidyverse, quietly = T)
```
## Topic 1
### Exercise
*Here's a simple exercise with an empty code chunk provided for entering the answer.*
Write the R code required to run a block randomization with n=200:
```{r ex1, exercise=TRUE}
```
### Exercise with Code
*Here's an exercise with some prepopulated code*
Now edit the R code below to randomize 120 subjects to
upadacitinib, risankizumab, or upadacitinib + risankizumab:
```{r ex2, exercise=TRUE}
blockrand(n = 100,
block.prefix = "B_", # this is for block.id
stratum = "Stratum_1",
num.levels = , # N distinct treatments
levels = c("A", "B", "C")
)
```
## Topic 2
### Exercise with Hint
*Here's an exercise where the chunk is pre-evaulated via the `exercise.eval` option (so the user can see the default output we'd like them to customize). We also add a "hint" to the correct solution via the chunk immediate below labeled `print-limit-hint`.*
Modify the following code to randomize 250 patients to 4 doses of upadacitinib (7.5, 15, 30, 45 mg) vs. placebo:
```{r ex3, exercise=TRUE, exercise.eval=TRUE}
blockrand(n = 100,
block.prefix = "B_", # this is for block.id
num.levels = 17, # N distinct treatments
levels = c("A", "B", "C")
)
```
```{r ex3-hint}
num.levels = 5
```
### Quiz
*Use help or google to find the documentation for blockrand. Figure out how each argument works, and what each is for.*
Some questions to verify that you understand the purposes of different arguments to blockrand:
```{r quiz}
quiz(
question("Which argument sets the number of arms in the clinical trial?",
answer("n"),
answer("block.prefix"),
answer("levels"),
answer("num.levels", correct = TRUE)
),
question("Which argument names/labels the arms in the clinical trial?",
answer("n"),
answer("block.prefix"),
answer("levels", correct = TRUE),
answer("num.levels")
)
)
```