"Fidelity of estimators for a point treatment"

context("Fidelity of estimates with shifted data supplied")
sc <- shift_data(sim_cens, a, cens, function(data, trt) data[[trt]] + 0.5)
sw(lmtp_sub(sim_cens, a, "Y", nodes, baseline = NULL,
sw(lmtp_ipw(sim_cens, a, "Y", NULL, nodes,
cens, k = 0, shifted = sc, folds = 2, mtp = TRUE))
sw(lmtp_tmle(sim_cens, a, "Y", nodes, baseline = NULL,
outcome_type = "binomial", folds = 2, mtp = TRUE))
sw(lmtp_sdr(sim_cens, a, "Y", nodes, baseline = NULL,
test_that("estimator fidelity with shifted data supplied", {
expect_equal(truth, sub$theta, tolerance = 0.05)

"Fidelity of estimates with shifted data supplied"
"estimator fidelity with shifted data supplied"

prob_S <- plogis(W1 * 0.5 + rnorm(n, mean = 0, sd = 1))
sub <- lmtp_sub(tmp, "A", "Y", baseline = c("W1", "W2"), shift = static_binary_on,
ipw <- lmtp_ipw(tmp, "A", "Y", baseline = c("W1", "W2"), shift = static_binary_on,
tmle <- lmtp_tmle(tmp, "A", "Y", baseline = c("W1", "W2"), shift = static_binary_on,
sdr <- lmtp_sdr(tmp, "A", "Y", baseline = c("W1", "W2"), shift = static_binary_on,

context("Fidelity of estimators for time-varying treatment")
tmp[[i]] <- factor(tmp[[i]], levels = 0:5, ordered = TRUE)
out[[i]] <- as.numeric(as.character(a[i])) - 1
factor(unlist(out), levels = 0:5, ordered = TRUE)
sub <- sw(lmtp_sub(tmp, a, "Y", time_vary = time_varying, shift = d, folds = 1))
ipw <- sw(lmtp_ipw(tmp, a, "Y", time_vary = time_varying, shift = d, mtp = T, folds = 1))
tmle <- sw(lmtp_tmle(tmp, a, "Y", time_vary = time_varying, shift = d, mtp = T, folds = 1))
sdr <- sw(lmtp_sdr(tmp, a, "Y", time_vary = time_varying, shift = d, mtp = T, folds = 1))
test_that("time varying treatment fidelity, t = 4", {
expect_equal(truth, ipw$theta, tolerance = 0.05)

"Fidelity of estimators for time-varying treatment"
"time varying treatment fidelity, t = 4"