-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path02DataSetup.Rmd
41 lines (32 loc) · 1.55 KB
/
02DataSetup.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
# Data Setup {-}
The analyses conducted in this supplement will require loading the following packages:
```{r, warning=FALSE}
## Load required packages
suppressPackageStartupMessages(library(lmtest))
suppressPackageStartupMessages(library(tidyr))
suppressPackageStartupMessages(library(sandwich))
suppressPackageStartupMessages(library(dplyr))
suppressPackageStartupMessages(library(ggstance))
suppressPackageStartupMessages(library(ggplot2))
suppressPackageStartupMessages(library(jtools))
```
Next, by setting the `filePath` variable to match the [location](https://github.com/ehsanx/IPAW-Per-protocol-Estimator) of the supplied `Pragmatic Trial Data.csv`, we can open the dataset. By printing the first few rows, we can start getting ourselves familiar with the data.
```{r, eval=TRUE, include=FALSE, cache=TRUE}
## Load the dataset
simulated.data <- read.csv("data/Pragmatic Trial Data.csv")
```
```{r, eval = FALSE}
## Load the dataset
simulated.data <- read.csv(paste0(filePath, "data/Pragmatic Trial Data.csv"))
```
```{r, cache=TRUE}
head(simulated.data)
```
We see that this dataset consists of 11 variables, including:
- Z the arm the patient was randomized to
- id the patient id that groups observations from the same individual together
- t0 the time point of the observation
- B the measured baseline covariate
- L1 and L2 the time-varying covariates, with L2lag and cavgL1 derived from these columns
- A whether the patient received the treatment for the time interval prior to this observation
- Y whether the individual experienced the outcome of interest