scenBuild: Helper to build scenarios

View source: R/scenBuild.R

scenBuildR Documentation

Helper to build scenarios

Description

This function helps create scenarios for simulation analysis

Usage

scenBuild(
  mData,
  ivs,
  scenType = "hypothetical",
  ivStats = rep("median", length(ivs)),
  ivValues = NULL,
  treatVar,
  treatCategorical = TRUE,
  treatVals = NULL,
  intercept = TRUE
)

Arguments

mData

data.frame object that contains at least the variables to construct the scenario

ivs

character vector with all independent variables to be used

scenType

type of scenario to construct: observed value approach, hypothetical, or counterfactual. if using counterfactual then you must supply values for each iv to ivValues in a named list

ivStats

if hypothetical chosen then you have the option of specifying the summary stats to use

ivValues

a named list where the names should exactly match variables in the mData input and values should be those that you wish to generate a prediction for

treatVar

character vector indicating the treatment or treatments to be used

treatCategorical

logical vector indicating whether each of the treatments specified is categorical or not

treatVals

treatment values to test that should be wrapped in a list

intercept

a logical indicating whether model was estimated with an intercept, default is TRUE

Value

a list, the first element being a list of scenario matrices, one for each treatment value. second being a data.frame of the treatment values corresponding to each scenario. third is a character indicating the type of scenario (hypothetical or observed. last being a logical indicating whether or not the treatment variables are categorical.


s7minhas/simHelper documentation built on April 22, 2022, 2:48 a.m.