Learn R Programming

hettx (version 1.0.1)

generate_permutations: Generate permutation distributions for FRT tests

Description

Core engine used by FRTCI and FRTCI_interact to compute the randomization distribution of a test statistic under permuted treatment assignments.

Usage

generate_permutations(
  Y,
  Z,
  test.stat,
  Y0.mat,
  Y1.mat,
  B,
  n.cores,
  get.z.star = NULL,
  verbose = TRUE,
  ...
)

Value

A list with components:

ks.obs

Observed test statistic.

ks.mat

B x grid.size matrix of permuted test statistics.

ci.p

Vector of p-values for each grid point.

Arguments

Y

Outcome vector.

Z

Treatment assignment vector (0/1).

test.stat

Test statistic function taking (Y, Z, ...).

Y0.mat

N x grid.size matrix of imputed control potential outcomes.

Y1.mat

N x grid.size matrix of imputed treated potential outcomes.

B

Number of permutations.

n.cores

Number of cores for parallel computation.

get.z.star

Optional function to generate permuted Z vectors. If NULL, uses sample(Z).

verbose

Whether to display a progress bar. Default is TRUE.

...

Additional arguments passed to test.stat.