Skip to contents

This function tests a hypothesis (of no effects currently) within each and every block and then adjusts the results to control the False Discovery Rate or Family-wise Error Rate using the base R p.adjust function.

Usage

adjust_block_tests(
  idat,
  bdat,
  blockid = "block",
  pfn,
  p_adj_method = "fdr",
  simthresh = 20,
  sims = 1000,
  fmla = YContNorm ~ trtF,
  parallel = "multicore",
  ncores = 4,
  copydts = FALSE
)

Arguments

idat

Data at the unit level as a data.table.

bdat

Data at the block level as a data.table.

blockid

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

pfn

A function to produce pvalues — using idat.

p_adj_method

A string indicating which method p.adjust should use. Default is "fdr".

simthresh

Below which number of total observations should the p-value functions use permutations rather than asymptotic approximations

sims

Number of permutations for permutation-based testing when the total number of cases is below the threshold.

fmla

A formula with outcome~treatment assignment | block where treatment assignment and block must be factors. The tests will run within each block so that |block part is not strictly important.

parallel

Should the pfn use multicore processing for permutation based testing? Default is no. But could be "snow" or "multicore" following approximate in the coin package.

ncores

The number of cores to use in the p-value creation function

copydts

TRUE or FALSE. TRUE if using standalone. Could be FALSE if copied objects are being sent to this function from other functions. Basically the question is whether we want this function to change the block or individual level datasets in the main environment or return a new object.

Value

A data.table containing information about the sequence tests. The column max_p is the adjusted p-value and the column p is the unadjusted p-value.