PSObject  R Documentation 
Create an object containing essential information to create the Stan file and data for Stan to draw posterior samples. Such information includes the specified model for principal stratum and outcome, the type of outcome, assumptions, and prior specification, etc.
PSObject(
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
)
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. 
The supported family
objects include two types: native families for ordinary outcome and
survival
family for survival outcome.
For ordinary outcome, the below families and links are supported. See family
for more details.
family  link 
binomial  logit , probit , cauchit , log , cloglog 
gaussian  identity , log , inverse 
Gamma  inverse , identity , log 
poisson  log , identity , log 
inverse.gamma  1/mu^2 , inverse , identity , log

The quasi
family is not supported for the current version of the package.
For survival outcome, the family
object is created by
survival(method = "Cox", link = "identity")
, where method
can be
either "Cox"
for WeibullCox model or "AFT"
for accelerated
failure time model. See survival
for more details. For the current
version, only "identity"
is used as the link function.
The gaussian
family and the survival
family with method = "AFT"
introduce an additional parameter sigma
for the standard deviation, whose
prior distribution is specified by prior_sigma
. Similarly, prior_alpha
specifies the prior distribution of alpha
for Gamma
family,
prior_lambda
specifies the prior distribution of theta
for inverse.gaussian
family,
and prior_theta
specifies the prior distribution of theta
for survival
family with method = "Cox"
.
The models for principal stratum S.formula
and response Y.formula
also involve a linear combination of terms, where the prior distribution of
the intercept and coefficients are specified by prior_intercept
and
prior_coefficient
respectively.
A list, containing important information describing the principal stratification model.
S.formula , Y.formula 
A 
Y.family 
Same as input. 
is.survival 
A boolean value. 
strata_info 
A 
prior_intercept , prior_coefficient , prior_sigma , prior_alpha , prior_lambda , prior_theta 
Same as input. 
survival.time.points 
A list of time points at which the estimated survival probability is evaluated. 
SZDG_table 
A matrix. Each row corresponds to a valid (stratum, treatment, confounder, group) combination. 
Z_names 
A character vector. The names of the levels of the treatment. 
df < data.frame(
Z = rbinom(10, 1, 0.5),
D = rbinom(10, 1, 0.5),
Y = rnorm(10),
X = 1:10
)
PSObject(
S.formula = Z + D ~ X,
Y.formula = Y ~ X,
Y.family = gaussian("identity"),
data = df,
strata = c(n = "00*", c = "01", a = "11*")
)
#
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*")
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.