-
Notifications
You must be signed in to change notification settings - Fork 0
/
07BaPP.Rmd
38 lines (28 loc) · 1.41 KB
/
07BaPP.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
# Baseline Adjusted Per Protocol Estimation {-}
Baseline adjusted PP estimates use the subset of patient observations where treatments adhered to their randomly assigned treatments to calculate the effect estimate in the following form:
$$logit(Y) = \gamma_{0} + \gamma_{A} A + \gamma_{B} B + \gamma_{t} t$$
Using the artificially censored dataset of adherent patient observations, we fit the pooled logistic regression:
```{r, cache=TRUE}
BAdjPPFit <- glm(Y ~ t0 + A + B, data =
simulated.data.combined,
family = binomial(link="logit"))
BAdjPPFit
```
Then similar to our previous models we calculate the clustered standard errors:
```{r, cache=TRUE}
cov.m1 <- vcovCL(BAdjPPFit, type = "HC0",
cluster = simulated.data.combined$id)
co.test <- coeftest(BAdjPPFit, vcov = cov.m1)
co.CI <- coefci(BAdjPPFit, vcov = cov.m1, level = 0.95)
cat("Baseline adjusted PP effect estimate:", "\n",
"log(OR)", round(coefficients(BAdjPPFit)[["A"]],3), "\n",
"95% CI:", round(co.CI["A","2.5 %"],3), ",",round(co.CI["A","97.5 %"],3), "\n",
"p-value", round(co.test["A","Pr(>|z|)"],3), "\n",
"robust standard error", round(sqrt(diag(cov.m1))[["A"]],3))
```
Alternatively, we can again use the `summ()` function to obtain the same estimates:
```{r, cache=TRUE}
summ(BAdjPPFit, robust = "HC0",
confint = TRUE, digits = 3, cluster="id",
model.info = FALSE, model.fit = FALSE)
```