Description Usage Arguments Value Examples
View source: R/moretrees_wrapper.R
Fits MOReTreeS model to matched case-control or case-crossover data.
The posterior is approximated via variational inference.
Returns estimated outcome groups and group-specific coefficient
estimates with credible intervals. See vignette('moretrees')
for
model details and example usage.
1 2 3 4 5 6 7 8 9 | moretrees(Xcase, Xcontrol, Wcase = NULL, Wcontrol = NULL, outcomes, tr,
ci_level = 0.95, get_ml = TRUE, update_hyper_freq = 50,
print_freq = 50, hyper_fixed = NULL, tol = 1e-08,
tol_hyper = 1e-04, max_iter = 5000, nrestarts = 3,
keep_restarts = TRUE, parallel = TRUE, log_restarts = FALSE,
log_dir = ".", vi_params_init = list(), hyperparams_init = list(),
random_init = FALSE, random_init_vals = list(omega_lims = c(0.5,
1.5), tau_lims = c(0.5, 1.5), eta_sd_frac = 0.2, mu_sd_frac = 0.2,
delta_sd_frac = 0.2, u_sd_frac = 0.2))
|
Xcase |
An |
Xcontrol |
An |
Wcase |
An |
Wcontrol |
An |
outcomes |
Character vector of length |
tr |
A directed |
ci_level |
A number between 0 and 1 giving the desired credible interval.
For example, |
get_ml |
If |
update_hyper_freq |
How frequently to update hyperparameters. Default = every 50 iterations. |
print_freq |
How often to print out iteration number and current value of epsilon (the difference in objective function value for the two most recent iterations). |
hyper_fixed |
Fixed values of hyperprior parameters for rho.
This should be a list with two elements:
a and b, both numeric vectors of length |
tol |
Convergence tolerance for the objective function.
Default is |
tol_hyper |
The convergence tolerance for the objective function between
between subsequent hyperparmeter updates. Typically a more generous
tolerance than |
max_iter |
Maximum number of iterations of the VI algorithm. Default is 5000. |
nrestarts |
Number of random re-starts of the VI algorithm. The result that
gives the highest value of the objective function will be returned.
It is recommended to choose |
keep_restarts |
If |
parallel |
If |
log_restarts |
If |
log_dir |
Directory for logging progress of random restarts. Default is the working directory. |
vi_params_init, hyperparams_init |
Named lists containing initial values for the
variational parameters and hyperparameters. Supplying good initial values can be challenging,
and |
random_init |
If |
random_init_vals |
If
|
A list containing the following elements:
beta_est
estimated exposure coefficients and credible intervals for each outcome.
This is a data frame where the variables est1, cil1, ciu1
correspond to the estimated
coefficient and lower and upper credible interval bounds for the variable in first column
of Xcase
/Xcontrol
. est2, cil2, ciu2
, correspond to the second column in
Xcase
/Xcontrol
,
and so on. The variable group indicates to which estimated group each outcome belongs.
beta_moretrees
estimated exposure coefficients and credible intervals for each outcome group.
This is the same information in beta_est but presented by group. Outcomes
is a list of the
outcomes in each group and n_obs
is the number of
matched pairs corresponding to those outcomes.
theta_est
estimated covariate coefficients and credible intervals for each outcome.
This is a matrix where the columns est1, cil1, ciu1
correspond to the estimated
coefficient and lower and upper credible interval bounds for the variable in first column
of Wcase
/Wcontrol
. est2, cil2, ciu2
, correspond to the second column in
Wcase
/Wcontrol
, and so on.
beta_ml, theta_ml
Results from running separate, classic conditional logisitic
regression models on the data from observations corresponding to each outcome group
shown in beta_moretrees
.
mod
outputs from variational inference algorithm
mod_restarts
outputs from other random restarts of the algorithm, if
nrestarts > 1
1 | vignette('moretrees')
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.