estimateit: Estimate marginal effects for binary exposure and outcome

View source: R/estimateit.R

estimateitR Documentation

Estimate marginal effects for binary exposure and outcome

Description

Estimate marginal effects for binary exposure and outcome

Usage

estimateit(weightitobj, outcome, data)

Arguments

weightitobj

A WeightIt object

outcome

A binary outcome variable

data

A data frame containing the outcome

Value

Returns a summary table as a tibble, the model, and the individual effects (Control, Treatment, D=their difference, logRR= their log relative "risk", logOR=their log odds ratio). The individual effects are svrepstat objects that can be further analysed using relevant survey functions. The table displays the exponential of the log relative effects. In other words the relative risk and the odds ratio.

Examples

library(WeightIt)
library(tibble)
library(tidyr)
dfvi <- tibble(
C = rep(0:1, each = 4),
X = rep(0:1, times = 4),
Y = rep(0:1, times = 2, each = 2),
N = c(96, 36, 64, 54, 120, 120, 30, 480)
) %>%
 uncount(N)
W1 <- weightit(X ~ C, data = dfvi,
              method = "ps", estimand = "ATE")
summary(W1)
E1 <- estimateit(weightitobj=W1, outcome=Y, data=dfvi)
E1

frankpopham/estimateit documentation built on Jan. 30, 2023, 12:52 a.m.