moretrees_design_tree: 'moretrees_design_tree' converts outcome, exposure, and...

Description Usage Arguments Value

View source: R/moretrees_design_tree.R

Description

moretrees_design_tree converts outcome, exposure, and covariate data into format suitable for analysis using MOReTreeS.

Usage

1
moretrees_design_tree(y, X, W = NULL, outcomes, tr)

Arguments

y

Vector of length n containing outcomes data. If family = "bernoulli", y must be an integer vector where 1 = success, 0 = failure. If family = "gaussian", y must be a numeric vector containing continuous data.

X

An n x K matrix of exposure data, where K is the dimension of the exposure. Grouping of the outcomes will be based on their relationships with the variables in X.

W

Matrix of covariates of dimension n x m. Coefficients for these variables do not affect grouping of the outcomes. Default is NULL (no covariates).

outcomes

is a character vector of length n, where entry i

tr

is an igraph tree, where the leaves represent outcomes. The vertices of tr, V(tr), may have an attribute 'levels' containing integer values from 1 to max(V(tr)$levels). In this case, the levels attribute specifies groups of nodes that share common hyperparameters rho[f], tau[f], and omega[f]. If V(tr)$levels is NULL, moretrees_design_tree will specify levels based on distance from the root node of the tree.

Value

A list containing the following elements: y: Re-ordered outcome vector. X: Re-ordered exposure matrix. W: Re-ordered covariate matrix. A: Matrix for transforming node-level parameters to outcome-level parameters. outcomes_units: list of length equal to the number of unique outcomes. Each element of the list is an integer vector indicating which units (entries of y_reord, rows of X_reord) correspond to each outcomes. outcomes_nodes: list of length equal to the number of unique nodes. Each element of the list is an integer vector indicating which outcomes are descendants of each node. ancestors: list of length equal to the number of unique outcomes. Each element of the list is an integer vector indicating which nodes on the tree (including leaves) are ancestors of the corresponding outcome. levels: an integer vector of length equal to the number of unique nodes. Contains integer values from 1 to max(levels), where the values indicate groups of nodes that share common hyperparameters rho[f], tau[f], and omega[f], where f is the value in levels.


emgthomas/moretrees_pkg documentation built on June 20, 2020, 6:13 p.m.