+ df.proxy.obs <- model.frame(proxy_formula,df)
+ proxy.obs <- with(df.proxy.obs, eval(parse(text=proxy.variable)))
+ n.proxy.model.covars <- dim(proxy.model.matrix)[2]
+
+ df.truth.obs <- model.frame(truth_formula, df)
+ truth.obs <- with(df.truth.obs, eval(parse(text=truth.variable)))
+ truth.model.matrix <- model.matrix(truth_formula,df.truth.obs)
+ n.truth.model.covars <- dim(truth.model.matrix)[2]
+
+ df.unobs <- df[is.na(eval(parse(text=truth.variable)))]
+ df.unobs.x1 <- copy(df.unobs)
+ df.unobs.x1[,truth.variable] <- 1
+ df.unobs.x0 <- copy(df.unobs)
+ df.unobs.x0[,truth.variable] <- 0
+ outcome.unobs <- with(df.unobs, eval(parse(text=response.var)))
+
+ outcome.model.matrix.x0 <- model.matrix(outcome_formula, df.unobs.x0)
+ outcome.model.matrix.x1 <- model.matrix(outcome_formula, df.unobs.x1)
+
+ proxy.model.matrix.x0 <- model.matrix(proxy_formula, df.unobs.x0)
+ proxy.model.matrix.x1 <- model.matrix(proxy_formula, df.unobs.x1)
+ proxy.unobs <- df.unobs[[proxy.variable]]
+
+ truth.model.matrix.unobs <- model.matrix(truth_formula, df.unobs.x0)
+