Skip to contents

This function produces p-values evaluating hypotheses of known forms to help assess the operating characteristics of testing procedures. It creates causal effects of known forms and calls the findBlocks function and passes objects and arguments onto it.

Usage

errsimfn(
  idat,
  bdat,
  pfn,
  splitfn,
  fmla = Y ~ newtrtF | blockF,
  blockid,
  trtvar,
  ybase,
  afn = NULL,
  thealpha = 0.05,
  tau_fn,
  tau_size = 0,
  prop_blocks_0 = 0,
  sims
)

Arguments

idat

Unit-level data. An object inheriting from class data.table

bdat

Block-level data. An object inheriting from class data.table

pfn

A function to produce p-values (see pWilcox for example).

splitfn

A function for splitting the data, see splitLOO for example.

fmla

A formula relating outcomes to treatment and blocks (to be passed to pfn).

blockid

A character name of the column in idat and bdat indicating the block.

trtvar

Is the name of the treatment numeric, (0,1), variable

ybase

Is the potential outcome to control upon which the treatment effect will be built

afn

A function to adjust alpha at each step. Takes one or more p-values plus a stratum or batch indicator.

thealpha

The alpha level of the test.

tau_fn

Is a function that turns ybase into the potential outcome under treatment — it is a treatment effect creating function.

tau_size

Is the parameter for the tau_fn — like the true average effect size within a block.

prop_blocks_0

The proportion of blocks having no treatment effect at all.

sims

Is the number of simulations to run — each simulation uses the same treatment effects be re-assigns treatment (re-shuffles treatment and re-reveals the observed outcomes as a function of the potential outcomes)

Value

A data.table with final pvalues, the associated blocks, the true treatment effects, and the order in which the tests were conducted.