| contrast | R Documentation |
Compute pairwise differences of posterior potential outcomes along strata, treatment arms, or time points.
contrast(object, ...)
## S3 method for class 'PSEstimate'
contrast(
object,
S = NULL,
Z = NULL,
T = NULL,
type = c("all", "sequential", "cycle"),
...
)
## S3 method for class 'PStrataFit'
contrast(
object,
S = NULL,
Z = NULL,
T = NULL,
type = c("all", "sequential", "cycle"),
...
)
object |
A |
... |
Additional arguments passed to |
S |
Strata to contrast. |
Z |
Treatment arms to contrast. |
T |
Time points to contrast (survival only). |
type |
|
A PSContrast object (inherits from PSEstimate).
data(sim_data_normal)
model <- PStrataModel(
S.formula = Z + D ~ 1,
Y.formula = Y ~ 1,
Y.family = gaussian(),
strata = c(n = "00", c = "01", a = "11"),
ER = c("n", "a")
)
ps_fit <- fit(model, data = sim_data_normal, chains = 2, iter = 500)
# Treatment effect (Z contrast) for each stratum
ctr_z <- contrast(ps_fit, Z = TRUE)
summary(ctr_z)
plot(ctr_z)
# Stratum contrasts for each treatment arm
ctr_s <- contrast(ps_fit, S = TRUE)
summary(ctr_s)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.