create_RCTtoolbox: Create New Toolbox

View source: R/RCTtoolbox-create.r

create_RCTtoolboxR Documentation

Create New Toolbox

Description

Create an R6 class object called "RCTtoolbox".

Usage

create_RCTtoolbox(
  baseline = NULL,
  covariate = NULL,
  data = NULL,
  treat_levels = NULL,
  treat_labels = treat_levels
)

Arguments

baseline

two-sided formula with one or more outcome variables on LHS and one treatment variable on RHS.

covariate

(list of) one-sided formulas with covariates used in regression and balance test on RHS.

data

data.frame/tibble object you want to use.

treat_levels

character vector. Levels of experimental arms. The first element is control arm.

treat_labels

character vector. Labels of experimental arms corresponding to treat_levels. Default is to use treat_levels as labels.

Value

R6 object with "RCTtoolbox" class. The returned object has following fields and methods

data

Field. Store data.frame/tibble passed to data argument. You can access via $data

print()

Method. Print information about the returned object. Run $print()

ttest()

Method. Implement two-sided t-test or permutation test. Run $ttest(). See ttest for help.

power()

Method. Implement power analysis. Run $power(). See power for help.

balance()

Method. Implement balance test. Run $balance(). See balance for help.

lm()

Method. Estimate linear model. Run $lm(). See lm for help.

Private fields

The created R6 object has also private fields. You cannot access from the outside. However, methods of RCTtoolbox use private fields. A list of private fields is as follows:

formula.yd

List of two-sided formula outcome ~ treatment. If you pass y1 + y2 ~ d to the argument baseline, formula.yd refers to list(y1 ~ d, y2 ~ d).

formula.x

Lists of one-sided formula with covariates on RHS which is passed to the argument covariate.

yvec

Character vector of outcome variables.

xvec

Character vector of covariates.

dvec

Character of treatment.

dvec.levels

Character vector passed to the argument treat_levels.

dvec.labels

Character vector passed to the argument treat_labels.

Examples

## Not run: 
data(RubellaNudge)
create_RCTtoolbox(
  baseline = itest + ivacc ~ treat,
  covariate = ~ age + educ,
  data = RubellaNudge,
  treat_levels = LETTERS[1:7]
)

## End(Not run)



KatoPachi/RCTtoolbox documentation built on April 20, 2022, 8:17 a.m.