| fit | R Documentation |
Estimate a principal stratification model by running MCMC via Stan.
The model specification (a PStrataModel) is combined with
observed data to produce posterior samples.
fit(model, ...)
## S3 method for class 'PStrataModel'
fit(
model,
data,
chains = 4,
iter = 2000,
warmup = floor(iter/2),
cores = 1,
seed = NULL,
.debug = FALSE,
...
)
model |
A |
... |
Additional arguments passed to |
data |
A data frame containing all variables referenced in the model. |
chains, iter, warmup, cores, seed |
MCMC settings passed to
|
.debug |
Logical. If TRUE, read Stan helper files from |
An object of class PStrataFit
(or PStrataFitSurvival).
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)
summary(ps_fit)
diagnostics(ps_fit)
plot(ps_fit)
cat(stancode(ps_fit))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.