inferference
library(inferference)
head(vaccinesim)
## Y X1 X2 A B group
## 1 1 5.3607405 1.715527 0 0 1
## 2 0 0.1964597 1.730802 0 1 1
## 3 0 0.4846243 1.769546 1 1 1
## 4 0 0.8012977 1.715527 0 1 1
## 5 0 2.1426629 1.772158 1 1 1
## 6 0 1.2861017 1.715527 0 1 1
<- interference(
example1 formula = Y | A | B ~ X1 + X2 + (1|group) | group,
allocations = seq(.2,.8, by = .1),
data = vaccinesim,
randomization = 2/3,
method = 'simple')
<- direct_effect(example1)
deff <- deff$alpha1
x <- as.numeric(deff$estimate)
y <- as.numeric(deff$conf.high)
u <- as.numeric(deff$conf.low)
l plot(c(min(x), max(x)),c(-.15, .25), type = 'n',
xlab = expression(alpha),
ylab = expression(widehat(DE) * "(" * alpha * ")"),
bty = 'n')
polygon(c(x, rev(x)), c(u, rev(l)), col = 'skyblue', border = NA)
lines(x, y, cex = 2)
.4 <- ie(example1, allocation1 = .4)
ieff<- ieff.4$alpha2
x <- as.numeric(ieff.4$estimate)
y <- as.numeric(ieff.4$conf.high)
u <- as.numeric(ieff.4$conf.low)
l plot(c(min(x), max(x)),c(-.15, .25), type = 'n',
xlab = expression(alpha * "'"),
ylab = expression(widehat(IE) * "(" * 0.4 * "," * alpha * "'" * ")"))
polygon(c(x, rev(x)), c(u, rev(l)), col = 'skyblue', border = NA)
lines(x, y, cex = 2)
<- subset(example1$estimates, effect == 'indirect')
ieff <- sort(unique(ieff$alpha1))
x <- sort(unique(ieff$alpha2))
y <- xtabs(as.numeric(estimate) ~ alpha1 + alpha2, data= ieff)
z contour(x, y, z,
xlab = expression(alpha), ylab = expression(alpha * "'"))