runFLPS {flps} | R Documentation |
Conduct fully latent principal stratification
Description
Conduct fully latent principal stratification
Usage
runFLPS(
inp_data = NULL,
compiled_stan = NULL,
outcome = NULL,
trt = NULL,
covariate = NULL,
lv_model = NULL,
lv_type = NULL,
priors_input = NULL,
stan_options = list(),
...
)
Arguments
inp_data |
A matrix or data frame containing the input data. |
compiled_stan |
An object of S4 class stanmodel produced by the
|
outcome |
A character string specifying the outcome variable's name. |
trt |
A character string specifying the treatment or control group variable's name. |
covariate |
A character string specifying the covariate variable names. |
lv_model |
A description of the latent variable model using syntax akin to the lavaan package. Key operators include:
|
lv_type |
A character string indicating the type of latent variable models. |
priors_input |
A list specifying the priors or defaults to N(0, 5) if not provided.
Relevant parameters:
|
stan_options |
A list of options for [rstan::stan()], specified as 'name = value'. |
... |
Additional parameters for the latent variable models
|
Value
An object of class flps
encompassing a stanfit
object.
Components include:
call |
Function call with arguments. |
inp_data |
The input data frame provided. |
flps_model |
The Stan syntax used in [rstan::stan()]. |
flps_data |
Data list used for [rstan::stan()]. |
flps_fit |
Resulting |
time |
A numeric; Time taken for computation |
See Also
[rstan::stan()]
Examples
inp_data <- flps::makeInpData(
N = 200,
R2Y = 0.2,
R2eta = 0.5,
omega = 0.2,
tau0 = 0.23,
tau1 = -0.16,
betaL = 0.1,
betaY = 0.2,
lambda = 0.8,
nitem = 10,
nfac = 1,
lvmodel = 'rasch' )
res <- runFLPS(
inp_data = inp_data,
outcome = "Y",
trt = "Z",
covariate = c("X1"),
lv_type = "rasch",
lv_model = "F =~ v1 + v2 + v3 + v4 + v5 + v6 + v7 + v8 + v9 + v10",
stan_options = list(iter = 1000, warmup = 500, cores = 1, chains = 2)
)