-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path08LaPP.Rmd
38 lines (28 loc) · 1.49 KB
/
08LaPP.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
# Post-baseline Prognostic Factor Adjusted Per Protocol Estimation {-}
Post-baseline prognostic factor 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_{L} L + \gamma_{t} t$$
Using the artificially censored dataset of adherent patient observations, we fit the pooled logistic regression:
```{r, cache=TRUE}
LAdjPPFit <- glm(Y ~ t0 + A + L1 + L2, data =
simulated.data.combined,
family = binomial(link="logit"))
LAdjPPFit
```
Then similar to our previous models we calculate the clustered standard errors:
```{r, cache=TRUE}
cov.m1 <- vcovCL(LAdjPPFit, type = "HC0",
cluster = simulated.data.combined$id)
co.test <- coeftest(LAdjPPFit, vcov = cov.m1)
co.CI <- coefci(LAdjPPFit, vcov = cov.m1, level = 0.95)
cat("Post-baseline prognostic factor adjusted PP effect estimate:", "\n",
"log(OR)", round(coefficients(LAdjPPFit)[["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(LAdjPPFit, robust = "HC0",
confint = TRUE, digits = 3, cluster="id",
model.info = FALSE, model.fit = FALSE)
```