Exact Wald-test

exactt.wald(
  model,
  data,
  alpha = 0.05,
  variables = NULL,
  beta0 = c(0, NULL),
  nBlocks = 5,
  nPerms = NULL,
  studentize = TRUE,
  optimize = FALSE,
  seed = 31740,
  GX.indices,
  ...
)

Arguments

model

A formula specifying the model.

data

A data frame or matrix containing the variables used in the model.

alpha

The significance level used for the hypothesis tests; defaults to 0.05.

variables

Optional; a character vector of predictor names to test. If NULL, all predictors in the model are tested.

beta0

If 0, test whether the variables of interest are equal to the zero vector. If NULL, creates a grid of beta0 values (for confidence intervals) and tests the variables of interest.

nBlocks

The number of blocks to use for block permutations.

nPerms

Optional; the number of permutations to perform. If NULL or greater than the number of possible permutations, all permutations are used.

studentize

Logical indicating whether to use studentized residuals for the test.

optimize

Logical indicating whether to optimize the ordering of the data.

seed

Seed used when optimizing using GA::ga(). Default is 31740.

GX.indices

Indices for max rank GX. Used for warm start.

...

Additional arguments passed to GA::ga() for optimizing power. This can include parameters like popSize, maxiter, parallel, etc., that are used to configure the genetic algorithm. Note that when sample size is large optimizing is computationally expensive and has little effect.

Value

An object of class 'exactt', which includes:

  • summary: A matrix summarizing the test results for each variable.

  • detailed: A list containing detailed test results for each variable.

  • gaResults: Optional; a list of results from the GA::ga() function, included only when power optimization is performed via genetic algorithm parameters. Each element of the list corresponds to results for one of the tested variables, containing details like the best permutations found, fitness scores, and other GA diagnostics.

  • call: The matched call.

Details

The function divides the data into blocks specified by nBlocks and performs permutations within across blocks to generate the null distribution of the test statistic. The user can specify a set number of permutations with nPerms, or allow the function to calculate all possible permutations if nPerms is unspecified or too large.

If studentize is TRUE, studentized residuals are used to adjust the test statistics, potentially leading to more robust inference under model misspecification.

The function allows for a high degree of customization through its parameters and can handle large datasets and complex model structures efficiently.