PStrata {PStrata} | R Documentation |
Principal Stratification Analysis for Data with Post-Randomization Intervention
Description
Perform pincipal stratification analysis when there are confounding variables after randomization
Usage
PStrata(
PSobject = NULL,
S.formula,
Y.formula,
Y.family,
data = NULL,
strata = NULL,
ER = NULL,
prior_intercept = prior_flat(),
prior_coefficient = prior_normal(),
prior_sigma = prior_inv_gamma(),
prior_alpha = prior_inv_gamma(),
prior_lambda = prior_inv_gamma(),
prior_theta = prior_normal(),
survival.time.points = 50,
filename = NULL,
...
)
Arguments
PSobject |
an object of class |
S.formula , Y.formula |
an object of class " |
Y.family |
an object of class " |
data |
(optional) a data frame object. This is required when either
|
strata , ER |
arguments to define the principal strata. See Alternatively, one can pass an object of class |
prior_intercept , prior_coefficient , prior_sigma , prior_alpha , prior_lambda , prior_theta |
prior distribution for corresponding parameters in the model. |
survival.time.points |
a vector of time points at which the estimated survival probability is evaluated (only used when the type of outcome is survival), or an integer specifying the number of time points to be chosen. By default, the time points are chosen with equal distance from 0 to the 90% quantile of the observed outcome. |
filename |
(optional) string. If not |
... |
additional parameters to be passed into |
Value
An object of class PStrata
or PStrata_survival
,
which is a list containing
PSobject |
An object of |
post_samples |
An object of class |
Examples
require(abind)
PSobj <- PSObject(
S.formula = Z + D ~ 1,
Y.formula = Y ~ 1,
Y.family = gaussian("identity"),
data = sim_data_normal,
strata = c(n = "00*", c = "01", a = "11*")
)
PStrata(PSobj, cores = 2, chains = 2, iter = 200)
# Another example for survival data
PSobj <- PSObject(
S.formula = Z + D ~ 1,
Y.formula = Y + delta ~ 1,
Y.family = survival("Cox"),
data = sim_data_Cox,
strata = c(`never-taker` = "00*", complier = "01", `always-taker` = "11*")
)
PStrata(PSobj, cores = 2, chains = 2, iter = 200)